convex-authz

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

Updated May 26, 2026
One-click install
npx skills add https://github.com/Albo-Club/albo-os --skill convex-authz-albo-club
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-authz
Source: https://github.com/Albo-Club/albo-os/tree/main/.agents/skills/convex-authz
Command: npx skills add https://github.com/Albo-Club/albo-os --skill convex-authz-albo-club

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Convex backends often ship with exploitable authorization gaps: client-supplied identity arguments that enable impersonation, 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 systematically instead of relying on ad-hoc review. ## Core Features & Use Cases - Deterministic four-shape scan: Regex-based detection of identity-from-arg, missing-ownership-check, PII-leaking queries, and parent-reference write violations across all convex/**/*.ts files, reporting file and line for every hit. - Canonical hardening: Applies the requireIdentity/requireOwner pattern from convex-expert.md verbatim, resolving users-table rows by auth subject when ownership is keyed by Id<"users">. - Foundation gating: 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 multi-tenant SaaS on Convex, run the audit to confirm no public mutation lets one tenant read or write another tenant's rows, then verify the fixes with tsc. ## Quick Start Audit my Convex backend for authorization vulnerabilities and fix any issues you find.

Frequently Asked Questions about convex-authz

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

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

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

How do I fix identity-from-arg impersonation in Convex mutations?

Replace any client-supplied userId or ownerId argument with requireIdentity(ctx), which calls ctx.auth.getUserIdentity() and throws 401 if null. Identity must always come from ctx.auth, never from function arguments, except in internal functions.

What happens if my Convex app has no auth configured yet?

Without auth.config.ts and a subject-keyed users table, ctx.auth.getUserIdentity() always returns null, so enforcement is non-functional. The Skill instead converts privileged public functions to internalQuery/internalMutation and tells you to set up auth first.

Why does comparing doc.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.

When should I not use this Convex authz audit?

Skip it when the project has no convex/ directory, and do not use it for general code review. Performance, schema, and validator findings are out of scope and belong to a general Convex reviewer instead.