Bug 185567 - X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
Summary: X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar, WebExposed
Depends on:
Blocks:
 
Reported: 2018-05-11 16:04 PDT by Daniel Bates
Modified: 2018-05-11 21:11 PDT (History)
9 users (show)

See Also:


Attachments
Patch and layout tests (19.01 KB, patch)
2018-05-11 16:26 PDT, Daniel Bates
bfulgham: review+
Details | Formatted Diff | Diff
For EWS (18.71 KB, patch)
2018-05-11 20:06 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-05-11 16:04:16 PDT
X-Frame-Options: SAMEORIGIN needs to check all ancestor frames.
Comment 1 Daniel Bates 2018-05-11 16:04:24 PDT
<rdar://problem/40175008>
Comment 2 Daniel Bates 2018-05-11 16:04:48 PDT
Mozilla bug: <https://bugzilla.mozilla.org/show_bug.cgi?id=725490>
Comment 3 Daniel Bates 2018-05-11 16:04:55 PDT
Chrome issue: <https://bugs.chromium.org/p/chromium/issues/detail?id=250309>
Comment 4 Daniel Bates 2018-05-11 16:25:42 PDT
RFC: <https://tools.ietf.org/html/rfc7034>
Comment 5 Daniel Bates 2018-05-11 16:26:34 PDT
Created attachment 340230 [details]
Patch and layout tests
Comment 6 EWS Watchlist 2018-05-11 16:28:39 PDT
Attachment 340230 [details] did not pass style-queue:


ERROR: Source/WebKit/ChangeLog:11:  Please consider whether the use of security-sensitive phrasing could help someone exploit WebKit: malicious, malicious, malicious  [changelog/unwantedsecurityterms] [3]
ERROR: Source/WebCore/ChangeLog:11:  Please consider whether the use of security-sensitive phrasing could help someone exploit WebKit: malicious, malicious, malicious  [changelog/unwantedsecurityterms] [3]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Brent Fulgham 2018-05-11 16:31:36 PDT
Comment on attachment 340230 [details]
Patch and layout tests

View in context: https://bugs.webkit.org/attachment.cgi?id=340230&action=review

r=me, but I have a few minor complaints about the patch I hope you can resolve before landing.

> Source/WebCore/loader/FrameLoader.cpp:3423
> +                return true;

Ha! It's funny it was every written as a break, considering that the loop wasn't doing anything meaningful! :-)

> Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:419
> +        if (!SecurityOrigin::create(url)->isSameSchemeHostPort(*m_parameters.sourceOrigin))

Do we need to create the SecurityOrigin twice?

> Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:421
> +        for (auto& origin : m_parameters.frameAncestorOrigins) {

It's weird to have origin defined in two scopes, even though it apparently works. Could you name one the "sourceOrigin" or "topLevelOrigin" or something?
Comment 8 Daniel Bates 2018-05-11 18:39:18 PDT
Comment on attachment 340230 [details]
Patch and layout tests

View in context: https://bugs.webkit.org/attachment.cgi?id=340230&action=review

>> Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:419
>> +        if (!SecurityOrigin::create(url)->isSameSchemeHostPort(*m_parameters.sourceOrigin))
> 
> Do we need to create the SecurityOrigin twice?

Oops! Will fix before landing.

>> Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:421
>> +        for (auto& origin : m_parameters.frameAncestorOrigins) {
> 
> It's weird to have origin defined in two scopes, even though it apparently works. Could you name one the "sourceOrigin" or "topLevelOrigin" or something?

Oops! I hope you do not mind that I rename the loop variable ancestorOrigin to resolve this ambiguity.
Comment 9 Brent Fulgham 2018-05-11 19:57:09 PDT
Comment on attachment 340230 [details]
Patch and layout tests

View in context: https://bugs.webkit.org/attachment.cgi?id=340230&action=review

>>> Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:421
>>> +        for (auto& origin : m_parameters.frameAncestorOrigins) {
>> 
>> It's weird to have origin defined in two scopes, even though it apparently works. Could you name one the "sourceOrigin" or "topLevelOrigin" or something?
> 
> Oops! I hope you do not mind that I rename the loop variable ancestorOrigin to resolve this ambiguity.

That sounds like a great name!
Comment 10 Daniel Bates 2018-05-11 20:06:39 PDT
Created attachment 340239 [details]
For EWS
Comment 11 EWS Watchlist 2018-05-11 20:07:55 PDT
Attachment 340239 [details] did not pass style-queue:


ERROR: Source/WebKit/ChangeLog:11:  Please consider whether the use of security-sensitive phrasing could help someone exploit WebKit: malicious, malicious, malicious  [changelog/unwantedsecurityterms] [3]
ERROR: Source/WebCore/ChangeLog:11:  Please consider whether the use of security-sensitive phrasing could help someone exploit WebKit: malicious, malicious, malicious  [changelog/unwantedsecurityterms] [3]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Daniel Bates 2018-05-11 21:11:18 PDT
Committed r231730: <https://trac.webkit.org/changeset/231730>