Skip to content

feat(rules): dev-leakage matches tier labels at any position and widens the vocabulary (repo#1858) - #1950

Merged
nc9 merged 1 commit into
mainfrom
boat/dev-leakage-tiers-1858
Nov 17, 2026
Merged

nc9 merged 1 commit into
mainfrom
boat/dev-leakage-tiers-1858

Conversation

@nc9

@nc9 nc9 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

content/dev-leakage now matches a tier label at any position left of the audited registrable domain, and the tier vocabulary is wider. Implements squirrelscan/repo#1858.

What changed

  • devTierOf(host, apex) returns "high", "low" or null. A cheap whole-label pre-check runs before the PSL lookup. The registrable domain must equal the apex, and only labels LEFT of the apex are checked, matched whole. A trailing-dot FQDN is normalized first. isDevSubdomainOf is now a boolean wrapper.
  • High confidence (status ladder unchanged, an own attribute link fails): staging, dev, test, qa, uat, preprod, local, int.
  • Low confidence (never own, so only ever warn): demo, sandbox.
  • isNonProductionSeedHost follows the full vocabulary at any position, so auditing qa.example.com or app.dev.example.com skips with non-production-origin. reliability/broken-forms reads the same helper, so its origin classification widens with it. Its tests pass unchanged.
  • One behaviour change to an existing test: my.local.example.com against example.com used to classify as null, and now classifies as dev-subdomain (own) because local is a tier label.
  • Docs page docs/rules/content/dev-leakage.mdx and CHANGELOG updated. Not a new rule, so no rule counts change.

Acceptance criteria

  • Any-position match: app.dev.example.com and www.staging.example.com are found (content-dev-leakage.test.ts, new devTierOf cases).
  • notdev, webdev, development, dev.other.com stay clean, and dev.example.co.uk resolves against example.co.uk (existing and new cases).
  • Vocabulary includes qa, uat, preprod, sandbox, local, demo, int (one case per label).
  • demo and sandbox warn and never fail (full-rule test: demo and sandbox links warn, app.qa.example.com fails).
  • Seed skip widened ("seed hosts follow the widened vocabulary", plus a full-rule run seeded at https://qa.example.com/ that is skipped with non-production-origin).
  • Unit tests cover a sub-tier host, each new label and the false positives.
  • Docs page describes the widened matching and the warn-only labels.
  • packages/rules typecheck and tests pass. The audit-engine golden did not move.

Gates

  • packages/rules: bun run typecheck (tsgo src + tests) passes.
  • bun test on content-dev-leakage, dev-leakage-local-names-813, item-cap-remainder and rule-check-declarations: 105 pass, 0 fail.
  • bun test on broken-forms: 35 pass, 0 fail.
  • bun test on audit-engine streaming-rules-canonical-golden and scan-truncated-carry: 19 pass, 0 fail.
  • docs/: make validate passes (62 pass, 0 fail).

Agent skill

No change needed in the squirrelscan agent skill. The rule id, check name and kinds are unchanged.

Draft: on the hold list, needs a planning review before merge.

@nc9
nc9 marked this pull request as ready for review November 16, 2026 07:06
@nc9
nc9 force-pushed the boat/dev-leakage-tiers-1858 branch 4 times, most recently from f9d2522 to 791d95a Compare November 17, 2026 07:11
nc9 added a commit that referenced this pull request Nov 17, 2026
@nc9
nc9 force-pushed the boat/dev-leakage-tiers-1858 branch from 791d95a to d4f145c Compare November 17, 2026 12:21
nc9 added a commit that referenced this pull request Nov 17, 2026
@nc9
nc9 force-pushed the boat/dev-leakage-tiers-1858 branch 2 times, most recently from fdd0b4c to a504f66 Compare November 17, 2026 15:45
…ns the vocabulary (repo#1858)

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the boat/dev-leakage-tiers-1858 branch from a504f66 to e405524 Compare November 17, 2026 22:54
@nc9
nc9 merged commit b63dfc4 into main Nov 17, 2026
16 checks passed
@nc9
nc9 deleted the boat/dev-leakage-tiers-1858 branch November 17, 2026 23:07
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