Bug 104383 - Web Inspector: Evaluate private browsing mode's effect on console messages.
Summary: Web Inspector: Evaluate private browsing mode's effect on console messages.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Mike West
URL:
Keywords:
Depends on: 104454
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-07 11:34 PST by Mike West
Modified: 2012-12-11 01:19 PST (History)
17 users (show)

See Also:


Attachments
Patch (6.45 KB, patch)
2012-12-08 13:00 PST, Mike West
no flags Details | Formatted Diff | Diff
Patch (10.04 KB, patch)
2012-12-10 06:42 PST, Mike West
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike West 2012-12-07 11:34:09 PST
Some console messages are gated on not being in private browsing mode  (e.g. CachedResourceLoader::printAccessDeniedMessage).

1. Is this still relevant? Do console messages end up in system logs somewhere?
2. If it's relevant, how can we avoid making every call site do the check? Centralizing it somewhere (in Console?) might make sense.
3. What about the strange printf'ing we do in Console::addMessage? Is that necessary? If so, it should almost certainly be gated on private browsing.
4. More questions?
Comment 1 Mike West 2012-12-07 11:46:07 PST
Adam added this check in particular was added 4 years ago in http://trac.webkit.org/changeset/34720. :)

No bug number, however. I'll dig around for other occurrences.
Comment 2 Mike West 2012-12-07 11:56:52 PST
DOMWindow::printErrorMessage used to be in the JSC bindings as printErrorMessageForFrame, added in http://trac.webkit.org/changeset/49963  No commentary for that bit, however.

Monday morning, I'll dig a bit more into which messages these two methods are gating on privacy grounds.
Comment 3 Mike West 2012-12-07 13:14:18 PST
+jochen, who has opinions.
Comment 4 jochen 2012-12-07 13:33:24 PST
(In reply to comment #3)
> +jochen, who has opinions.

According to http://trac.webkit.org/browser/trunk/Source/WebCore/page/Settings.h#L161 we don't record any console message in private browsing mode.

I agree that this should probably be enforced in the Console
Comment 5 Alexey Proskuryakov 2012-12-07 14:51:43 PST
> 3. What about the strange printf'ing we do in Console::addMessage? Is that necessary?

It implements WebKit1 Mac SPI, +[WebCoreStatistics setShouldPrintExceptions:].
Comment 6 Timothy Hatcher 2012-12-07 14:57:34 PST
(In reply to comment #5)
> > 3. What about the strange printf'ing we do in Console::addMessage? Is that necessary?
> 
> It implements WebKit1 Mac SPI, +[WebCoreStatistics setShouldPrintExceptions:].

And it is something I plan to add to WK2. I have a local patch I use to make it work in WK2. It makes debugging the Web Inspector easier.
Comment 7 Mike West 2012-12-07 23:50:11 PST
(In reply to comment #4)
> (In reply to comment #3)
> > +jochen, who has opinions.
> 
> According to http://trac.webkit.org/browser/trunk/Source/WebCore/page/Settings.h#L161 we don't record any console message in private browsing mode.

Hrm. Ok.

I don't understand the privacy violation of console messages. Are they potentially logged to some persistant storage? As long as they're transient, what is the risk we're protecting users against?
Comment 8 Timothy Hatcher 2012-12-08 00:16:44 PST
(In reply to comment #7)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > +jochen, who has opinions.
> > 
> > According to http://trac.webkit.org/browser/trunk/Source/WebCore/page/Settings.h#L161 we don't record any console message in private browsing mode.
> 
> Hrm. Ok.
> 
> I don't understand the privacy violation of console messages. Are they potentially logged to some persistant storage? As long as they're transient, what is the risk we're protecting users against?

They can go to the system log (seen via Console.app) if you just launch the app via double click (like a user). If you launch via the Terminal or Xcode it dumps to the TTY and not the system log.
Comment 9 Mike West 2012-12-08 00:52:06 PST
(In reply to comment #8)

> They can go to the system log (seen via Console.app) if you just launch the app via double click (like a user). If you launch via the Terminal or Xcode it dumps to the TTY and not the system log.

Thanks for the detail! Are you talking about the printf'd messages, or the messages sent to the console?

I see three things happening in Console::addMessage:

1. The message is sent to a ChromeClient.
2. The message is sent to InspectorInstrumentation.
3. The message is (potentially) printf'd.

Do all three potentially leak information to the system log? If possible, I'd like to retain #2, as I haven't seen any code in Inspector that would write information outside the context of the browsing session, but I agree that the other two should probably be gated on private browsing mode.

I'll put up a patch for discussion on Monday.
Comment 10 jochen 2012-12-08 00:58:38 PST
Can't you turn private browsing mode on and off during runtime? In that case you might want to clear the console messages stored in the inspector when private browsing is disabled again.
Comment 11 Mike West 2012-12-08 01:11:10 PST
(In reply to comment #10)
> Can't you turn private browsing mode on and off during runtime? In that case you might want to clear the console messages stored in the inspector when private browsing is disabled again.

That makes sense. We should also clear any stored exceptions that haven't made it to the console yet (ScriptExecutionContext::PendingException).
Comment 12 Timothy Hatcher 2012-12-08 07:40:33 PST
(In reply to comment #9)
> (In reply to comment #8)
> 
> > They can go to the system log (seen via Console.app) if you just launch the app via double click (like a user). If you launch via the Terminal or Xcode it dumps to the TTY and not the system log.
> 
> Thanks for the detail! Are you talking about the printf'd messages, or the messages sent to the console?
> 
> I see three things happening in Console::addMessage:
> 
> 1. The message is sent to a ChromeClient.
> 2. The message is sent to InspectorInstrumentation.
> 3. The message is (potentially) printf'd.
> 
> Do all three potentially leak information to the system log? If possible, I'd like to retain #2, as I haven't seen any code in Inspector that would write information outside the context of the browsing session, but I agree that the other two should probably be gated on private browsing mode.
> 
> I'll put up a patch for discussion on Monday.

I was just talking about printf.
Comment 13 Mike West 2012-12-08 13:00:30 PST
Created attachment 178373 [details]
Patch
Comment 14 Mike West 2012-12-08 13:04:11 PST
(In reply to comment #13)
> Created an attachment (id=178373) [details]
> Patch

Here's a strawman that blocks ChromeClient and printf notifications, but allows InspectorInstrumentation. If there's agreement that this is what we want, I'll put some tests together.

Filed bug 104454 to cover clearing console state when exiting private browsing, as it's a bit tangential to what we're focusing on here.
Comment 15 Mike West 2012-12-10 06:42:38 PST
Created attachment 178537 [details]
Patch
Comment 16 Mike West 2012-12-10 06:44:03 PST
I had a quick chat with Pavel, he's happy with the change.

Carrying over Pavel's r+ and throwing the updated patch to the bots. I'll wait to land this to give PST-zone folks a chance to weigh in.

Thanks!
Comment 17 WebKit Review Bot 2012-12-10 08:00:48 PST
Comment on attachment 178537 [details]
Patch

Attachment 178537 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15239483

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 18 Mike West 2012-12-11 00:40:31 PST
Comment on attachment 178537 [details]
Patch

I pinged ap on IRC last night; no concerns given the folks already CCd on the bug.

(In reply to comment #17)
> (From update of attachment 178537 [details])
> Attachment 178537 [details] did not pass chromium-ews (chromium-xvfb):
> Output: http://queues.webkit.org/results/15239483
> 
> New failing tests:
> inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html

This runs locally without crashing. Calling it flake; let's see what the CQ says. :)
Comment 19 WebKit Review Bot 2012-12-11 01:18:59 PST
Comment on attachment 178537 [details]
Patch

Clearing flags on attachment: 178537

Committed r137267: <http://trac.webkit.org/changeset/137267>
Comment 20 WebKit Review Bot 2012-12-11 01:19:05 PST
All reviewed patches have been landed.  Closing bug.