WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
213889
Custom URL schemes should be treated as app-bound
https://bugs.webkit.org/show_bug.cgi?id=213889
Summary
Custom URL schemes should be treated as app-bound
Kate Cheney
Reported
2020-07-02 10:35:48 PDT
We should treat loads using custom URL schemes as app-bound
Attachments
Patch
(16.68 KB, patch)
2020-07-02 10:58 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(16.77 KB, patch)
2020-07-02 14:22 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch for landing
(17.01 KB, patch)
2020-07-02 15:49 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Kate Cheney
Comment 1
2020-07-02 10:36:05 PDT
<
rdar://problem/64804671
>
Kate Cheney
Comment 2
2020-07-02 10:58:20 PDT
Created
attachment 403378
[details]
Patch
John Wilander
Comment 3
2020-07-02 11:37:03 PDT
If possible, it would be nice to test that this'll work with the ITP relaxation for app-bound domains too.
Kate Cheney
Comment 4
2020-07-02 13:31:00 PDT
Comment on
attachment 403378
[details]
Patch Cancelling review while investigating failing API tests.
Kate Cheney
Comment 5
2020-07-02 14:22:06 PDT
Created
attachment 403395
[details]
Patch
Kate Cheney
Comment 6
2020-07-02 14:23:07 PDT
(In reply to John Wilander from
comment #3
)
> If possible, it would be nice to test that this'll work with the ITP > relaxation for app-bound domains too.
Do you have a specific example in mind where you think it might not work with ITP relaxation?
Brent Fulgham
Comment 7
2020-07-02 15:17:36 PDT
Comment on
attachment 403395
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=403395&action=review
> Source/WebKit/ChangeLog:14 > + count of 10 app-bound domains.
I assume they can be interleaved with the domains, right? No restriction on ordering?
> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:442 > + if (length > 0 && [data characterAtIndex:length - 1] == ':') {
You might be able to just do: if ([data endsWithString: @":"]) { auto appBoundScheme = String([data subStringToIndex:[data length] - 1]); if (!appBoundScheme.isEmpty()) appBoundSchemes().add(appBoundScheme); }
> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:445 > + appBoundSchemes().add(appBoundScheme);
Do we want to continue and possibly add this to the set of appBoundDomains, too? Or should we 'continue' here?
> Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:502 > + auto isAppBound = schemeIsAppBound || domains.contains(WebCore::RegistrableDomain(requestURL));
This might be a little more legible as a static function: static NavigatingToAppBoundDomain schemeOrDomainIsAppBound(const URL& requestURL, const <<mumble>>& domains, const <<mumble>>& schemes) { auto protocol = requestURL.protocol().toString(); auto schemeIsAppBound = !protocol.isNull() && schemes.contains(protocol); auto domainIsAppBound = domains.contains(WebCore::RegistrableDomain(requestURL)); return schemeIsAppBound || domainIsAppBound ? NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No; }
> Tools/TestWebKitAPI/Info.plist:8 > + <string>:</string>
Ha! Good test!
> Tools/TestWebKitAPI/Info.plist:28 > + <string>should-not-be-included:</string>
Should we have an empty <string></string> test?
Brent Fulgham
Comment 8
2020-07-02 15:18:10 PDT
Comment on
attachment 403395
[details]
Patch I think this patch is good, but I have a couple of suggestions I hope you'll consider.
Kate Cheney
Comment 9
2020-07-02 15:27:14 PDT
(In reply to Brent Fulgham from
comment #7
)
> Comment on
attachment 403395
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=403395&action=review
> > > Source/WebKit/ChangeLog:14 > > + count of 10 app-bound domains. > > I assume they can be interleaved with the domains, right? No restriction on > ordering? >
Yes. No restrictions, its first-come, first-serve until all 10 spots are filled.
> > Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:442 > > + if (length > 0 && [data characterAtIndex:length - 1] == ':') { > > You might be able to just do: > > if ([data endsWithString: @":"]) { > auto appBoundScheme = String([data subStringToIndex:[data length] - 1]); > if (!appBoundScheme.isEmpty()) > appBoundSchemes().add(appBoundScheme); > }
Good idea, using the endsWithString makes it more readable, I'll change this.
> > > Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:445 > > + appBoundSchemes().add(appBoundScheme); > > Do we want to continue and possibly add this to the set of appBoundDomains, > too? Or should we 'continue' here? >
Very good catch, we do not want to add this to the set of domains if a custom scheme also happens to be a domain.
> > Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:502 > > + auto isAppBound = schemeIsAppBound || domains.contains(WebCore::RegistrableDomain(requestURL)); > > This might be a little more legible as a static function: > > static NavigatingToAppBoundDomain schemeOrDomainIsAppBound(const URL& > requestURL, const <<mumble>>& domains, const <<mumble>>& schemes) { > auto protocol = requestURL.protocol().toString(); > auto schemeIsAppBound = !protocol.isNull() && schemes.contains(protocol); > auto domainIsAppBound = > domains.contains(WebCore::RegistrableDomain(requestURL)); > return schemeIsAppBound || domainIsAppBound ? > NavigatingToAppBoundDomain::Yes : NavigatingToAppBoundDomain::No; > } >
Agreed, will change.
> > Tools/TestWebKitAPI/Info.plist:8 > > + <string>:</string> > > Ha! Good test! >
:-)
> > Tools/TestWebKitAPI/Info.plist:28 > > + <string>should-not-be-included:</string> > > Should we have an empty <string></string> test?
This case is covered already in the Info.plist! (It is not shown in the diff).
Kate Cheney
Comment 10
2020-07-02 15:49:40 PDT
Created
attachment 403412
[details]
Patch for landing
John Wilander
Comment 11
2020-07-02 16:03:59 PDT
(In reply to katherine_cheney from
comment #6
)
> (In reply to John Wilander from
comment #3
) > > If possible, it would be nice to test that this'll work with the ITP > > relaxation for app-bound domains too. > > Do you have a specific example in mind where you think it might not work > with ITP relaxation?
I'm thinking a test that checks that a third-party with a custom scheme gets access to its cookies if it and the first party are both in the app-bound set.
John Wilander
Comment 12
2020-07-02 16:04:43 PDT
(In reply to John Wilander from
comment #11
)
> (In reply to katherine_cheney from
comment #6
) > > (In reply to John Wilander from
comment #3
) > > > If possible, it would be nice to test that this'll work with the ITP > > > relaxation for app-bound domains too. > > > > Do you have a specific example in mind where you think it might not work > > with ITP relaxation? > > I'm thinking a test that checks that a third-party with a custom scheme gets > access to its cookies if it and the first party are both in the app-bound > set.
ITP only looks at RegistrableDomain but there might be something in how we extract RegistrableDomains from URLs that makes this not work.
Kate Cheney
Comment 13
2020-07-02 16:14:01 PDT
(In reply to John Wilander from
comment #12
)
> (In reply to John Wilander from
comment #11
) > > (In reply to katherine_cheney from
comment #6
) > > > (In reply to John Wilander from
comment #3
) > > > > If possible, it would be nice to test that this'll work with the ITP > > > > relaxation for app-bound domains too. > > > > > > Do you have a specific example in mind where you think it might not work > > > with ITP relaxation? > > > > I'm thinking a test that checks that a third-party with a custom scheme gets > > access to its cookies if it and the first party are both in the app-bound > > set. > > ITP only looks at RegistrableDomain but there might be something in how we > extract RegistrableDomains from URLs that makes this not work.
I see, good point. This should still work fine because the app-bound domains HashSet does not change at all. But, it might still worth be writing a test case for in a followup patch.
EWS
Comment 14
2020-07-02 16:15:52 PDT
Committed
r263874
: <
https://trac.webkit.org/changeset/263874
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 403412
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug