convex-authz

Detects and fixes authorization defects in Convex backend functions using deterministic scans.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-authz-tehzeeb07
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-authz
Source: https://github.com/Tehzeeb07/CodeRush/tree/main/.agents/skills/convex-authz
Command: npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-authz-tehzeeb07

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Convex backends often ship with exploitable authorization gaps: identity taken from client-supplied arguments, missing per-document ownership checks, PII-leaking public queries, and writes into containers the caller does not own. This Skill finds and fixes those four defect shapes before they reach production. ## Core Features & Use Cases - Deterministic Four-Shape Scan: Regex-based detection of identity-from-arg impersonation, missing ownership checks, PII-leaking queries, and parent-reference write violations across all convex/**/*.ts files. - Canonical Hardening: Applies the requireIdentity/requireOwner pattern from convex-expert.md to every hit, including subject-keyed users-table resolution and membership checks for container writes. - Foundation Gate: Verifies auth.config.ts and a subject-keyed users table exist before injecting ctx.auth enforcement; on foundationless apps it converts privileged functions to internalQuery/internalMutation instead. - Use Case: Before launching a Convex app, run the audit to find that a public mutation accepts userId as an argument, letting any caller impersonate another user, then automatically rewrite it to derive identity from ctx.auth and verify with tsc. ## Quick Start Audit my Convex backend for authorization vulnerabilities and harden any public queries and mutations that leak data or skip ownership checks.

Frequently Asked Questions about convex-authz

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a Convex backend for authorization vulnerabilities?▼

Run a deterministic scan over all convex/**/*.ts files for four defect shapes: identity-from-arg, missing ownership checks, PII-leaking queries, and unverified parent-reference writes. Each hit is then hardened with requireIdentity/requireOwner and verified with tsc.

How to fix userId passed as a function argument in Convex?▼

Replace the client-supplied userId argument with requireIdentity(ctx), which calls ctx.auth.getUserIdentity() and throws 401 if null. Client-supplied identity arguments let any caller impersonate another user.

Can I add ctx.auth checks without an auth config in Convex?▼

No. Without an auth.config.ts provider and a subject-keyed users table, ctx.auth.getUserIdentity() always returns null, making enforcement non-functional. Convert privileged functions to internalQuery/internalMutation and set up auth first.

Why does comparing ownerId to identity.subject fail in Convex?▼

It fails when the schema keys ownership by a users table row id rather than the raw auth subject, since an Id<"users"> never equals identity.subject. Resolve the caller's users row via the subject-keyed index first, then compare against user._id.

What are the limitations of this Convex authz audit?▼

It is a targeted authz pass, not a general code review, and skips performance, schema, and validator findings. It also skips projects without a convex/ directory and defers per-user checks on apps lacking an auth foundation.