This commit is contained in:
Matěj Kubíček
2026-09-02 20:38:45 +02:00
parent 0c524ed6af
commit c7948a788a
46 changed files with 10099 additions and 152 deletions
+73 -2
View File
@@ -1,3 +1,74 @@
# Slop-detect
# SlopDetect
Firefox rozšíření pro detekci AI generovaného obsahu.
SlopDetect is a privacy-first Firefox extension that inspects webpages for machine-readable AI provenance and separately flags clusters of common generated-site patterns.
It currently provides:
- Automatic scanning of ordinary HTTP and HTTPS pages after load
- An in-page result card for flagged pages that collapses into a persistent score chip
- Local C2PA/Content Credentials parsing and validation for accessible images
- Recognition of AI-related C2PA digital source types
- Separate states for valid, detected, invalid, disclosed, inaccessible, and unknown evidence
- Publisher-disclosure discovery in HTML metadata, structured data, and visible labels
- A bounded, on-device heuristic scan for common visual, typography, layout, motion, and copy patterns
- Unsigned generator-metadata clues for images whose C2PA data was removed but whose export metadata survived
- A mixed-provenance page summary and optional in-page image badges
- A stable adapter API for provider-specific image and text watermark detectors
- On-device processing with no telemetry or remote detector calls
SlopDetect does **not** infer that unmarked content is human-made. Its page-pattern score is a suspicion signal, not proof that AI authored a website. Deliberate human designs can match the same patterns, and generated sites can avoid them.
## Development
Requirements: Node.js 22 or newer and Firefox 128 or newer.
```sh
npm install
npm run check
npm test
npm run lint
npm run build
npm start
```
The unpacked extension is written to `dist/`. A distributable XPI-compatible ZIP is produced in `artifacts/` with:
```sh
npm run package
```
## Architecture
- `src/content/` discovers visible page text, image URLs, disclosures, and bounded rendered-style heuristics, and renders image badges.
- `src/background/` fetches bounded image resources, verifies C2PA manifests, coordinates watermark adapters, caches results, and aggregates page status.
- `src/popup/` presents the current scan and requests optional cross-origin image access.
- `src/options/` manages privacy, badge, and resource-limit settings.
- `src/shared/` contains the message, evidence, and result contracts.
Automatic operation requires persistent access to HTTP and HTTPS pages so the content script can inspect their rendered DOM and the background process can read image bytes. It does not run on Firefox settings pages or other privileged browser documents. Private-network image requests are rejected unless the scanned page has the same origin, redirects are rejected, credentials are omitted, and asset size/concurrency are bounded.
Automatic scans begin shortly after `document_idle`, inspect the largest visible images first, and perform at most one bounded follow-up scan when a page adds substantial dynamic content. The default automatic image limit is 10 with a 10 MB per-image automatic cap; manual toolbar scans can inspect up to 50 using the configured size cap. Pages with no reportable status receive no in-page UI and no toolbar badge. Dismissing an alert keeps it dismissed until the page URL changes.
## Detection semantics
- **Verified AI:** a trusted, valid credential contains an AI-generation/manipulation source type.
- **Detected AI:** a readable credential or compatible watermark indicates AI origin without a trusted signer.
- **Publisher disclosed:** the publisher explicitly labels content as AI-generated.
- **AI-style patterns suspected:** at least two deterministic clues cross the configured suspicion threshold. The page remains origin-unknown.
- **Generator metadata detected:** unsigned image bytes name a known AI image tool or contain a recognizable workflow block. This can be removed or forged.
- **Invalid credential:** provenance data exists but validation reports an integrity or trust failure.
- **No supported evidence:** no compatible evidence was found; origin remains unknown.
Text watermark schemes are currently provider-specific. `src/background/detectors.ts` intentionally ships with an empty registry until a public detector can be integrated and tested. This avoids false claims from generic AI-writing classifiers.
The heuristic catalog currently covers purple/cyan and radial gradients, gradient text, side-tab borders, hairline shadows, extreme radii, icon tiles, oversized and italic-serif heroes, hero eyebrows, overused fonts, nested and repeated card grids, decorative looping motion, marquees, generic SaaS vocabulary, em-dash cadence, manufactured contrast, “theater” framing, and stock product promises. It is inspired by the deterministic patterns documented in the [Impeccable slop catalog](https://impeccable.style/slop/), but implemented independently and conservatively.
## C2PA runtime
The build packages `@contentauth/c2pa-web`, its worker, and its WebAssembly binary locally. Snapshots of the official C2PA signing and timestamp trust lists are also bundled. Remote manifests and OCSP fetching are disabled, so inspecting an asset does not cause the C2PA SDK to contact locations named by that asset. No executable code is loaded from a CDN. The extension CSP permits WebAssembly while continuing to restrict script and worker sources to the extension itself.
`@contentauth/c2pa-web` 0.14.4 applies an HTTPS-only check to explicit worker URLs. Firefox identifies packaged extension resources with `moz-extension:` instead, so `src/background/c2pa.ts` contains a narrow compatibility adapter: the SDK's scheme check sees its required HTTPS shape, while the browser receives and loads the original same-extension worker URL. The adapter rejects non-extension worker locations.
## License
Source code in this repository is available under the MIT License. Third-party packages retain their respective licenses.