Remote authenticators violate CSP form-action 'self' #55491
Labels
area-security
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
Status: Resolved
Is there an existing issue for this?
Describe the bug
Remote authenticators, like Google, violate a basic non-strict Content Security Policy.
Expected Behavior
I understand that the potential for this violation is documented and depends on browser implementation, which varies.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/form-action
I understand that the issue has been reported since 2015 and discussed every few years with relatively little progress. It has been identified that this frustrates remote authentication workflows, especially OAuth.
w3c/webappsec-csp#8
Some folks in that thread propose breaking up the workflow to avoid the redirect, including a custom interstitial page, but we may be stuck with whatever AspNetCore supports.
Steps To Reproduce
Follow the instructions to add Google external login and especially the instructions to create a sample webapp. Add the following middleware:
Exceptions (if any)
The following CSP violation is raised (see the browser developer tools console):
Network trace
Following are the relevant request/response headers:
.NET Version
8.0.204
Anything else?
.NET SDK:
Version: 8.0.204
Commit: c338c7548c
Workload version: 8.0.200-manifests.7d36c14f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22635
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.204\
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.4
Architecture: x64
Commit: 2d7eea2529
.NET SDKs installed:
8.0.204 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered: