diff --git a/NuGet.config b/NuGet.config index 1ea5b4e25974..db6d7b18c19d 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,8 +6,10 @@ + + @@ -30,8 +32,10 @@ + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5f6b09f76908..4887049b06d6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,325 +9,325 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 46c88f8ca38ff2f5b3c202f4d016f23918ab62e8 + 0d9843b88793b08762c73ef59a9083357e602ef5 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 https://github.com/dotnet/xdt @@ -367,22 +367,22 @@ bc1c3011064a493b0ca527df6fb7215e2e5cfa96 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 - - https://github.com/dotnet/source-build-externals - ab469606a3e6b026dcac301e2dab96117c94faeb + + https://dev.azure.com/dnceng/internal/_git/dotnet-source-build-externals + 9c6c10cce644179b2f41cbb8064f07efee903c55 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - f2c8152eed158e72950025393fde498c90a57a6b + d839c41c85988aadc213e8e42269ecd7883a1790 https://github.com/dotnet/winforms diff --git a/eng/Versions.props b/eng/Versions.props index a27626a55231..5a9ca3284d60 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,7 +11,7 @@ 19 - 8.0.1 + 8.19.2 *-* - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17-servicing.26264.16 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17-servicing.26264.16 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17-servicing.26264.16 - 9.0.17-servicing.26264.16 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18-servicing.26315.22 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18-servicing.26315.22 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18-servicing.26315.22 + 9.0.18-servicing.26315.22 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 - 9.0.17-servicing.26264.16 - 9.0.17 + 9.0.18-servicing.26315.22 + 9.0.18 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 10.7.0-preview.1.26269.1 10.7.0-preview.1.26269.1 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 - 9.0.17 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 + 9.0.18 4.11.0-3.24554.2 4.11.0-3.24554.2 @@ -170,7 +170,7 @@ 9.0.0-beta.26301.4 9.0.0-beta.26301.4 - 9.0.0-alpha.1.24575.1 + 9.0.0-alpha.1.26309.11 9.0.0-alpha.1.26319.1 diff --git a/global.json b/global.json index ce441dec1e75..750f0dcc501d 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "9.0.118" + "version": "9.0.119" }, "tools": { - "dotnet": "9.0.118", + "dotnet": "9.0.119", "runtimes": { "dotnet/x86": [ "$(MicrosoftNETCoreBrowserDebugHostTransportVersion)" diff --git a/src/Components/WebAssembly/Server/src/TargetPickerUi.cs b/src/Components/WebAssembly/Server/src/TargetPickerUi.cs index 9f489ea9a161..a17e709a689f 100644 --- a/src/Components/WebAssembly/Server/src/TargetPickerUi.cs +++ b/src/Components/WebAssembly/Server/src/TargetPickerUi.cs @@ -271,6 +271,9 @@ public async Task Display(HttpContext context) var debuggerTabsListUrl = $"{_browserHost}/json"; IEnumerable availableTabs; + var targetApplicationUrlEncoded = WebUtility.HtmlEncode(targetApplicationUrl.ToString()); + var debuggerTabsListUrlEncoded = WebUtility.HtmlEncode(debuggerTabsListUrl); + try { availableTabs = await GetOpenedBrowserTabs(); @@ -280,17 +283,17 @@ public async Task Display(HttpContext context) await context.Response.WriteAsync($@"

Unable to find debuggable browser tab

- Could not get a list of browser tabs from {debuggerTabsListUrl}. + Could not get a list of browser tabs from {debuggerTabsListUrlEncoded}. Ensure your browser is running with debugging enabled.

Resolution

If you are using Google Chrome or Chromium for your development, follow these instructions:

- {GetLaunchChromeInstructions(targetApplicationUrl.ToString())} + {GetLaunchChromeInstructions(targetApplicationUrlEncoded)}

If you are using Microsoft Edge (80+) for your development, follow these instructions:

- {GetLaunchEdgeInstructions(targetApplicationUrl.ToString())} + {GetLaunchEdgeInstructions(targetApplicationUrlEncoded)}

This should launch a new browser window with debugging enabled..

Underlying exception:

@@ -316,8 +319,8 @@ Ensure your browser is running with debugging enabled. var suffix = string.IsNullOrEmpty(targetApplicationUrl) ? string.Empty - : $" matching the URL {WebUtility.HtmlEncode(targetApplicationUrl)}"; - await context.Response.WriteAsync($"

The list of targets returned by {WebUtility.HtmlEncode(debuggerTabsListUrl)} contains no entries{suffix}.

"); + : $" matching the URL {targetApplicationUrlEncoded}"; + await context.Response.WriteAsync($"

The list of targets returned by {debuggerTabsListUrlEncoded} contains no entries{suffix}.

"); await context.Response.WriteAsync("

Make sure your browser is displaying the target application.

"); } else diff --git a/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs b/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs index c0fdeba9c553..92ebf8d29123 100644 --- a/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs +++ b/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs @@ -21,7 +21,32 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti { var user = identity.Name!; var userAccountNameIndex = user.IndexOf('@'); - var userAccountName = userAccountNameIndex == -1 ? user : user.Substring(0, userAccountNameIndex); + + // Without a realm in the name (no '@'), we cannot tell which directory the principal came from. + // The local part alone is not a safe LDAP lookup key — sAMAccountName is unique only within a single domain, + // so any same-named account in the configured domain would be returned. + if (userAccountNameIndex == -1) + { + logger.LogDebug( + "Skipping LDAP claim resolution for '{User}': its realm cannot be verified against the configured LDAP domain '{Domain}'.", + user, settings.Domain); + + return; + } + + // With a realm that doesn't match settings.Domain the principal authenticated through a foreign Kerberos realm + // should NOT be trusted by the application's realm. + var realm = user.AsSpan(userAccountNameIndex + 1); + if (!realm.Equals(settings.Domain.AsSpan(), StringComparison.OrdinalIgnoreCase)) + { + logger.LogDebug( + "Skipping LDAP claim resolution for '{User}': principal realm does not match the configured LDAP domain '{Domain}'. Cross-domain claim resolution is not supported.", + user, settings.Domain); + + return; + } + + var userAccountName = user[..userAccountNameIndex]; if (settings.ClaimsCache == null) { @@ -41,7 +66,7 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti var distinguishedName = settings.Domain.Split('.').Select(name => $"dc={name}").Aggregate((a, b) => $"{a},{b}"); var retrievedClaims = new List(); - var filter = $"(&(objectClass=user)(sAMAccountName={userAccountName}))"; // This is using ldap search query language, it is looking on the server for someUser + var filter = $"(&(objectClass=user)(sAMAccountName={EscapeLdapFilterValue(userAccountName)}))"; // This is using ldap search query language, it is looking on the server for someUser var searchRequest = new SearchRequest(distinguishedName, filter, SearchScope.Subtree); Debug.Assert(settings.LdapConnection != null); @@ -70,7 +95,7 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti if (!settings.IgnoreNestedGroups) { - GetNestedGroups(settings.LdapConnection, identity, distinguishedName, groupCN, logger, retrievedClaims, new HashSet()); + GetNestedGroups(settings.LdapConnection, identity, distinguishedName, groupDN, groupCN, logger, retrievedClaims, new HashSet()); } else { @@ -98,23 +123,29 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti } } - private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity principal, string distinguishedName, string groupCN, ILogger logger, IList retrievedClaims, HashSet processedGroups) + private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity principal, string distinguishedName, string groupDN, string groupCN, ILogger logger, IList retrievedClaims, HashSet processedGroups) { retrievedClaims.Add(groupCN); - var filter = $"(&(objectClass=group)(sAMAccountName={groupCN}))"; // This is using ldap search query language, it is looking on the server for someUser - var searchRequest = new SearchRequest(distinguishedName, filter, SearchScope.Subtree); - var searchResponse = (SearchResponse)connection.SendRequest(searchRequest); + // Look up the group entry by its distinguished name using base scope: + // a base-scope read against the DN is the only LDAP operation that + // returns exactly the intended group object. + var searchRequest = new SearchRequest(groupDN, "(objectClass=group)", SearchScope.Base); + SearchResponse searchResponse; + try + { + searchResponse = (SearchResponse)connection.SendRequest(searchRequest); + } + catch (DirectoryOperationException ex) when (ex.Response is SearchResponse r && r.ResultCode == ResultCode.NoSuchObject) + { + // Stale memberOf reference: group no longer exists. Stop traversal of this branch. + logger.LogDebug("Stale memberOf reference: group with distinguished name '{GroupDN}' no longer exists; stopping traversal.", groupDN);; + return; + } if (searchResponse.Entries.Count > 0) { - if (searchResponse.Entries.Count > 1 && logger.IsEnabled(LogLevel.Warning)) - { - logger.LogWarning($"More than one response received for query: {filter} with distinguished name: {distinguishedName}"); - } - var group = searchResponse.Entries[0]; // Get the object that was found on ldap - var groupDN = group.DistinguishedName; processedGroups.Add(groupDN); @@ -132,9 +163,45 @@ private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity pr return; } - GetNestedGroups(connection, principal, distinguishedName, nestedGroupCN, logger, retrievedClaims, processedGroups); + GetNestedGroups(connection, principal, distinguishedName, nestedGroupDN, nestedGroupCN, logger, retrievedClaims, processedGroups); } } } } + + /// + /// Escapes special characters in a value used in an LDAP search filter per RFC 4515 + /// https://datatracker.ietf.org/doc/html/rfc4515#section-3 + /// + // internal for testing + internal static string EscapeLdapFilterValue(string value) + { + var sb = new StringBuilder(value.Length); + foreach (var c in value) + { + switch (c) + { + case '\\': + sb.Append(@"\5c"); + break; + case '*': + sb.Append(@"\2a"); + break; + case '(': + sb.Append(@"\28"); + break; + case ')': + sb.Append(@"\29"); + break; + case '\0': + sb.Append(@"\00"); + break; + default: + sb.Append(c); + break; + } + } + + return sb.ToString(); + } } diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs index 03908ad85ca0..fe288afd80bc 100644 --- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs +++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs @@ -1,10 +1,122 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Security.Claims; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging.Abstractions; + namespace Microsoft.AspNetCore.Authentication.Negotiate.Test; public class LdapAdapterTests { + [Fact] + public async Task RetrieveClaimsAsync_ForeignRealm_SkipsLookupAndAddsNoClaims() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp" + }; + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin@foreign.corp")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType); + } + + [Fact] + public async Task RetrieveClaimsAsync_ForeignRealm_DifferentCasing_SkipsLookup() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp", + }; + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin@FOREIGN.CORP")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType); + } + + [Fact] + public async Task RetrieveClaimsAsync_BareUsernameNoRealm_SkipsLookup() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp", + }; + + // No '@' means we cannot verify which realm "admin" came from. + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType); + } + + [Fact] + public async Task RetrieveClaimsAsync_DownLevelDomainUser_SkipsLookup() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp", + }; + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, @"LOCAL\admin")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType); + } + + [Fact] + public async Task RetrieveClaimsAsync_MatchingRealm_SameCasing_RetrievesCachedClaims() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp", + }; + var roles = new[] { "Engineers", "Admins" }; + var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = settings.ClaimsCacheSize }); + cache.Set("alice@local.corp", (IEnumerable)roles, new MemoryCacheEntryOptions().SetSize(64)); + settings.ClaimsCache = cache; + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "alice@local.corp")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + var roleClaims = identity.Claims + .Where(c => c.Type == identity.RoleClaimType) + .Select(c => c.Value) + .ToArray(); + Assert.Equal(roles, roleClaims); + } + + [Fact] + public async Task RetrieveClaimsAsync_MatchingRealm_DifferentCasing_RetrievesCachedClaims() + { + var settings = new LdapSettings + { + EnableLdapClaimResolution = true, + Domain = "local.corp", + }; + var roles = new[] { "Engineers", "Admins" }; + var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = settings.ClaimsCacheSize }); + cache.Set("alice@LOCAL.CORP", (IEnumerable)roles, new MemoryCacheEntryOptions().SetSize(64)); + settings.ClaimsCache = cache; + var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "alice@LOCAL.CORP")], "Negotiate"); + + await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance); + + var roleClaims = identity.Claims + .Where(c => c.Type == identity.RoleClaimType) + .Select(c => c.Value) + .ToArray(); + Assert.Equal(roles, roleClaims); + } + [Fact] public void DistinguishedNameWithoutCommasSuccess() { @@ -36,4 +148,47 @@ public void DistinguishedNameWithEscapedBackslashAndNotEscapedCommaSuccess() Assert.Equal(new[] { @"Testing group\\", "City" }, parts); } + + [Fact] + public void EscapeLdapFilterValue_PlainValue_ReturnsUnchanged() + { + Assert.Equal("JohnDoe", LdapAdapter.EscapeLdapFilterValue("JohnDoe")); + } + + [Fact] + public void EscapeLdapFilterValue_Wildcard_IsEscaped() + { + Assert.Equal(@"\2a", LdapAdapter.EscapeLdapFilterValue("*")); + } + + [Fact] + public void EscapeLdapFilterValue_Parentheses_AreEscaped() + { + Assert.Equal(@"John\28Dev\29", LdapAdapter.EscapeLdapFilterValue("John(Dev)")); + } + + [Fact] + public void EscapeLdapFilterValue_Backslash_IsEscaped() + { + Assert.Equal(@"DOMAIN\5cUser", LdapAdapter.EscapeLdapFilterValue(@"DOMAIN\User")); + } + + [Fact] + public void EscapeLdapFilterValue_NullChar_IsEscaped() + { + Assert.Equal(@"before\00after", LdapAdapter.EscapeLdapFilterValue("before\0after")); + } + + [Fact] + public void EscapeLdapFilterValue_InjectionPayload_IsNeutralized() + { + var malicious = "x)(sAMAccountName=*"; + Assert.Equal(@"x\29\28sAMAccountName=\2a", LdapAdapter.EscapeLdapFilterValue(malicious)); + } + + [Fact] + public void EscapeLdapFilterValue_EmptyString_ReturnsEmpty() + { + Assert.Equal(string.Empty, LdapAdapter.EscapeLdapFilterValue(string.Empty)); + } } diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs index f84b5b5b5771..0ba23543552a 100644 --- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs +++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs @@ -208,7 +208,7 @@ public async Task AuthHeaderAfterNtlmCompleted_ReAuthenticates(bool persist) public async Task RBACClaimsRetrievedFromCacheAfterKerberosCompleted() { var claimsCache = new MemoryCache(new MemoryCacheOptions()); - claimsCache.Set("name", new string[] { "CN=Domain Admins,CN=Users,DC=domain,DC=net" }); + claimsCache.Set("name@domain.NET", new string[] { "CN=Domain Admins,CN=Users,DC=domain,DC=net" }); NegotiateOptions negotiateOptions = null; using var host = await CreateHostAsync(options => { @@ -547,7 +547,7 @@ public IIdentity GetIdentity() { throw new InvalidOperationException("Authentication is not complete."); } - return new GenericIdentity("name", _protocol); + return new GenericIdentity("name@domain.NET", _protocol); } public string GetOutgoingBlob(string incomingBlob, out BlobErrorType errorType, out Exception ex) diff --git a/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj b/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj index b670eccaa52f..c958c3eb1f6a 100644 --- a/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj +++ b/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj @@ -33,6 +33,13 @@ + + +