RESOLVED WORKSFORME 35745
Add hook for always disabling the HTTP Referrer.
https://bugs.webkit.org/show_bug.cgi?id=35745
Summary Add hook for always disabling the HTTP Referrer.
jochen
Reported 2010-03-04 07:21:39 PST
Add hook for always disabling the HTTP Referrer.
Attachments
Patch (3.51 KB, patch)
2010-03-04 07:22 PST, jochen
jorlow: review-
jochen
Comment 1 2010-03-04 07:22:47 PST
jochen
Comment 2 2010-03-04 07:24:15 PST
This hook allows Chromium to disable referrers in webkit. It's not enough to do this on the network layer, since referrer information is accessible from javascript using document.referer
Jeremy Orlow
Comment 3 2010-03-04 07:28:59 PST
+ Darin for opinion.
Jeremy Orlow
Comment 4 2010-03-04 07:29:05 PST
Comment on attachment 50017 [details] Patch I'm not sure what te best way to do this is, but this is definitely not it. My guess is that the chromeClient should be used to query this type of information...and it should probably be done somewhere else (or injected into SecurityOrigin on creation).
jochen
Comment 5 2010-03-04 07:31:07 PST
(In reply to comment #4) > (From update of attachment 50017 [details]) > I'm not sure what te best way to do this is, but this is definitely not it. My > guess is that the chromeClient should be used to query this type of > information...and it should probably be done somewhere else (or injected into > SecurityOrigin on creation). The problem is that this method of SecurityOrigin is static.
Jeremy Orlow
Comment 6 2010-03-04 08:06:29 PST
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 50017 [details] [details]) > > I'm not sure what te best way to do this is, but this is definitely not it. My > > guess is that the chromeClient should be used to query this type of > > information...and it should probably be done somewhere else (or injected into > > SecurityOrigin on creation). > > The problem is that this method of SecurityOrigin is static. What about the callers of it?
jochen
Comment 7 2010-03-04 08:15:10 PST
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > (From update of attachment 50017 [details] [details] [details]) > > > I'm not sure what te best way to do this is, but this is definitely not it. My > > > guess is that the chromeClient should be used to query this type of > > > information...and it should probably be done somewhere else (or injected into > > > SecurityOrigin on creation). > > > > The problem is that this method of SecurityOrigin is static. > > What about the callers of it? The function is invoked several times in FrameLoader, and once in SubresourceLoader, and two Mac plugins plus WebSecurityPolicy and WebFrameImpl in chromium. I'm no expert on this, but SecurityOrigin seemed to be the central place to control this
Jeremy Orlow
Comment 8 2010-03-04 08:17:37 PST
Lets see what Darin thinks then. He usually knows of creative ways to add Chromium bits in clean ways.
Darin Fisher (:fishd, Google)
Comment 9 2010-03-04 11:07:12 PST
Yeah, hacking out a method from SecurityOrigin.cpp using #if !PLATFORM(CHROMIUM), and then implementing it in ChromiumBridge.cpp is not going to make this very maintainable. Do you really need the ability to restrict referrers on a host-by-host basis? If the goal is to just always disable HTTP referrers, then we can probably just add a method on SecurityOrigin to denote that setting. I'd like abarth's input.
Sam Weinig
Comment 10 2010-03-04 12:33:19 PST
Please note it is also a layering violation for WebCore classes to know about WebKit level concepts.
jochen
Comment 11 2010-03-04 13:44:25 PST
(In reply to comment #9) > Yeah, hacking out a method from SecurityOrigin.cpp using #if > !PLATFORM(CHROMIUM), and then implementing it in ChromiumBridge.cpp is not > going to make this very maintainable. Do you really need the ability to > restrict referrers on a host-by-host basis? > > If the goal is to just always disable HTTP referrers, then we can probably just > add a method on SecurityOrigin to denote that setting. I'd like abarth's > input. The goal is to disable referrers in all cases. This option has to be a static member variable thou, because the method is also static. Any hints on how to expose access to this variable?
Adam Barth
Comment 12 2010-03-04 19:33:49 PST
I don't understand the motivation for this change. Can you explain the use case? I'm not sure why we'd want to control referrers on a global level. It would seem to make much more sense to control this on a load-by-load basis, which we can achieve with a FrameLoaderClient method.
Adam Barth
Comment 13 2010-03-04 19:42:03 PST
Come to think of it, isn't willSendRequest sufficient for this purpose? If it's not, we should make it work.
Darin Fisher (:fishd, Google)
Comment 14 2010-03-04 20:16:56 PST
abarth: good catch, willSendRequest should definitely be sufficient for stripping referrers. the Referer header is set before willSendRequest is called! I think this bug is WORKSFORME.
Darin Fisher (:fishd, Google)
Comment 15 2010-03-04 20:17:49 PST
jochen: be sure to test that both the HTTP level Referer header and document.referrer are cleared.
jochen
Comment 16 2010-03-05 00:59:05 PST
(In reply to comment #15) > jochen: be sure to test that both the HTTP level Referer header and > document.referrer are cleared. works, thanks for the help!
Note You need to log in before you can comment on or make changes to this bug.