Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions demo-site/src/components/AdvertorialCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) 2026 PixieBrix, Inc.
// Licensed under PolyForm Shield 1.0.0 — see LICENSE.

// Native advertorial fixture for demoing the `disguised-ad-flag` rule.
// Renders an article-shaped card (heading + image + body prose + read-more
// link) with a visible disclosure label, deliberately *without* the
// network-level markers (`adsbygoogle`, `data-ad-slot`) that `ads-hide`
// would catch. The whole point of the rule is to handle these
// publisher-rendered advertorials that EasyList can't see.

interface AdvertorialCardProps {
// Label text rendered above the headline. Provide the exact phrasing
// (case included) so the demo exercises each detection branch:
// - "Sponsored" standalone form
// - "[Ad]" bracket form
// - "Paid for and presented by <brand>" suffix form
label: string;
headline: string;
body: string;
brand: string;
}

export default function AdvertorialCard({
label,
headline,
body,
brand,
}: AdvertorialCardProps) {
return (
<article className="advertorial-card flex flex-col rounded border border-stone-200 bg-white p-4">
<span className="mb-1 inline-block w-fit text-[10px] font-semibold uppercase tracking-wider text-stone-500">
{label}
</span>
<h3 className="text-base font-semibold text-slate-900">{headline}</h3>
<img
src="https://placehold.co/600x320/eef2f7/64748b?text=Article+Hero"
alt=""
loading="lazy"
className="mt-2 aspect-[16/9] w-full rounded object-cover"
/>
<p className="mt-2 text-sm text-stone-700">{body}</p>
<a
href={`https://example.com/partner/${encodeURIComponent(brand)}`}
className="mt-2 text-sm font-medium text-orange-700 hover:text-orange-800"
>
Read more from {brand}
</a>
</article>
);
}
48 changes: 48 additions & 0 deletions demo-site/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under PolyForm Shield 1.0.0 — see LICENSE.

import AdSlot from "../components/AdSlot";
import AdvertorialCard from "../components/AdvertorialCard";
import CountdownBadge from "../components/CountdownBadge";
import ProductCard from "../components/ProductCard";
import { products } from "../data/products";
Expand Down Expand Up @@ -76,6 +77,53 @@ export default function Home() {
))}
</div>
</section>

<section aria-label="From our partners">
<h2 className="mb-3 text-xl font-semibold text-slate-900">
From Our Partners
</h2>
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
<AdvertorialCard
label="Sponsored"
headline="Why this commuter e-bike is the upgrade your morning needs"
body="Northwind's new urban e-bike combines a torque-sensing motor with a removable battery so you can charge it at your desk. Riders in city pilots report cutting their commute by 22 minutes on average."
brand="Northwind Cycles"
/>
<AdvertorialCard
label="[Ad]"
headline="The five-minute breakfast that's quietly taking over Brooklyn"
body="Made with overnight oats, fresh stone fruit, and a single-origin cold brew, Vellichor's grab-and-go cups have a cult following in coffee shops from Greenpoint to Park Slope."
brand="Vellichor Foods"
/>
<AdvertorialCard
label="Paid for and presented by Aperture Home"
headline="Renovating a kitchen on a weekend timeline: it's possible"
body="Aperture's modular cabinet system installs without a contractor, ships flat-packed, and includes a guided AR planner so you can confirm fit before the truck arrives."
brand="Aperture Home"
/>
</div>
</section>

<article
aria-label="Editorial article — should remain visible"
className="editorial-card rounded border border-stone-200 bg-white p-4"
>
<h2 className="text-base font-semibold text-slate-900">
Local roads team takes silver in regional championship
</h2>
<p className="mt-2 text-sm text-stone-700">
The Riverside cycling club placed second overall this weekend. The
team is sponsored by Adidas this season under a three-year
partnership, but the win was earned on the strength of a late-stage
breakaway by junior rider Mia Chen.
</p>
<a
href="https://example.com/news/riverside-silver"
className="mt-2 inline-block text-sm font-medium text-orange-700 hover:text-orange-800"
>
Read the full recap
</a>
</article>
</div>
);
}
30 changes: 29 additions & 1 deletion docs/src/content/docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Rules reference
description: The defense rules shipped with agent-browser-shield, what each one does, and its default state.
---

The extension ships 32 rules, each independently toggleable from the extension
The extension ships 33 rules, each independently toggleable from the extension
popup. Rules marked **default: on** are active on fresh install; **default:
off** rules must be enabled manually.

Expand Down Expand Up @@ -684,6 +684,34 @@ that powers [uBlock Origin](https://github.com/gorhill/uBlock), Adblock Plus,
and most other consumer ad blockers — over a decade of community-maintained ad
and tracker selector patterns.

### Hide Disguised Ads (Native Advertorials)

- **ID:** `disguised-ad-flag`
- **Default:** on

Hide article-shaped blocks that carry a visible disclosure label — "Sponsored",
"Promoted", "Advertorial", "Paid Post", "Partner Content", or the bracketed
variants common in social feeds — but are rendered by the publisher's own CMS
rather than served from an ad network. Native advertorials bypass the
infrastructure-level selectors that power `ads-hide` because they share class
names and DOM shape with editorial articles; the only signal that distinguishes
them is the disclosure label itself, which the
[FTC's `.com Disclosures`](https://www.ftc.gov/business-guidance/resources/com-disclosures-how-make-effective-disclosures-digital-advertising)
require publishers to render prominently.

Detection works on the visible label — not network selectors — and only fires
when the label sits inside an article-shaped container (heading, image or
outbound link, body prose). Filter chips, navigation links, and editorial
paragraphs that mention sponsorship in passing are excluded by that shape check,
by an interactive-ancestor guard, and by a whole-string regex on the label
element. Matching cards are replaced with a click-to-reveal placeholder in the
same style as `ads-hide` and `irrelevant-sections-redact`.

The label-only approach is the boilerplate-detection counterpart to Kohlschütter
et al. [[13]](#ref-kohlschutter-boilerplate) and
[Readability.js](https://github.com/mozilla/readability), narrowed to the
disclosure signal that paid content must carry by law.

### Remove Unused SVG Sprites

- **ID:** `svg-sprite-strip`
Expand Down
3 changes: 2 additions & 1 deletion extension/data/rule-defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"irrelevant-sections-redact": false,
"cross-origin-frame-redact": false,
"schema-trust-sanitize": false,
"trust-badge-annotate": false
"trust-badge-annotate": false,
"disguised-ad-flag": true
}
}
7 changes: 7 additions & 0 deletions extension/src/lib/dom-markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export const LINK_SPOOF_ANNOTATED_ATTR = "data-abs-link-spoof-annotated";
// re-scan.
export const TRUST_BADGE_ANNOTATED_ATTR = "data-abs-trust-badge-annotated";

// `disguised-ad-flag`: marks a label element that the rule has already
// considered and rejected (no article-shaped ancestor, in a filter chip,
// inside an existing ad-hide region, etc.), so subtree-watcher re-scans
// don't re-evaluate the same negative case on every mutation burst.
export const DISGUISED_AD_FLAG_CONSIDERED_ATTR =
"data-abs-disguised-ad-considered";

// `confirmshame-sanitize`: stores the original copy of attributes the
// rule rewrites so reveal-on-click can restore the user-visible
// confirmshame language.
Expand Down
1 change: 1 addition & 0 deletions extension/src/lib/rule-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const RULE_GROUPS: readonly RuleGroup[] = [
"cookie-banner-hide",
"chat-widget-hide",
"ads-hide",
"disguised-ad-flag",
"svg-sprite-strip",
"irrelevant-sections-redact",
],
Expand Down
Loading
Loading