← all artifacts
skillv1.0.0tested

Security Reviewer

security-reviewer

Review a change or codebase for authorisation, data exposure and trust-boundary defects. Use when adding tables or policies, handling secrets or credentials, adding an API or webhook, implementing roles or auth, or before shipping anything that touches user data.

Provenance

Derived procedure. The source project remains authoritative for its own doctrine; nothing here governs it.

Source project
Atlas Project
Snapshot
02260d7e
Source paths
  • src/modules/permissions/
  • src/modules/security/
  • src/modules/secrets/
Harvested
2026-09-10
Evidence standing
known
Predecessor
unknown
Supersedes
nothing
Superseded by
unknown

Compatibility and state

Compatible targets
GenericAtlasHTC HubAtlas Harmony Hub
Runtime needs
none declared
Dependencies
none
Tests
structural-and-fixtures-passing (last verified 2026-09-10)
Content hash
pending_export
Consumers
not_searched — No activation survey has been performed across target projects.
Transformation
Architectural security separated from product-specific policy; only the former is carried here. RLS and role-table rules are project_convention plus observed_code.

Files in the artifact

  • SKILL.md
  • agents/openai.yaml

Agent metadata

display_name: Security Reviewer
summary: Reviews authorisation, data exposure and trust boundaries — RLS, grants, role tables, secrets, least privilege, dangerous defaults.
category: review
artifact_class: skill
when_to_use:
  - Adding tables, policies, roles or auth
  - Handling secrets, credentials or environment variables
  - Adding an API endpoint or webhook
  - Before shipping anything touching user data
when_not_to_use:
  - Writing the migration itself (use Migration Author)
  - Judging whether a non-security claim is supported (use Epistemic Reviewer)

SKILL.md

Security Reviewer

Review the boundary, not the intention. Most breaches are not clever attacks; they are a table nobody put a policy on, a role checked in the browser, or a key that was committed once and never rotated.

Separate architectural security — the invariants below, which hold in every project — from product policy, which is per project and lives in that project's own rules. This skill owns the former.

Hard rules

  • Roles live in a dedicated table, never as a column on users or profiles. A role column on a user-editable row is a privilege escalation vector.
  • Authorisation is server-side. A check that runs only in the browser is a UI affordance, not a control.
  • Never trust client-supplied identity. The user id comes from the verified session, never from a request body or a query parameter.
  • Every public table has RLS and at least one policy. RLS without a policy is unreachable; a policy without RLS is decoration.
  • Grants match policies. No anon grant without a deliberate anon policy.
  • Admin/service credentials never decide whether the caller is an admin. Verify the role with the caller's own session first, then escalate.
  • Secrets never reach the client bundle, never appear in logs, never enter source control. Publishable/anon keys are fine in client code; anything else is not.
  • Least privilege by default, widened only with a written reason.

Review checklist

Work through every applicable item. Record a finding for each with its severity and the evidence you actually observed — not what you expect the code to do.

Data authorisation

  • Every new or altered public table: grants present, RLS enabled, policies present.
  • Read each policy literally. Does it scope to auth.uid() or an equivalent, or does it evaluate to true for everyone?
  • Any policy that queries the table it protects — that recurses; needs a security definer helper with a pinned search_path.
  • Does any anon path expose PII, internal ids, or row counts?

Roles and permissions

  • Roles in their own table, with a security definer check function.
  • No role, permission, tier or entitlement stored on a row the user can update.
  • No admin determination made from client storage, a URL, or a hardcoded list.

Server and client boundary

  • Anything that must not be forged runs server-side.
  • Server-only modules unreachable from the client graph — check the whole import chain, not just the direct import.
  • Environment variables: server secrets read server-side only; only deliberately-public values exposed to the browser.

Secrets and credentials

  • No secret in source, in a committed env file, in a comment, or in a fixture.
  • A secret that was ever committed is compromised even after removal — history retains it. It must be rotated, not merely deleted. This is the item most often missed.
  • No secret in a log line, an error message, a screenshot or an analytics event.

API trust boundaries

  • Public endpoints verify their caller inside the handler. Route placement is not authentication.
  • Webhooks verify the provider's signature before touching the payload, using a constant-time comparison.
  • All input validated at the boundary against a schema.
  • Error responses do not leak schema, stack traces or internal identifiers.

Dependency on external authority

  • What does this trust an outside system for, and what happens when that system lies or is unavailable? Fail closed for anything that grants access.

Severity and standing

Report each finding with both:

  • Severity: critical (exploitable now, data exposed), high (exploitable with a precondition), medium (defence in depth), low (hygiene).
  • Evidence standing: observed (read in the code, quoted), inferred (concluded from surrounding code), not_checked (out of scope for this pass).

Never report inferred as observed. A review that overstates its certainty gets trusted once and then gets ignored.

Worked example

Change: an admin dashboard listing all customers.

  1. Route guard. The route checks user.isAdmin from a client store — critical, observed. Anyone can set that value; the guard is cosmetic.
  2. Data path. The query uses the admin client to bypass RLS — critical, observed. Combined with (1), any authenticated user reaches every customer.
  3. Correct shape. The server function verifies the role through the caller's own session against user_roles via has_role(), and only then escalates. The route guard stays, as a UI affordance, clearly not as the control.
  4. Role storage. is_admin is a boolean on profiles, which users can update — critical, observed. Move to user_roles with an app-role enum; profiles remains user-editable, roles do not.
  5. Exposure. The list returns full email and phone for every customer where the screen shows name and status — medium, observed. Narrow the projection; do not ship fields the UI does not render.

Pressure tests

  • Take the least privileged role in the system. What can it read and write? Answer from the policies, not from the UI.
  • If the browser were replaced by a script calling the API directly, which controls survive?
  • Which table would leak the most if exactly one policy were wrong, and is that policy the simplest one you can write?
  • Was any secret ever committed, and has it been rotated since?
  • What does the system do when the external identity provider is unavailable — deny, or allow?
  • Does any error message reveal something a stranger should not know?

Stop conditions

  • A role or entitlement is stored on a user-updatable row.
  • Authorisation depends solely on client-side state.
  • A public table ships without RLS or without a policy.
  • A secret is present in source or would be exposed to the browser.
  • A webhook processes its payload before verifying the signature.