Closed twenzel closed 6 years ago
I'm the author of #1811, After publishing, we're having the same issue where it works fine on localhost. We too run behind a load balancer.
Refused to send form data to 'https://abc.edu.tr/connect/authorize?client_id=sabis.adabis.mvc&redirect_uri=https%3A%2F%2Fadabismvc.sakarya.edu.tr%2Fsignin-oidc&response_type=code%20id_token&scope=openid%20profile%20offline_access&response_mode=form_post&nonce=636487535314992627.M2YzNDAzYTMtNzg5YS00MzIwLTkyYjQtMjk5NDY3MmQ5YmMxZGYyYjk2ZDQtYjQ2ZS00N2E2LTllYWQtYjkyYjdhNDhmNTU0&state=CfDJ8KEMmXMUTTpNhx0xZPiKaIbS1v2vzr_t_InIpmYv6VXUUeH76kZoTj9seLB-kEd4OznfO8BTZUgI9EmY-XlOXDJbZEMAc8-c4DzuTckGCf3J6wr_8Ix4vEraiZeLUXSupVdvC3oV8VT7NkC0p4pdQO2MzfvUhm6QLDavzdMwXVlD2uJGifkTcVnPhod0f_Ahc_pfRVqL9k-bAnkPVaZoFfjM8pPg1dZsbo-gFYtsUS5HmH6Uq7dd8XRY1WFNdkPXVcSreWEQxUbgXyzcV1dUu59e-CODSUu_vU8nHvF_VoAK4nGiSsj4xn21KbwiJibDSBUDgO0yC8vyF7qHlbzd020b5IpaHvc-ukHK9ZhJ9jM6&x-client-SKU=ID_NET&x-client-ver=2.1.4.0' because it violates the following Content Security Policy directive: "form-action https://adabismvc.sakarya.edu.tr".
callback response header:
Content-Security-Policy:default-src 'none'; frame-ancestors https://adabismvc.sakarya.edu.tr; form-action https://adabismvc.sakarya.edu.tr; script-src 'sha256-VuNUSJ59bpCpw62HM2JG/hCyGiqoPN3NqGvNXQPU+rY=';
And this is identityserver:
<PackageReference Include="IdentityServer4" Version="2.0.3" />
I still couldn't check client logs but not sure if I'll find the solution there.
We've also been running into this issue in IdentityServer4 2.0.5 and 2.0.4, though through a different workflow. CSP is blocking the redirect to RedirectUrl after successfully logging in with no load balancer or other infrastructure in place. For a temporary workaround (before realizing we could just downgrade) we found that if we enabled the consent screen (RequiresConsent=true), everything worked fine and the issue was avoided.
As for the actual error, this is what is what we get:
Refused to send form data to 'http://localhost:64062/' because it violates the following Content Security Policy directive: "form-action http://localhost:5000".
Downgrading to IdentityServer4 2.0.3 fixes the issue.
@zapatodefuego
Refused to send form data to 'http://localhost:64062/' because it violates the following Content Security Policy directive: "form-action http://localhost:5000".
This tells me your CSP is on the login page, right? Did you happen to update it to the latest CSP we issue in the quickstart UI? https://github.com/IdentityServer/IdentityServer4/blob/release/src/Host/Quickstart/SecurityHeadersAttribute.cs
I have removed the form-action that was added in the 2.0.4 release. Can you test against the myget feed that contains our dev builds? http://docs.identityserver.io/en/release/intro/packaging.html
Thanks.
Actually, to make it easier to test we pushed a 2.0.6-preview1 to NuGet. Have a look, please.
I have upgraded the identity server from 2.0.5 to the 2.0.6-preview1 and the error is gone. Though I am still puzzled as to why this has been happening to me.
I will describe my case FWIW. We did not have a load balancer.
Puzzling fact#1: The error only appeared if the client application hit my OnRemoteFailure event which redirected to Home page like this
context.HandleResponse(); context.Response.Redirect("/Home");
Puzzling fact#2: All the header values were equal to the those if no error was occurred.
P.S. Firefox had been ignoring the error and just redirected.
P.P.S I used OnRemoteFailure for an unrelated nonce cookie handling.
I have seen odd behaviors in Chrome when there are several redirects involved and it seems like the CSP from the last visible and rendered page is what's honored.
With the 2.0.6-preview1
version the error is gone.
@twenzel I have same issue with 2.2.0 version
I don't want to open new issue so i wrote here. I am facing the same problem too with IdentityServer4.AccessTokenValidation (version 2.6.0)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
This issue is similar to #1811. After upgrading from 2.0.3 to 2.0.4 the callback to the client is broken with
The problem is, that no configuration says that
http
should be used. Everything should be running onhttps
.The response header of the callback page (
https://xy.com/connect/authorize/callback?client_id=tesma&redirect_uri=https%3A%2F%2Ftesmar4-qa.xy.com%2Fsignin-oidc&response_mode=form_post&response_type=code%20id_token&scope=openid%20leaseService%20documentService%20assetService%20masterdataService%20datacontext&state=OpenIdConnect.AuthenticationProperties%3D0HwTJ...
)defines following CSP (
Content-Security-Policy
)default-src 'none'; frame-ancestors https://tesmar4-qa.chg-meridian.com; form-action https://tesmar4-qa.chg-meridian.com; script-src 'sha256-VuNUSJ59bpCpw62HM2JG/hCyGiqoPN3NqGvNXQPU+rY=';
The callback page returns the correct HTML:
What might be a root of this issue is, that we're running behind a load balancer doing SSL offloading. Therefor we already set the
PublicOrigin
andIssuerUri
option to the public url.I guess the bugfix #1748 (which introduced the
form-action
CSP) might be a problem. I can reproduce it with Chrome (64).