IdentityServer4: combo of response_mode=form_post and state protection not working
See original GitHub issueI am using latest 3.14.0 release and have trouble setting up following provider:
Providers.IdentityServer4({
id: 'identity-server4',
name: 'IdentityServer4',
scope: 'openid profile email offline_access',
domain: XXX,
clientId: XXX,
clientSecret: XXX,
authorizationParams: {
prompt: 'login',
response_mode: 'form_post'
}
})
When setting response_mode
to 'form_post'
(which enforces the IdP to send the data back via POST instead of GET https://identityserver4.readthedocs.io/en/latest/endpoints/authorize.html) I run into several issues. GET method works fine, but pen-test team insists to use POST.
First is the fact, that state-handler accepts only state passed in query https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/state-handler.js#L19
Whenever I change it to:
const state = req.query.state || req.body.state;
I am able to get a step further, to next issue. It appears that the existing and expected state
calculation is somehow wrong:
[next-auth][debug][oauth_callback_protection] Comparing received and expected state {
state: 'c064b8b9ff3df38f8b3a8ce260cc5e9fc1c7dfcfe855c19da38863e207b63a55',
expectedState: '226418f7beb8a5a755f6fb0b42dfad47c75b84130b6bbeec0d3474af6c03f5f0'
}
Does anyone have a similar setup and experience similar issues?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Correlation failed at signin-oidc redirect · Issue #720
I am hitting this with the following combination: Browser incognito mode; Application is behind Azure gateway. I am not even using IdentityServer; it...
Read more >Message "Unable to unprotect message.State" when ...
When running a single instance of IdentityServer4, we can login with another identity provider succesfully. As soon as we create several ...
Read more >IdentityServer4 Authorization and Working with Claims
We can use claims to show identity-related information in our application but, we can use it for the authorization process as well.
Read more >IdentityServer4 Documentation
We believe that the combination of OpenID Connect and OAuth 2.0 is the ... the typical security problems of today's mobile, native and...
Read more >IdentityServer4 Documentation
We believe that the combination of OpenID Connect and OAuth 2.0 is the ... the typical security problems of today's mobile, native and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@balazsorban44 another round of penetration tests is through and the feedback is positive 🥳 High five!
Thank you @balazsorban44, I’ve bumped the package version to latest. Pentest team is planning a retest round later this week - I’ll get back to you once I have some feedback from their end.