add
Add a capability to the Convex app — consults the served Convex capability catalog for always-current procedures (billing, crons,…
Audit and harden Convex authorization: identity-from-arg impersonation, missing per-document ownership checks, PII-leaking public queries. Deterministic scan + canonical requireIdentity/requireOwner fix + tsc verify. Use for 'secure my app' / 'audit auth' / 'who can access this
How it fires
How this command gets triggered: by you, by Claude, or both.
/convex-authzContext preview
What this command does when you run it.
Audit and harden Convex authorization: identity-from-arg impersonation, missing per-document ownership checks, PII-leaking public queries. Deterministic scan + canonical requireIdentity/requireOwner fix + tsc verify. Use for 'secure my app' / 'audit auth' / 'who can access this
description: "Audit and harden Convex authorization: identity-from-arg impersonation, missing per-document ownership checks, PII-leaking public queries. Deterministic scan + canonical requireIdentity/requireOwner fix + tsc verify. Use for 'secure my app' / 'audit auth' / 'who can access this data', not generic code review."
Audit and harden a Convex app's authorization against the single largest real-defect cluster measured against generated Convex backends (44 of 214 confirmed defects): identity trusted from a client-supplied argument instead of `ctx.auth`, missing per-document ownership checks, and public queries that leak PII/financial data by a client-supplied id. SKIP if there's no `convex/` directory.
1. **Scan** every `convex/**/*.ts` (skip `_generated/` and `.d.ts`) for the 3 shapes:
declares `userId`/`actorId`/`ownerId`/`authorId`/`accountId` typed `v.id(...)`, with zero `ctx.auth` reference anywhere in the function block.
`ctx.db.get(args.xId)` and then patches/deletes/replaces it (or returns its fields) with no comparison against an authenticated identity.
(email, revenue, audit logs, dashboards) parameterized by a client-supplied id with no `ctx.auth` gating. Report every hit with file:line before touching anything. 2. **Harden** each hit using the canonical pattern (do not invent a new one):
// convex/model/auth.ts
export async function requireIdentity(ctx) {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("401: not signed in");
return identity;
}
export async function requireOwner(ctx, doc) {
if (!doc) throw new Error("404: not found");
const identity = await requireIdentity(ctx);
if (doc.ownerId !== identity.subject) throw new Error("403: forbidden");
return doc;
}Replace client-supplied identity args with `requireIdentity(ctx)`; wrap every `_id`-keyed read/mutate with `requireOwner(ctx, await ctx.db.get(args.xId))`; scope PII-returning queries the same way. Leave genuinely internal/admin functions as `internalQuery`/`internalMutation` and unflagged. 3. **Verify** with `npx tsc --noEmit` (or the project's typecheck script), then re-run the scan to confirm 0 remaining hits. 4. Report findings grouped by shape, with file:line, why each is exploitable, and the concrete diff applied.
(internal/admin functions are the one exception, and must stay internal).
just an identity check.
client-supplied id with no auth gate.
helper.
performance/schema/validator findings to `convex-reviewer`.
Official Convex plugins for AI coding agents, providing comprehensive development tools for building reactive backends with TypeScript. Supported Agents: Cursor, Claude Code (more coming soon)
Add a capability to the Convex app — consults the served Convex capability catalog for always-current procedures (billing, crons,…
Add authentication (passkeys/OAuth) to the current Convex app, including the auth.config.ts wiring.
Add Stripe billing/payments to the Convex app via @convex-dev/stripe (checkout + webhook + gating).
Read the Convex deployment's 72h insights (read limits, OCC contention), root-cause each event in code, report evidence-backed…
Set up Convex backups and run a restore DRILL that proves recovery — snapshot, restore into a throwaway preview, assert the data…