fix(extension): stop leaking Object.getPropertyDescriptor/getPropertyNames on the page-world Object - #1191
Open
vringar wants to merge 2 commits into
Open
fix(extension): stop leaking Object.getPropertyDescriptor/getPropertyNames on the page-world Object#1191vringar wants to merge 2 commits into
vringar wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1191 +/- ##
=======================================
Coverage 62.31% 62.31%
=======================================
Files 40 40
Lines 3930 3930
=======================================
Hits 2449 2449
Misses 1481 1481 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
June 17, 2026 23:42
8e53924 to
ff12f77
Compare
vringar
marked this pull request as ready for review
June 29, 2026 20:44
There was a problem hiding this comment.
Pull request overview
This PR hardens OpenWPM’s legacy page-world JavaScript instrumentation by removing two non-standard helper functions that were previously assigned onto the page’s global Object, which created a configuration-independent detectability “tell”.
Changes:
- Removes the
declare globalaugmentation that addedObject.getPropertyDescriptor/Object.getPropertyNames. - Replaces the page-world
Object.*assignments with function-scoped helpers insidegetInstrumentJS. - Updates the two call sites to use the local helper functions instead of
Object.*.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
June 29, 2026 21:04
c7e72af to
94d5280
Compare
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
July 20, 2026 22:54
284667f to
637b08f
Compare
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
August 25, 2026 09:18
637b08f to
d606f02
Compare
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
September 6, 2026 14:55
d606f02 to
caaa74e
Compare
…the page-world Object [#1187] Add a browser regression test for the page-world Object leak fixed in this branch. The instrument is injected as a page-world <script>, so the getPropertyDescriptor / getPropertyNames helpers it formerly assigned onto Object stayed visible to page scripts -- a config-independent fingerprinting tell. The test page reads whether either helper is an own property of the page-world Object and encodes the result into an instrumented fetch call's argument; the test asserts the clean state (gpd-false / gpn-false). A leaking instrument would log gpd-true / gpn-true and fail the assertion.
…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.
vringar
force-pushed
the
harden/legacy-object-globals
branch
from
September 6, 2026 20:24
caaa74e to
44a8d12
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.