REOPENED 250779
Web Inspector: ITPDebug does not write to terminal / console
https://bugs.webkit.org/show_bug.cgi?id=250779
Summary Web Inspector: ITPDebug does not write to terminal / console
Cory Underwood
Reported 2023-01-18 12:09:30 PST
Seen in Safari 16.2 (17614.3.7.1.7, 17614) Description: After enabling Debug mode, it does not appear that the debug mode is being engaged (grepping logs has no returns). Thus I am unable to determine what, if any, modification to storage behavior may apply to a website I am developing or testing. Steps to Reproduce: After enabling 'Enable Intelligent Tracking Prevention Debug Mode' under the 'Develop' menu both of the following methods were attempted: 1: Executing 'log stream -info | grep ITPDebug' from Terminal does not find any messages upon page loading / refreshing with the debug flag enabled, even for sites I know should alert to cookie expire truncation due to CNAME record usage or coming from a known tracker source. 2: Using Console and searching for 'ITPDebug' with info messages enabled does not find any messages upon page loading / refreshing with the debug flag enabled, even for sites I know should alert to cookie expire truncation due to CNAME record usage or coming from a known tracker source. Both methods used to work previously for determining which cookies may have shortened duration due to CNAME Cloaking abuse. Additional Context: I *do* get Web Inspector console debugging information - such as 'Applying cross-site tracking restrictions:' and 'About to remove data records for:'. I am aware of the changes from Third-Party CNAME Mitigation to Third Party Mitigation, but can't see a method that identifies when that would be applied with the 'ITPDebug' flag enabled, or via any representation within the JavaScript Console or Web Inspector more generally. I was also unable to find any relevant documentation update which would explain this shift in behavior, or what to use instead on webkit.org.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-01-25 12:10:17 PST
Charlie Wolfe
Comment 2 2023-10-05 16:24:02 PDT
Can you see if this still reproduces for you on the latest Safari? I am able to see ITP debug messages using log stream. Including the messages regarding third-party IP cookie capping. [com.apple.WebKit:ITPDebug] Capped the expiry of third-party IP address cookie named X.
Cory Underwood
Comment 3 2023-10-05 19:04:47 PDT
I am running Safari 17.0 (19616.1.27.111.16) I enabled 'Enable Intelligent Tracking Prevention debug mode' under Developer > Developer. I navigate to key.com (Key Bank - used for example purposes). Key bank uses Adobe Analytics, and it makes a Network call to metrics.key.com On the response to that request, it sets a s_ecid cookie for two years in Chrome. Safari sets this same cookie for 7 days (expected). However, Despite the fact the flag has been enabled: Executing 'log stream -info | grep ITPDebug' from Terminal prior to navigation does not find any messages upon page loading / refreshing with the debug flag enabled, even for sites I know should alert to cookie expire truncation due to CNAME record usage or coming from a known tracker source. Using Console and searching for 'ITPDebug' with info messages enabled prior to navigation does not find any messages upon page loading / refreshing with the debug flag enabled, even for sites I know should alert to cookie expire truncation due to CNAME record usage or coming from a known tracker source. In the Safari JS console the following happens I get info messages that state: [ITP] Applying cross-site tracking restrictions to: [array of domains]. [ITP] Done applying cross-site tracking restrictions The functionality of the code appears to be working. If I switch to private mode, all the various trackers are blocked as expected and the debug information writes to the console stating the tracker was blocked. It's just the log stream in normal mode appears to have an issue. This used to work for me, and I am not sure why I can't see the more detailed logs in the logstream in either method (console or terminal). Has the syntax on what I should be grepping for changed? Am I missing a step in this process?
Charlie Wolfe
Comment 4 2023-10-05 20:27:04 PDT
I don't see anything obvious that would explain why this logging isn't showing up for you. Do you ever see any ITP debug logging with that log stream command? You should see "Turned ITP Debug Mode on." / "Turned ITP Debug Mode off." when enabling/disabling ITP debug mode. Do you see any WebKit logging at all? You can check using "log stream --process com.apple.WebKit". Is "Prevent cross-site tracking" enabled in your Safari privacy settings?
Cory Underwood
Comment 5 2023-10-05 20:56:42 PDT
If it's relevant I have been conducting this testing on a M1 Macbook Air running macOS Sonoma 14. Testing has primarily been in Terminal running a zsh shell. The user account has Admin privileges. "Do you ever see any ITP debug logging with that log stream command? You should see "Turned ITP Debug Mode on." / "Turned ITP Debug Mode off." when enabling/disabling ITP debug mode." When enabling or disabling ITP Debug mode, I do see those messages, but only in Safari's Console. I do not see them in the Terminal Window or the Console Application Logs. "Do you see any WebKit logging at all? You can check using "log stream --process com.apple.WebKit"." When typing that command, I do see log information from Safari in Terminal. Information such as if the window is in focus, CPU usage, the memory footprint and other log information. "Is "Prevent cross-site tracking" enabled in your Safari privacy settings?" This feature is enabled. Just to check - I ran these same tests on a older iMac I have running macOS Monterey version 12.6.8 and Safari Version 16.6 (17615.3.12.11.3, 17615) with the same results. General WebKit logs do work correctly, ITPDebug log messages do not seem to be being sent to the to the log file. If this is something with my specific environment I am unable to isolate it. As far as I can tell the functionality works as expected (reduced cookie lifespan) but the logging seems to not be working. Toggling the ITPDebug feature on / off in the developer menu does cause the Activation and Deactivation messages be written to the Safari Console, but regardless of activation nothing appears in the system logs as far as I can see.
Note You need to log in before you can comment on or make changes to this bug.