Works with the AI Agents you already use
PostgreSQL Tenant Isolation Audit
Trace cross-workspace access risks through API authorization, SQL, RLS roles, pooled connections, caches and jobs. Get evidence-linked findings and tests.
$9
PostgreSQL Tenant Isolation Audit
Example session with this skill installed
FICTIONAL supplied-evidence exercise; no live actions.
Source-only audit. Ordinary member authenticated in tenant A can supply invoice ID. Handler UPDATE invoices SET paid=true WHERE id=$1 has no ownership check. RLS enabled; tenant policy exists. Runtime role app_owner owns table, FORCE RLS off, no other enforcement described. Tests use owner role and only A records. Explain finding, counter-evidence and proposed negative tests. No database access.
- Read your context and instructions
- Compiled the postgresql tenant isolation
Tenant isolation review: tenant-1
Source-only review of the supplied invoice-update path. No database, browser, network, deployment, or schema change was used. PostgreSQL version, ORM/pooler, grants beyond ownership, and exact policy SQL were not supplied. Evidence labels below refer only to the fictional request.
- T1: An ordinary authenticated tenant A member supplies an invoice ID.
- T2: Handler executes
UPDATE invoices SET paid=true WHERE id=$1, without an ownership check. - T3: RLS is enabled and a tenant policy exists.
- T4: Runtime role
app_ownerowns the table; FORCE RLS is off; no other enforcement is described. - T5: Existing tests use the owner role and contain only A records.
| Entry point | Trusted tenant source | Runtime role/context | Enforcement | Evidence/status |
|---|---|---|---|---|
| Invoice paid update | Authenticated A membership; transaction propagation unspecified | app_owner; context unspecified | ID-only SQL; no ownership check; owner normally bypasses non-forced RLS | T1–T4: reachable source-supported gap |
Ranked findings
-
High priority: ordinary callers reach an update without effective tenant enforcement. Actor: ordinary A member. Entry point: supplied invoice ID in handler T2. Expected: A may change an authorized A invoice; supplying B's invoice ID cannot alter B. Actual described path: the query selects by ID alone, while table ownership and FORCE RLS off mean the described tenant policy does not constrain the runtime owner in ordinary PostgreSQL behavior. Given a B invoice ID, this path can mark B's invoice paid. Consequence: unauthorized cross-tenant invoice-state mutation, with possible downstream accounting behavior; downstream effects were not supplied and are not asserted. Confidence is high in the source-supported violation mechanism; no exploit or database observation was performed. RLS enabled and a tenant policy are counter-evidence to lack of any security intent, but do not defeat this role-specific bypass. An ID's unpredictability would not establish authorization.
Smallest corrective owner: the invoice service/runtime database-access owner. Reuse its existing transaction and authorization helpers if present. Enforce ownership using trusted authorized tenant context at the update boundary and verify the affected-row contract. Select and verify a restricted runtime database identity with reviewed grants/policies; do not blindly add FORCE RLS as the entire repair. Review role membership, superuser/BYPASSRLS attributes, maintenance paths, and migration effects before choosing database changes. FORCE RLS does not constrain superusers or BYPASSRLS roles.
Acceptance evidence gap: T5 proves neither cross-tenant denial nor intended restricted-runtime enforcement. Owner-only same-tenant tests may pass while the violation remains. Keep same-tenant success tests, add adversarial fictional fixtures and test both intended restricted identity and owner behavior separately.
Negative acceptance plan
All rows are proposed, not run. Use fictional A/B invoices, including unpaid B invoice inv-b-fictional, and no external providers.
| Fictional case | Runtime identity | Expected result | No-side-effect assertion | Status |
|---|---|---|---|---|
| A updates A | Actual request identity, then intended restricted identity after repair | Authorized update succeeds | Exactly intended A mutation only | Proposed |
| A supplies B ID | Same identities, owner tested explicitly | Denied/zero affected rows under corrected contract; avoid disclosing B existence | B remains unpaid; no domain event, job, or external call | Proposed |
| A reads B, if a read route exists | Actual read identity | No B fields disclosed | No writes/events/calls | Proposed, route evidence needed |
| Missing/empty/invalid context | Restricted runtime role | Fail closed | No invoice/event/job/effect | Proposed |
| Reuse pooled connection A → B → absent context, including rollback | Actual pool identity | No stale tenant authorization | No unrelated reads/mutations/events/effects | Proposed, pool contract needed |
| Mixed A/B batch or cross-tenant child-parent linkage, if supported | Actual route/job identity | Reject unauthorized elements according to documented atomicity | No B changes/events/effects | Proposed, path evidence needed |
| Job created before A membership revocation | Actual job identity | Honor documented reauthorization/revocation contract | No unauthorized update or effect | Proposed, job contract needed |
Unverified boundaries and acceptance steps
Obtain redacted policy/grant/role definitions and the transaction-context and pool lifecycle source, plus existing invoice authorization/event code. Verify USING and WITH CHECK applicability, policy composition, trusted context establishment, and reset behavior; parameterization alone does not authorize a row. Review only relevant related jobs, cache/read paths and maintenance entry points when supplied. No evidence establishes their behavior here.
Acceptance requires the narrow repair, isolated A/B tests under the actual intended runtime identity, explicit owner behavior checks, and separately authorized complete browser acceptance of the affected invoice flow when an environment is available. This sample does not certify repository-wide isolation.
Connects securely to your tools. The creator never sees your data.
About this skill
Audit selected PostgreSQL SaaS tenant boundaries using redacted source/schema and the actual runtime identity. Distinguish reachable access violations from defense-in-depth observations, privileged maintenance paths and unverified risks. Covers role ownership/BYPASSRLS, policy composition, transaction context, cached responses, jobs and negative acceptance scenarios. Includes a boundary-method reference, report template and fictional worked example. Read-only by default; no database connection, exploit, schema change, production query or security certification is included. Fictional supplied-evidence exercises are documented separately; no live provider, database, browser or cross-agent compatibility acceptance is claimed.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Source analysis cannot prove whole-system security; isolated runtime-role tests and separately authorized browser acceptance remain necessary.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 22 days ago
Permissions
Read bundled and supplied redacted evidence only. Optional browsing, saving a report, implementation and external effects depend on host tools and task authorization. No provider account or credentials required for supplied-evidence review.