Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'unsafe-eval' required for .net core 2.2 POST to IssuerAddress (OIDC) #1263

Closed
99littlebugs opened this issue Oct 4, 2019 · 1 comment
Closed
Assignees
Labels
Customer reported Indicates issue was opened by customer P1 More important, prioritize highly
Milestone

Comments

@99littlebugs
Copy link

As first raised in dotnet/aspnetcore#14721. We are using ADFS with OpenID Connect for an ASP.NET core application, which we just upgraded from 2.0 to 2.2.

Once upgraded to 2.2, we found that the form POST to the ADFS server required our content security policy to have 'unsafe-eval'. The string in question is window.setTimeout('document.forms[0].submit()', 0);.
In 2.0, the script just reads document.form.submit(), and therefore works fine even with our CSP.

It seems to be coming from BuildFormPost() in AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet. I'm not sure how that repository relates to the standard .net core ones, as we aren't using any additional nuget packages for authentication. It was also hard for me to tell how those versions relate to the .net core versions and what that code used to look like.

We managed to get around this and only relax the policy when the user has no claims, aka, is trying to login, but it still seems like we are missing something.

  • What is the point of setTimeout with a 0?
  • Why does the argument of setTimeout need to be a string?

To Reproduce

  1. Setup OIDC
  2. Set a content security policy
  3. Run code
  4. Note how 2.2 will get blocked by browser (Chrome) but 2.0 will not.

Expected behavior

To not need to have a more relaxed content security policy for page that has the authentication form that is submitted via JavaScript.

@brentschmaltz brentschmaltz added the Customer reported Indicates issue was opened by customer label Oct 8, 2019
@brentschmaltz brentschmaltz self-assigned this Oct 8, 2019
@brentschmaltz brentschmaltz added this to the 5.6.0 milestone Oct 8, 2019
@mafurman
Copy link
Member

@99littlebugs If we add a setter for the 'Script' property will that address the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer reported Indicates issue was opened by customer P1 More important, prioritize highly
Projects
None yet
Development

No branches or pull requests

3 participants