Bar icon dropdown: barMenu on plugin windows (API v95) #13
3 changed files with 6 additions and 2 deletions
Web panel: IsAllowed fails closed on invalid IDN hosts
Uri.IdnHost throws UriFormatException for hosts like c<U+2100>; catch and reject. Test project now runs with ICU so the case is covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
commit
e428f65c4d
|
|
@ -77,7 +77,9 @@ internal static class WebPanelUrlPolicy
|
|||
if (uri.UserInfo.Length != 0) return false;
|
||||
if (!uri.IsDefaultPort) return false;
|
||||
|
||||
string host = uri.IdnHost.ToLowerInvariant();
|
||||
string host;
|
||||
try { host = uri.IdnHost.ToLowerInvariant(); }
|
||||
catch (UriFormatException) { return false; } // invalid IDN characters: fail closed
|
||||
if (host.EndsWith('.')) host = host.Substring(0, host.Length - 1);
|
||||
if (host.Length == 0) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ internal static class Program
|
|||
})
|
||||
Check(!WebPanelUrlPolicy.IsAllowed(u, Dw), "rejects " + u);
|
||||
Check(!WebPanelUrlPolicy.IsAllowed("https://www.acdreamweave.com/" + new string('a', 5000), Dw), "over MaxUrlBytes rejected");
|
||||
Check(!WebPanelUrlPolicy.IsAllowed("https://www.acdreamweave.c\u2100/", Dw), "invalid IDN char fails closed (no throw)");
|
||||
}
|
||||
|
||||
private static void Allowlist_CaseIdnTrailingDot()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<!-- ICU on: invariant mode skips IDN validation and hides Uri.IdnHost throwing. -->
|
||||
<InvariantGlobalization>false</InvariantGlobalization>
|
||||
<RootNamespace>WebPanelTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue