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

Respect openid_connect_content_security_form_action_enabled configuration only on client-side redirects #10603

Merged
merged 2 commits into from May 13, 2024

Conversation

mitchellhenke
Copy link
Contributor

@mitchellhenke mitchellhenke commented May 10, 2024

🛠 Summary of changes

Following on the long history of #10036, #9790, #9755, #9669, this PR intends to align the behavior of the overly configurable OIDC redirect behavior with openid_connect_content_security_form_action_enabled.

Currently, openid_connect_content_security_form_action_enabled will enable/disable entirely without respect for whether it is needed. This is because the original implementation intended to cut over all redirects to client-side, and then later disable and remove the form-action Content Security Policy (CSP). This is no longer feasible in the near-term. The changes here intend to disable the form-action CSP if and only if openid_connect_content_security_form_action_enabled is disabled and the OIDC redirect method is not server_side. This will allow us to remove the form-action CSP behavior more selectively while maintaining backwards compatibility with service providers that are not able to move to client-side redirects at this point.

A more detailed explanation is available here and here.

…tion on client-side redirects

changelog: Internal, OpenID Connect, Respect openid_connect_content_security_form_action_enabled configuration on client-side redirects
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/oidc-js-redirect-csp-respect branch from 27b900e to 7543202 Compare May 10, 2024 18:39
@mitchellhenke mitchellhenke marked this pull request as ready for review May 10, 2024 19:05
@mitchellhenke mitchellhenke requested review from a team and zachmargolis May 10, 2024 19:05
Comment on lines 12 to 16
return if !IdentityConfig.store.openid_connect_content_security_form_action_enabled &&
oidc_redirect_method(
issuer: authorize_form.service_provider.issuer,
user_uuid: current_user&.uuid,
) != 'server_side'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a really long line and it's repeated, what if we made an named helper for this (with a better name than I am proposing)

Suggested change
return if !IdentityConfig.store.openid_connect_content_security_form_action_enabled &&
oidc_redirect_method(
issuer: authorize_form.service_provider.issuer,
user_uuid: current_user&.uuid,
) != 'server_side'
return if csp_disabled_and_not_server_side?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this suggestion, and honestly i think that name is fine? it's more clear what's happening

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a method and shuffled things a bit into a concern in 1e09a8a

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/oidc-js-redirect-csp-respect branch from 3ee3e6c to febf556 Compare May 13, 2024 13:59
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/oidc-js-redirect-csp-respect branch from febf556 to 1e09a8a Compare May 13, 2024 14:09
@mitchellhenke mitchellhenke merged commit 0bf432c into main May 13, 2024
2 checks passed
@mitchellhenke mitchellhenke deleted the mitchellhenke/oidc-js-redirect-csp-respect branch May 13, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants