RESOLVED FIXED Bug 209049
Unique origins should not be Potentially Trustworthy
https://bugs.webkit.org/show_bug.cgi?id=209049
Summary Unique origins should not be Potentially Trustworthy
Attachments
Patch (4.00 KB, patch)
2020-03-13 05:46 PDT, youenn fablet
no flags
Patch (12.24 KB, patch)
2020-03-13 09:25 PDT, youenn fablet
no flags
Patch (12.16 KB, patch)
2020-03-13 09:26 PDT, youenn fablet
no flags
Patch (12.08 KB, patch)
2020-03-13 10:37 PDT, youenn fablet
no flags
Patch for landing (11.99 KB, patch)
2020-03-16 01:29 PDT, youenn fablet
no flags
Patch for landing - fixing test (14.79 KB, patch)
2020-03-16 04:29 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2020-03-13 05:46:44 PDT
youenn fablet
Comment 2 2020-03-13 06:23:34 PDT
youenn fablet
Comment 3 2020-03-13 09:25:45 PDT
youenn fablet
Comment 4 2020-03-13 09:26:59 PDT
youenn fablet
Comment 5 2020-03-13 10:37:20 PDT
Darin Adler
Comment 6 2020-03-15 17:45:20 PDT
Comment on attachment 393501 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393501&action=review > Source/WebCore/dom/Document.cpp:6025 > +static inline bool isURLPotentiallyTrustworthy(const URL& url) Seems overkill to write inline here. > Source/WebCore/dom/Document.cpp:6027 > + if (url.protocol() == "about"_s) Should use URL::protocolIsAbout. If not, then no need to use ASCIILiteral (the _s suffix) with ==; in fact I think it currently makes the == operator less efficient, although we could fix that. In general, to check protocols, I think we should use URL::protocolIs rather than URL::protocol with ==. > Source/WebCore/dom/Document.cpp:6028 > + return url.path() == "blank"_s || url.path() == "srcdoc"_s; For about:blank we already have URL::isBlankURL. I suggest consider adding something similar for "srcdoc" instead of writing out like this. Is it correct for this to be case-sensitive or do we want case folding? If we want case folding we should use equalLettersIgnoringASCIICase. Same comment about using ASCIILiteral (the _s suffix). Also, should change URL::path to return a StringView for efficiency. > Source/WebCore/dom/Document.cpp:6029 > + if (url.protocol() == "data"_s) URL::protocolIsData
youenn fablet
Comment 7 2020-03-16 01:29:21 PDT
Created attachment 393636 [details] Patch for landing
youenn fablet
Comment 8 2020-03-16 04:29:30 PDT
Created attachment 393647 [details] Patch for landing - fixing test
youenn fablet
Comment 9 2020-03-16 05:35:47 PDT
Right, this makes sense. I updated the patch accordingly. (In reply to Darin Adler from comment #6) > Comment on attachment 393501 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393501&action=review > > > Source/WebCore/dom/Document.cpp:6025 > > +static inline bool isURLPotentiallyTrustworthy(const URL& url) > > Seems overkill to write inline here. > > > Source/WebCore/dom/Document.cpp:6027 > > + if (url.protocol() == "about"_s) > > Should use URL::protocolIsAbout. > > If not, then no need to use ASCIILiteral (the _s suffix) with ==; in fact I > think it currently makes the == operator less efficient, although we could > fix that. In general, to check protocols, I think we should use > URL::protocolIs rather than URL::protocol with ==. > > > Source/WebCore/dom/Document.cpp:6028 > > + return url.path() == "blank"_s || url.path() == "srcdoc"_s; > > For about:blank we already have URL::isBlankURL. I suggest consider adding > something similar for "srcdoc" instead of writing out like this. > > Is it correct for this to be case-sensitive or do we want case folding? If > we want case folding we should use equalLettersIgnoringASCIICase. > > Same comment about using ASCIILiteral (the _s suffix). > > Also, should change URL::path to return a StringView for efficiency. > > > Source/WebCore/dom/Document.cpp:6029 > > + if (url.protocol() == "data"_s) > > URL::protocolIsData
WebKit Commit Bot
Comment 10 2020-03-16 06:15:57 PDT
Comment on attachment 393647 [details] Patch for landing - fixing test Clearing flags on attachment: 393647 Committed r258494: <https://trac.webkit.org/changeset/258494>
WebKit Commit Bot
Comment 11 2020-03-16 06:15:59 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 12 2020-03-16 11:25:22 PDT
Comment on attachment 393647 [details] Patch for landing - fixing test View in context: https://bugs.webkit.org/attachment.cgi?id=393647&action=review > Source/WebCore/dom/Document.cpp:6044 > + return equalIgnoringASCIICase(url.string(), WTF::blankURL()) || equalLettersIgnoringASCIICase(url.string(), "about:srcdoc"); Should be using: url.isBlankURL() instead of comparing string with WTF::blankURL. But then I discovered that URL::isBlankURL is declared in URL.h but not defined! Would you be willing to either delete it, or implement and use it?
youenn fablet
Comment 13 2020-03-16 11:30:38 PDT
(In reply to Darin Adler from comment #12) > Comment on attachment 393647 [details] > Patch for landing - fixing test > > View in context: > https://bugs.webkit.org/attachment.cgi?id=393647&action=review > > > Source/WebCore/dom/Document.cpp:6044 > > + return equalIgnoringASCIICase(url.string(), WTF::blankURL()) || equalLettersIgnoringASCIICase(url.string(), "about:srcdoc"); > > Should be using: > > url.isBlankURL() > > instead of comparing string with WTF::blankURL. But then I discovered that > URL::isBlankURL is declared in URL.h but not defined! Would you be willing > to either delete it, or implement and use it? Right I saw that. Will fix it tomorrow.
Darin Adler
Comment 14 2020-03-16 12:03:19 PDT
Comment on attachment 393647 [details] Patch for landing - fixing test View in context: https://bugs.webkit.org/attachment.cgi?id=393647&action=review >>> Source/WebCore/dom/Document.cpp:6044 >>> + return equalIgnoringASCIICase(url.string(), WTF::blankURL()) || equalLettersIgnoringASCIICase(url.string(), "about:srcdoc"); >> >> Should be using: >> >> url.isBlankURL() >> >> instead of comparing string with WTF::blankURL. But then I discovered that URL::isBlankURL is declared in URL.h but not defined! Would you be willing to either delete it, or implement and use it? > > Right I saw that. > Will fix it tomorrow. Might be better to delete it. Some places want to treat any "about:" URL the same, others specifically want to check for "about:blank". Not clear which of those isBlankURL means in a way. So maybe we should just delete it.
youenn fablet
Comment 15 2020-03-17 02:59:59 PDT
Filed bug 209173 and bug 209174. I think it makes sense to introduce isAboutBlank/isSrcDoc, since, at least in theory, I think we should check the scheme case insensitive and path case sensitive.
Note You need to log in before you can comment on or make changes to this bug.