Skip to content

Add note on CSP sandbox causing to iframe sandbox section #40468

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

Merged
merged 2 commits into from
Jul 22, 2025

Conversation

krikera
Copy link
Contributor

@krikera krikera commented Jul 21, 2025

Description

Added a new bullet point to the list of cases where the Origin header may be null.
It covers the scenario where a page is served with a Content-Security-Policy: sandbox header without the allow-same-origin directive.

Fixes #40093

@krikera krikera requested a review from a team as a code owner July 21, 2025 13:13
@krikera krikera requested review from hamishwillee and removed request for a team July 21, 2025 13:13
@github-actions github-actions bot added Content:HTTP HTTP docs size/xs [PR only] 0-5 LoC changed labels Jul 21, 2025
Copy link
Contributor

github-actions bot commented Jul 21, 2025

Preview URLs

Flaws (3)

URL: /en-US/docs/Web/HTTP/Reference/Headers/Origin
Title: Origin header
Flaw count: 3

  • unknown:
    • No generic content config found
    • no blog root
    • no blog root

(comment last updated: 2025-07-21 23:59:05)

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

Thanks very much!

@hamishwillee hamishwillee merged commit 00dd871 into mdn:main Jul 22, 2025
8 checks passed
Comment on lines +65 to +66
- Documents served with the {{HTTPHeader("Content-Security-Policy")}} `sandbox` directive that don't include `allow-same-origin`.
- {{HTMLElement("iframe", "iframes")}} with a sandbox attribute that don't contain the value `allow-same-origin`.
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be "that doesn't" since "that" refers to the singular "directive"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The subject is the iframes - my understanding is that the modifier "with a sandbox attribute" does not change that.

But in honestly, I didn't think about it at all - the other way "feels wrong".

Copy link
Member

@Josh-Cena Josh-Cena Jul 22, 2025

Choose a reason for hiding this comment

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

The iframe doesn't "contain the value"; the attribute "contains the value". It should read "iframes (with a sandbox attribute (that doesn't contain the value))", not "iframes (with a sandbox attribute) (that don't contain the value)" (and in this case the latter should use "and which don't contain the value" anyway)

Copy link
Collaborator

@hamishwillee hamishwillee Jul 22, 2025

Choose a reason for hiding this comment

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

In English, the iframe contains the attribute so it also contains the allow-same-attribute. This isn't ambiguous, but I guess our job is to be very pedantic.

- Documents served with the {{HTTPHeader("Content-Security-Policy")}} `sandbox` directive, where the directive value doesn't include `allow-same-origin`.
- {{HTMLElement("iframe", "iframes")}} with a sandbox attribute where the attribute doesn't contain the value `allow-same-origin`.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mention that Content-Security-Policy: sandbox can lead to Origin: null
3 participants