Example: Allow-From should be ALLOW-FROM
I'll submit a patch tomorrow for this.
RFC Spec: https://tools.ietf.org/html/rfc7034
2.1. Syntax
The header field name is:
X-Frame-Options
There are three different values for the header field. These values
are mutually exclusive; that is, the header field MUST be set to
exactly one of the three values.DENY
A browser receiving content with this header field MUST NOT
display this content in any frame.SAMEORIGIN
A browser receiving content with this header field MUST NOT
display this content in any frame from a page of different origin
than the content itself.If a browser or plugin cannot reliably determine whether or not
the origin of the content and the frame are the same, this MUST be
treated as "DENY".Please note that current implementations vary on the
interpretation of this criteria. In some, it only allows a page
to be framed if the origin of the top-level browsing context is
identical to the origin of the content using the X-Frame-Options
directive; in others, it may consider the origin of the framing
page instead. Also see Section 2.3.2.2 for more details on the
nesting of frames and variations in the handling of this header
field by different browsers. In addition, refer to Section 4,
paragraph 2 for the resulting potential security problems.ALLOW-FROM (followed by a serialized-origin [RFC6454])
A browser receiving content with this header MUST NOT display this
content in a frame from any page with a top-level browsing context
of different origin than the specified origin. While this can
expose the page to risks by the trusted origin, in some cases, it
may be necessary to allow the framing by content from other
domains.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | X-FRAME-OPTIONS-header-should-be-all-caps-3000696-4.patch | 6.14 KB | keithdoyle9 |
Comments
Comment #2
keithdoyle9 commentedChanged all references to X-FRAME-OPTIONS headers to all caps per the RFC.
Comment #3
keithdoyle9 commentedRe-rolled patch and fixed tests to use the same syntax for DENY and SAMEORIGIN.
Comment #4
keithdoyle9 commentedComment #5
keithdoyle9 commentedRe-rolled again because it looks like it's not supposed to have a colon after the directive.
Comment #6
mcdruid commentedThanks.. it does indeed look like the spec says all caps e.g. DENY, SAMEORIGIN and ALLOW-FROM.
However, I'm inclined to think this shouldn't make any real difference in the vast majority of cases. Looking at the firefox source code, for example, there seem to be tests for this header which use a value of
DENYand others which test lowercasedeny.On the other hand HTTP header names are case-insensitive, but values are not necessarily so... and we should follow the specs as closely as possible.
I'm actually more concerned about the errant colon:
...it seems like it's definitely a good thing to remove that.
This change would apply to the D7 branch too (doesn't look like we incorrectly add the colon there).
I will look at this a bit more closely before committing anything, but will most likely make this change in both D8 and D7.
Comment #9
mcdruid commentedCommitted to D8 and D7 branches.
Thanks!
Comment #10
keithdoyle9 commentedSure thing! Glad I could contribute. After looking into it a bit more it seems that the case sensitivity isn't an issue but the colon was.