agentsclimarketplace

Tenant scope audit

Skill amineorion/claude-code-safety-skills/skills/tenant-scope-audit

Audit a multi-tenant codebase for queries, caches, jobs, or searches that are missing a tenant filter — the missed WHERE tenant_id that becomes a cross-tenant data leak. Use whenever the user works on a multi-tenant SaaS, asks to check tenant isolation, reviews data-access code, or mentions tenant scoping, RLS, or data leaks.From its SKILL.md

Install
npx -y skills add amineorion/claude-code-safety-skills --skill tenant-scope-audit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.2 KB, 445 tokens by cl100k_base, as published. Nobody here has run it

Tenant-scope audit

Find data access that is not scoped to a tenant. In a shared-schema multi-tenant system, one unscoped query is a data breach, not a performance bug.

Run the scan

bash ${CLAUDE_SKILL_DIR}/scripts/scan-tenant-scope.sh

Scope it to a path or the current diff when reviewing a change:

bash ${CLAUDE_SKILL_DIR}/scripts/scan-tenant-scope.sh api/ workers/

Set TENANT_COL if the tenant column isn't tenant_id|org_id|account_id|workspace_id.

Then reason about each hit

The scanner is a heuristic. For every flagged line, decide which case it is:

  1. Genuinely unscoped (fix it) — a query that returns rows across tenants. The fix is a tenant filter, or routing through the tenant-safe data layer.
  2. Scoped indirectly (verify, then note) — row-level security, a for_tenant() repository, or a current_setting('app.tenant_id') is enforcing it. Confirm the enforcement actually covers this path.
  3. Intentionally global (document it) — an admin/reporting query that must span tenants. It needs an explicit comment and ideally a separate, audited code path.

Look past the database — RLS does not cover these

Row-level security is a safety net, not a fortress wall. Check the vectors it misses:

  • Caches — is the cache key namespaced by tenant? A shared key serves tenant A's data to tenant B.
  • Background jobs — are queues/global workers filtering by tenant, or exporting every tenant's rows?
  • Search indexes — are documents written and queried with a tenant key?
  • File paths / blob storage — are object keys prefixed by tenant?

Report

Summarize as: confirmed leaks (with file:line and the fix), needs-verification, and documented-global. Lead with anything that returns other tenants' data today.

What ships with it: 1 file

1.6 KB alongside SKILL.md, 1 of them executable

scripts/

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.