Skip to content

Fix sponsored posts leaking through filter (WebLite icon-font glyphs) - #27

Merged
mretallack merged 1 commit into
mainfrom
fix/sponsored-label-glyphs
Nov 15, 2026
Merged

mretallack merged 1 commit into
mainfrom
fix/sponsored-label-glyphs

Conversation

@mretallack

Copy link
Copy Markdown
Owner

What

Fixes sponsored posts leaking through the content filter. Every label read simply as Ad was caught, but posts labelled Sponsored were not hidden.

Why it happened

Facebook's WebLite (mobile) client renders Sponsored as inline text plus private-use-area (PUA) icon-font glyphs concatenated onto the same text node. The textContent is therefore not "Sponsored" but something like:

"Sponsored" + U+F078B + U+F17E1

filter.js did an exact match (trimmed === 'Sponsored') and an indexOf('Ad') check, both of which failed on the glyph-contaminated string — so sponsored cards passed through while plain "Ad" labels were hidden.

The fix

Strip PUA / icon-font glyphs before label matching:

// WebLite appends private-use icon-font glyphs to labels, e.g. the
// "Sponsored" label's textContent is actually "Sponsored" + U+F078B/U+F17E1.
// Strip those so exact-match comparisons below still work.
var trimmed = text.replace(/[\uE000-\uF8FF]|[\u{F0000}-\u{FFFFD}]|[\u{100000}-\u{10FFFD}]/gu, '').trim();

Applied to both copies (filter.js and app/src/main/assets/filter.js), which are kept identical.

Verification

  • On-device (via CDP): a synthetic Sponsored+glyph node now receives data-filtered="ad" and display:none.
  • Live feed: sponsored cards previously shown are now hidden.

Fixes the sponsored-ad leak.

WebLite appends private-use icon-font glyphs to text labels, e.g. the
Sponsored label's textContent is "Sponsored" + U+F078B/U+F17E1. The ad
check compared trimmed === 'Sponsored' (and indexOf('Ad')), so sponsored
posts were never matched and leaked through, while plain 'Ad' labels were
caught. Normalise by stripping PUA glyphs before comparing.
@mretallack
mretallack merged commit ffda6bc into main Nov 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant