Skip to content

Hardening + localStorage/sessionStorage tracking and scan robustness (1.2.0) - #6

Merged
stevenkop-g merged 5 commits into
mainfrom
feat/hardening-and-storage-tracking
Jul 12, 2026
Merged

Hardening + localStorage/sessionStorage tracking and scan robustness (1.2.0)#6
stevenkop-g merged 5 commits into
mainfrom
feat/hardening-and-storage-tracking

Conversation

@stevenkop-g

Copy link
Copy Markdown
Contributor

Summary

Supply-chain/packaging hardening plus a real correctness gap (storage-based tracking) and scan-robustness improvements. Releases 1.2.0.

Tier 1 — hardening

  • npm provenance on publish (id-token: write + --provenance)
  • conditional exports map (keeps main/types for back-compat)
  • prepublishOnly now runs lint && test && build
  • non-blocking npm audit --audit-level=high step in CI (no real-browser tests added to CI)
  • README: "how this differs from a static cookie scanner" section
  • removed the misleading playwright keyword (the package uses Puppeteer)

Tier 2 — correctness / features

  • localStorage / sessionStorage tracking: web-storage keys matching known tracker patterns that appear or persist after "Reject All" are now reported as violations. Previously only HTTP cookies were checked, so storage-based tracking could pass as a false negative.
  • --cmp-delay <ms> flag to control the consent-banner load wait (was a hardcoded 2s)
  • after a successful "Reject All", the scanner now waits for the banner to actually be dismissed before measuring the post-rejection state
  • stricter CLI validation for --format and --timeout
  • the library entry point can now be imported without launching a browser (CLI runs only when invoked directly), which makes it unit-testable

Tests

New mock-Puppeteer scanner tests (violation logic, storage detection) and CLI tests (arg parsing, validation, formatters). 81/81 passing, tsc --noEmit + build clean.

Note: does not touch the open Kruidvat citation PR (#3).

🤖 Generated with Claude Code

stevenkop-g and others added 5 commits July 12, 2026 10:55
- publish.yml: add id-token:write permission + --provenance flag
- package.json: add conditional exports map, lint script (tsc --noEmit),
  prepublishOnly now runs lint + test + build
- ci.yml: non-blocking npm audit --audit-level=high step
- package.json: drop misleading playwright keyword (Puppeteer-only)
- README: add "How this differs from a static cookie scanner" section

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…er-dismissed wait

Correctness + feature work:
- scanner: snapshot localStorage/sessionStorage keys before and after Reject All;
  tracker-pattern keys that persist or newly appear are recorded as violations
- types: add `source` discriminator to Violation ('cookie' | 'localStorage' |
  'sessionStorage' | 'request'), 'storage' violation type, StorageSnapshot,
  and storageBefore/storageAfter on the result
- cookie-classifier: add isTrackingStorageKey() reusing tracking cookie patterns
- scanner: cmpLoadDelay option (default 2000) replaces hardcoded sleep(2000)
- scanner: after a successful reject click, wait for the banner element to
  disappear (waitForBannerDismissed) before measuring after-state
- cmp-detector: expose bannerSelector on CMPDetectionResult so the scanner can
  poll for dismissal
- cli: --cmp-delay flag; strict --format and --timeout validation; export
  parseArgs + formatters; guard main() so the module can be imported without
  launching a browser; surface storage violations in table + text output
- index: export isTrackingStorageKey and StorageSnapshot

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n logic

- tests/cli.test.ts: parseArgs defaults, URL scheme prefixing, --cmp-delay,
  format validation, timeout/cmp-delay numeric validation, unknown-option and
  missing-URL handling; formatTable/formatText rendering incl. storage
  violations and empty-domain handling
- tests/scanner.test.ts: mock puppeteer (launch → browser → page) and assert
  violation-detection logic — persisted tracking cookie, localStorage tracker
  key set/persists after reject, sessionStorage persistence wording,
  non-tracking keys ignored, storage snapshots surfaced on the result

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump version and document the hardening + feature changes in this branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stevenkop-g
stevenkop-g merged commit 3fc0ea8 into main Jul 12, 2026
3 checks passed
@stevenkop-g
stevenkop-g deleted the feat/hardening-and-storage-tracking branch July 12, 2026 10:33
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