Skip to content

Always delete state on linkback - #113

Open
Harm-r wants to merge 2 commits into
cirrusidentity:masterfrom
Harm-r:always-delete-state
Open

Harm-r wants to merge 2 commits into
cirrusidentity:masterfrom
Harm-r:always-delete-state

Conversation

@Harm-r

@Harm-r Harm-r commented Oct 13, 2026

Copy link
Copy Markdown

Currently, simplesamlphp-module-authoauth2 only invalidates the OAuth state parameter on a successful linkback. This is a minimal pull request that makes the Oauth2Controller always delete the state on linkback, notably also on error.

Why?

It is recommended by RFC 9700: "Best Current Practice for OAuth 2.0 Security": "The state value SHOULD be invalidated by the client after its first use at the redirection endpoint.". This is to prevent the state parameter from leaking through e.g. a Referrer header on error.

@pradtke

pradtke commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@Harm-r Thank you for your contribution. We'll review ASAP.

@pradtke

pradtke commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Hi @Harm-r , We've done some review of your PR.

Our error handling for consent/access_denied errors (and potentially other areas) instructs the user to "click back" and then authorize the client. For that to work, the $state must remain in place for error conditions to allow the user to retry.

Reviewing RFC 9700, there are other mitigations available to webapps to reduce referrer header leakage.

During major SSP and PHP upgrades we evaluate more comprehensive changes in this module, and at that time we can see if there is way to allow user's to retry while also invalidating the state.

Thanks again for raising the issue.

@pradtke pradtke added the eval for next major version Things to consider during next major upgrades. label Oct 19, 2026
@Harm-r

Harm-r commented Oct 22, 2026

Copy link
Copy Markdown
Author

Ah, I missed that use of $state in my testing, thank you for pointing that out. I agree with your evaluation that this can wait until a later update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eval for next major version Things to consider during next major upgrades.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants