fix(extension): stop leaking Object.getPropertyDescriptor/getPropertyNames on the page-world Object#1191
Draft
vringar wants to merge 1 commit into
Draft
fix(extension): stop leaking Object.getPropertyDescriptor/getPropertyNames on the page-world Object#1191vringar wants to merge 1 commit into
vringar wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1191 +/- ##
=======================================
Coverage 62.14% 62.14%
=======================================
Files 40 40
Lines 3918 3918
=======================================
Hits 2435 2435
Misses 1483 1483 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…Names on the page-world Object [#1187] The legacy JS instrument assigned getPropertyDescriptor and getPropertyNames onto the page-world Object and never removed them. Because the instrument runs in the page's principal, these stay visible to page scripts, so a one-liner like typeof Object.getPropertyDescriptor === "function" detects OpenWPM instrumentation even with empty settings -- a config-independent tell named as a leaked-global detection vector in Krumnow et al. (arXiv:2205.08890). Move both helpers to module-local functions and update their two call sites to call the locals. Pure refactor: implementations are unchanged and no capture behavior changes; only the page-world Object assignment is removed.
8e53924 to
ff12f77
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tell
Closes #1187 (quick win).
The legacy JavaScript instrument (
Extension/src/lib/js-instruments.ts) assigned two non-standard helpers onto the page-worldObjectand never removed them:Because the instrument is injected via a
<script>element and runs in the page's principal, these assignments stay visible to page scripts. A one-linerdetects OpenWPM instrumentation even with empty settings — a config-independent tell, named as a leaked-globals detection vector in Krumnow, Jonker & Karsch (arXiv:2205.08890, §4.1).
The fix (zero capture cost)
Pure refactor: both helpers are now module-local functions inside
getInstrumentJSinstead of being assigned onto the globalObject, and the two call sites (the property-descriptor lookup and the property-name enumeration) call the locals. The implementations are byte-for-byte unchanged; only their location and how they're referenced changed. Thedeclare globalaugmentation ofObjectis removed accordingly.No behavior or capture change.
Verification
grep -rn "Object.getPropertyDescriptor\|Object.getPropertyNames" Extension/srcreturns only the new module-local definitions — noObject.X =assignment and noObject.X(call remain.content.jsbundle contains noObject.getProperty* =assignment while still bundling both helper functions.test/test_js_instrument.py::TestJSInstrument::test_instrument_objectpasses, confirming instrumentation capture is unchanged.Follow-up
A browser-side regression test asserting the page-world
Objectno longer carries these properties would need new test-page/harness wiring; left as a follow-up rather than over-building here.