Skip to content

client/web: fix CSRF handler order in web UI#15143

Merged
patrickod merged 1 commit intomainfrom
patrickod/reverse-web-handler-order-csrf
Feb 27, 2025
Merged

client/web: fix CSRF handler order in web UI#15143
patrickod merged 1 commit intomainfrom
patrickod/reverse-web-handler-order-csrf

Conversation

@patrickod
Copy link
Copy Markdown
Contributor

Fix the order of the CSRF handlers (HTTP plaintext context setting, then enforcement) in the construction of the web UI server. This resolves false-positive "invalid Origin" 403 exceptions when attempting to update settings in the web UI.

Updates #14822
Updates #14872

@patrickod patrickod requested review from awly and willnorris February 26, 2025 20:49
Copy link
Copy Markdown
Member

@awly awly left a comment

Choose a reason for hiding this comment

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

Is it feasible to unit test this? Just to add a regression test for the future

@willnorris
Copy link
Copy Markdown
Member

If it's not feasible to test (and maybe even if it is), could also add a short comment about the intentional ordering.

@patrickod patrickod force-pushed the patrickod/reverse-web-handler-order-csrf branch from 4e16c29 to b883dd7 Compare February 27, 2025 17:53
Fix the order of the CSRF handlers (HTTP plaintext context setting,
_then_ enforcement) in the construction of the web UI server. This
resolves false-positive "invalid Origin" 403 exceptions when attempting
to update settings in the web UI.

Add unit test to exercise the CSRF protection failure and success cases
for our web UI configuration.

Updates #14822
Updates #14872

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
@patrickod patrickod force-pushed the patrickod/reverse-web-handler-order-csrf branch from bfd3e15 to a4e843c Compare February 27, 2025 19:43
@patrickod patrickod merged commit f5522e6 into main Feb 27, 2025
50 checks passed
@patrickod patrickod deleted the patrickod/reverse-web-handler-order-csrf branch February 27, 2025 19:58
@patrickod patrickod restored the patrickod/reverse-web-handler-order-csrf branch February 27, 2025 21:57
patrickod added a commit that referenced this pull request Feb 27, 2025
Fix the order of the CSRF handlers (HTTP plaintext context setting,
_then_ enforcement) in the construction of the web UI server. This
resolves false-positive "invalid Origin" 403 exceptions when attempting
to update settings in the web UI.

Add unit test to exercise the CSRF protection failure and success cases
for our web UI configuration.

Updates #14822
Updates #14872

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
patrickod added a commit that referenced this pull request Feb 27, 2025
Fix the order of the CSRF handlers (HTTP plaintext context setting,
_then_ enforcement) in the construction of the web UI server. This
resolves false-positive "invalid Origin" 403 exceptions when attempting
to update settings in the web UI.

Add unit test to exercise the CSRF protection failure and success cases
for our web UI configuration.

Updates #14822
Updates #14872

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
KevinLiang10 pushed a commit that referenced this pull request Jun 3, 2025
Fix the order of the CSRF handlers (HTTP plaintext context setting,
_then_ enforcement) in the construction of the web UI server. This
resolves false-positive "invalid Origin" 403 exceptions when attempting
to update settings in the web UI.

Add unit test to exercise the CSRF protection failure and success cases
for our web UI configuration.

Updates #14822
Updates #14872

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
thirdeyenick pushed a commit to ninech/tailscale that referenced this pull request Jul 2, 2025
Fix the order of the CSRF handlers (HTTP plaintext context setting,
_then_ enforcement) in the construction of the web UI server. This
resolves false-positive "invalid Origin" 403 exceptions when attempting
to update settings in the web UI.

Add unit test to exercise the CSRF protection failure and success cases
for our web UI configuration.

Updates tailscale#14822
Updates tailscale#14872

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
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.

3 participants