# audit-safety

Adopt this skill: https://proskills.md/skills/other/melvynx-ai-maxxing-skills-skills-audit-safety

Page: https://proskills.md/skills/other/melvynx-ai-maxxing-skills-skills-audit-safety
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/audit-safety/SKILL.md
size: 3527
sha: 3f95dcd3a069c30d1876046cf7fd523b6bf69b4e
upstream: https://github.com/melvynx/ai-maxxing-skills/blob/main/skills/audit-safety/SKILL.md

```text
---
name: audit-safety
description: Audit one feature of a web app (TanStack Start, Next.js, Convex) for authorization, tenant isolation, ownership, validation, payment webhooks and sensitive responses. Use before shipping or when the user asks for a security review of a feature; not live pentesting.
argument-hint: "[feature, URL or folder to audit]"
---

Audit the full server-reachable perimeter of one feature. Stay read-only unless the user separately authorizes a fix after this audit is finished or checkpointed. Do not live-test production, create accounts, or mutate data.

If you got this skill from a link instead of a local folder, install nothing else from the repo: download a file it links only when a step needs it, with `curl -fsSL https://raw.githubusercontent.com/Melvynx/ai-maxxing-skills/main/skills/audit-safety/<path> -o <scratch>/<file>` (for example `references/audit-checklist.md`), and read another skill it names only when you reach it, from `https://raw.githubusercontent.com/Melvynx/ai-maxxing-skills/main/skills/<skill-name>/SKILL.md`.

Resolve the narrowest complete perimeter: named feature/URL/paths, else one coherent dirty-tree feature, else conversation context. Expand only along security edges: parent `beforeLoad`/loaders, called server functions (`createServerFn`, server actions, Convex `query`/`mutation`/`action`/`httpAction`), auth/tenant/role/token/error middleware, schemas/ORM/caches/jobs/webhooks, browser DTOs, and focused access tests. State the inferred scope first. Ask only when two perimeters remain equally plausible.

Read repo rules, auth primitives, route helpers, permission definitions, used schema, and representative tests before judging. Prefer local established guards. Always open [references/audit-checklist.md](references/audit-checklist.md).

Build an access matrix per operation: entry + method, intended actor, auth, tenant/resource/ownership binding, role/permission/token scope, input schema, sensitive output, authoritative enforcement site, test evidence. A parent layout or hidden button does not authorize a callable server function or API route.

Check in particular:

- every server function, Convex function and API route enforces auth itself (a public Convex `query`/`mutation` is callable by anyone with the deployment URL);
- IDs from params, forms, JSON, headers and cookies are attacker-controlled until bound server-side;
- client-only role checks protect nothing;
- payment webhooks (Stripe) verify the signature on the raw body, are idempotent, and grant access from the verified event, never from a success URL;
- secret keys (`sk_live_`, `sk_test_`, API tokens) never reach the browser bundle or a `VITE_`/`NEXT_PUBLIC_` variable;
- public reads return an explicit list of fields;
- errors never leak secrets, stack traces or internal URLs;
- auth, OTP, upload, email and AI actions are rate-limited.

Report a finding only with a concrete entry-to-enforcement path and `file:line`. Status: `CONFIRMED`, `DEFENSE GAP`, or `NOT VERIFIED`. Do not infer exploitability from a filename, grep hit, or missing preferred helper. Follow wrapper implementations. Auth, tenancy, ownership, role, permission, and validation are not interchangeable.

Lead with findings, highest severity first: severity, status, operation, evidence, impact, smallest safe fix, regression-test scenario. Then the matrix, coverage gaps, files inspected, and an explicit no-finding conclusion when none is proven. Stop. Do not silently widen into a repo-wide review.
```

## File: skills/audit-safety/references/audit-checklist.md
size: 7196
sha: 098813698f953cf463c581a0a31ab3eb30cf39b3
upstream: https://github.com/melvynx/ai-maxxing-skills/blob/main/skills/audit-safety/references/audit-checklist.md

````text
# TanStack Start safety audit checklist

Use this checklist to guide inspection, not as boilerplate for the final answer.

## 1. Surface inventory

Find every server-reachable operation in the scoped feature:

- TanStack file routes and parent layouts;
- `beforeLoad`, loaders, server route handlers, and request middleware;
- `createServerFn`, server-only functions, actions, and RPC wrappers;
- REST/API compatibility routes, MCP/tool endpoints, webhooks, callbacks, cron jobs,
  queues, and background workers;
- shared data helpers called by those surfaces;
- public DTOs, cache keys, redirects, file upload/download, and signed URLs.

Search by route segment, feature directory, exported function names, ORM model names,
and call sites. Generated route trees can confirm reachability but are not the source
of authorization policy.

## 2. Access matrix

For every read and mutation, answer independently:

| Boundary | Required evidence |
| --- | --- |
| Authentication | Session, API token, provider signature, or deliberate public access |
| Tenant | Requested tenant is derived from or checked against the actor's membership/token |
| Resource | Resource belongs to that same tenant in the authoritative query |
| Ownership | User-owned records are scoped by authenticated user ID where required |
| Role | Coarse role allows the operation |
| Permission | Fine-grained capability matches the operation, especially mutations |
| Token scope | Read/write/tool scope is enforced server-side |
| State | Resource state permits the transition and replay is safe |

Treat IDs from params, search, form data, JSON, headers, cookies, and metadata as
attacker-controlled until bound server-side.

## 3. TanStack-specific traps

- A parent route `beforeLoad` protects route rendering, not direct calls to imported
  server functions or API endpoints.
- A child route may be reachable outside the visual layout through generated routes,
  redirects, preloads, or direct server-function calls. Verify the actual route tree.
- `createServerFn` is a public network boundary unless its handler enforces deliberate
  public access, authentication, or stronger authorization.
- Require input validation before authorization logic consumes IDs or discriminators.
- Middleware context is safe only if the handler uses the identity and tenant from
  that context. Compare it with any tenant ID carried in input.
- Request middleware and function middleware are different surfaces; verify the right
  middleware type is attached to the right entry point.
- Client-only role checks, conditional components, disabled controls, and navigation
  redirects do not protect data or mutations.
- Error serialization must not expose ORM, SQL, stack, secrets, internal URLs, or
  existence differences that create a useful cross-tenant oracle.

## 4. Query and mutation binding

Prefer one authoritative, scoped query such as:

```ts
where: {
  id: resourceId,
  tenantId: authorizedTenantId,
  ownerId: authenticatedUserId,
}
```

Check all nested and follow-up operations. Common failures:

- fetching by global `id`, checking tenant, then later updating/deleting by `id` only;
- checking a parent but loading a child without parent or tenant scope;
- accepting a `tenantId`, `userId`, role, price, status, or ownership field from the
  client when it should be derived from trusted context;
- authorization against one tenant while the ORM query uses another tenant from data,
  cookie, URL, or metadata;
- batch operations where one authorized item permits unscoped IDs in the rest;
- `connect`, `set`, `upsert`, relation filters, raw SQL, or dynamic identifiers that
  cross the established boundary;
- TOCTOU state changes, replayable transitions, or non-idempotent provider callbacks.

For public reads, require explicit field selection and a deliberate DTO. Inspect
transitive helpers for credentials, tokens, customer IDs, private metadata, internal
webhooks, deleted records, drafts, or PII.

## 5. Endpoint classes

### Session APIs and server functions

- Validate method and input.
- Enforce auth in the server boundary itself.
- Bind actor, tenant, resource, role, and permission.
- Consider CSRF/origin defenses for cookie-authenticated mutations according to the
  framework and repository's actual deployment.
- Do not accept an actor identity from request data.

### API tokens and tools

- Parse the exact supported authorization scheme; reject malformed variants.
- Verify token hash/status/expiry/revocation as implemented by the repository.
- Derive tenant from token, then scope every resource to it.
- Enforce read versus write and per-tool scopes before dispatch.
- Prevent a tool name, path param, or nested input from escaping the allowed registry.
- Keep logs and errors free of bearer-token values.

### Webhooks and callbacks

- Read the raw body with a size limit when signature verification requires it.
- Verify signature/secret, timestamp tolerance where supported, and provider/account
  identity before side effects.
- Handle replay and duplicate delivery idempotently.
- Bind provider metadata to local tenant/resource state; do not trust metadata alone.
- Fail closed on missing or ambiguous local records.

### Uploads, downloads, and external URLs

- Validate type, size, extension/content mismatch, key/path ownership, and tenant.
- Scope signed URLs and storage keys; prevent path/key traversal and overwrite.
- For outbound fetches, restrict protocols, hosts, redirects, and private-network
  destinations as needed; set time and size limits.

## 6. Other safety checks

- Sensitive mutations need the narrowest permission, not merely broad team membership.
- Role hierarchy and permission-group expansion must match product intent.
- Cache keys and invalidation must include tenant/user/resource dimensions used by the
  authorization decision; never cache one actor's result for another.
- Redirect and callback URLs need an allowlist or safe relative-path policy.
- Pagination, search, counts, exports, and analytics must retain tenant filters.
- Logs, analytics, error reports, and audit records must not expose secrets or full
  sensitive request bodies.
- Rate-limit auth, enumeration, expensive AI, upload, and externally billable actions
  where abuse has meaningful impact.
- Public metadata, sitemaps, Open Graph handlers, docs, and health routes must not
  enumerate private tenants or resources.

## 7. Regression evidence

Recommend focused tests that can fail before the fix:

- anonymous actor;
- authenticated user from another tenant;
- same-tenant actor with insufficient role or permission;
- valid actor with a resource ID from another tenant;
- valid actor attempting to act on another user;
- read-only token calling a mutation;
- token from tenant A naming a resource from tenant B;
- invalid or replayed webhook signature/event;
- valid happy path.

Static unit tests for permission maps are useful but do not prove endpoint wiring. When
authorized and practical, add request-level or server-function tests that exercise the
real middleware and scoped query. Keep static, local runtime, deployment, and live
authenticated evidence as separate claims.
````

## File: README.md
upstream: https://github.com/melvynx/ai-maxxing-skills/blob/main/README.md

````text
# AI Maxxing Skills

Les skills Claude Code que j'utilise dans la formation gratuite **"Comment créer ton SaaS personnel en moins de 30 minutes"**. Tu les installes une fois, et Claude sait créer, déployer, sécuriser et vendre ton application tout seul, avec la stack Cloudflare, Convex, Lumail et Stripe.

- La formation et la ressource complète (stack, étapes, prompts) : [codelynx.dev/aimaxxing/get](https://codelynx.dev/aimaxxing/get)
- Le lien court à partager : [mlv.sh/fx](https://mlv.sh/fx)
- La plateforme créée en direct dans la vidéo : [formations.ai-maxxing.pro](https://formations.ai-maxxing.pro)

## Installation en une commande

Dans ton terminal :

```bash
npx skills add Melvynx/ai-maxxing-skills -g -a claude-code -s '*' -y
```

Les 31 skills sont installés une seule fois dans `~/.agents/skills/` (Codex les lit là), et `~/.claude/skills/` pointe juste dessus. Les skills du brain (`skills/brain/`) n'en font pas partie : `/setup-brain` les installe dans ton brain uniquement. Relance Claude Code (ou ouvre une nouvelle session dans l'app Claude, onglet **Code**) et tape `/` pour les voir.

Mac ou PC tout neuf, sans Node ni Git ? La commande `npx` ne marchera pas encore. Colle plutôt ce prompt dans une session Claude (onglet **Code**), il n'a besoin de rien d'installé :

```
Télécharge l'archive https://github.com/Melvynx/ai-maxxing-skills/archive/refs/heads/main.tar.gz avec curl, extrais-la avec tar dans un dossier temporaire, copie chaque dossier de skills/ qui contient un SKILL.md dans ~/.agents/skills (pas ceux de skills/brain/) (avec ses scripts et ses références), crée pour chacun un lien ~/.claude/skills/<nom> vers ~/.agents/skills/<nom>, puis liste les skills installés. N'utilise ni git ni npm.
```

## Par où commencer

Dans cet ordre, une seule fois, chacun dans une nouvelle session. Chaque skill s'adapte à ton système (macOS, Linux ou Windows), saute ce qui est déjà prêt et finit par une check-list :

1. `/setup-node` : installe Homebrew (sur Mac, ton mot de passe Mac une seule fois) et Node.js.
2. `/initialize` : les skills de base pour tous tes dossiers, en une commande et tous tirés de ce kit : `skill-manager` (installe, met à jour ou retire des skills, et crée les tiens), `/show-me`, `/grill-me`, `/wait-what`, `/connect-tool` et `/use-style`, plus les réglages pour que Claude Code et Codex arrêtent de te demander la permission à chaque action (les commandes dangereuses restent bloquées) et les raccourcis `cc` / `cx` dans le terminal, puis Claude te montre les styles visuels et retient celui que tu préfères pour tous les fichiers qu'il crée. Sans le kit installé, colle ça dans ton terminal :

   ```bash
   curl -fsSL https://raw.githubusercontent.com/Melvynx/ai-maxxing-skills/main/skills/initialize/scripts/initialize.sh | bash
   ```

3. `/setup-github` : Git, le CLI GitHub, la connexion à ton compte et ton nom dans les commits.
4. Setup brain, avec le lien (il n'est pas dans l'installation globale) : `Crée mon brain avec ce skill : https://github.com/Melvynx/ai-maxxing-skills/tree/main/skills/brain/setup-brain`. Ton dossier de travail avec son `AGENTS.md`, et les skills qui le font vivre (`/create-project`, `/done`, `/cleanup`), installés dans le brain seulement.
5. `/setup-dev-browser` : le Chrome dédié à Claude.
6. `/setup-cloudflare`, `/setup-convex`, `/setup-lumail`, puis `/setup-stripe` si tu vends.
7. `/connect-vps hostinger` : quand tu as acheté ton VPS, le raccourci `ssh hermes` pour y entrer.
8. `/setup-vps mon-domaine.com` : ton agent Hermes sur le VPS, joignable sur Telegram ou Discord, avec son dashboard protégé par une connexion avec ton email et un code reçu par Lumail (tu peux inviter d'autres personnes, admin ou membre).
9. `/setup-my-hermes-dashboard mon-domaine.com` : ton dashboard perso, vide au départ, où Hermes ajoute les modules que tu lui demandes. Ou écris simplement à Hermes "crée mon dashboard".
10. `/install-skills` : `/setup-vps` installe déjà le pack par défaut de Hermes sur le serveur (`create-dashboard`, `connect-tool`, `create-internal-app` et les skills de ses outils, la liste est dans [`skills/setup-vps/hermes-pack`](skills/setup-vps/hermes-pack)). Ce skill ajoute ceux du kit que tu veux aussi donner à Hermes (`create-landing`, `lumail`, `verify`...). Tu peux aussi écrire directement à Hermes sur Telegram "installe le pack par défaut" ou "installe le skill lumail".

Tu n'as pas envie de tout installer ? Lance un seul skill avec son lien, sans rien installer avant. Claude lit le skill et ne télécharge que les fichiers dont il a besoin :

```text
Setup my GitHub with: https://github.com/Melvynx/ai-maxxing-skills/tree/main/skills/setup-github
```

Ça marche pareil avec n'importe quel skill : remplace `setup-github` par son nom.

### Installation manuelle

```bash
git clone --depth 1 https://github.com/Melvynx/ai-maxxing-skills.git
mkdir -p ~/.agents/skills ~/.claude/skills
for d in ai-maxxing-skills/skills/*/; do
  n=$(basename "$d")
  [ -f "$d/SKILL.md" ] && cp -R "$d" ~/.agents/skills/ && ln -sfn ~/.agents/skills/"$n" ~/.claude/skills/"$n"
done
```

Pour un seul projet, copie les dossiers dans `.agents/skills/` à la racine du projet, puis fais de `.claude/skills` un seul lien vers ce dossier : `mkdir -p .claude && ln -sfn ../.agents/skills .claude/skills`.

Pour mettre à jour : relance la commande d'installation (ou `git pull` puis la copie).

## Les skills

| Skill | Ce qu'il fait | Comment l'utiliser |
| --- | --- | --- |
| [`setup-node`](skills/setup-node/SKILL.md) | Installe Node.js (et donc `npm` et `npx`) sans mot de passe administrateur : Homebrew s'il est là, sinon la version officielle dans ton dossier perso, `winget` sur Windows. Les autres skills le lancent tout seuls si Node manque. | `/setup-node`, à faire en premier sur un ordi neuf. |
| [`initialize`](skills/initialize/SKILL.md) | Installe en une commande, pour tous tes dossiers et pour Claude Code et Codex, les skills de base, tous tirés de ce kit : `skill-manager`, `/show-me`, `/grill-me`, `/wait-what`, `/connect-tool` et `/use-style`. Il règle aussi Claude Code et Codex pour qu'ils arrêtent de demander la permission à chaque action (Claude Code refuse toujours `rm -rf`, `sudo` et la lecture des fichiers `.env`) et ajoute les raccourcis `cc` / `ccc` (Claude Code) et `cx` / `cxc` (Codex). S'il trouve des skills de développeur installés par une ancienne version (apex, arena...), il te propose de les retirer. Puis il t'ouvre la galerie des styles, te demande celui qui te parle le plus et l'écrit dans tes règles globales. Relance-le pour tout mettre à jour. | `/initialize`, juste après `/setup-node`. |
| [`setup-github`](skills/setup-github/SKILL.md) | Rend Git utilisable (les outils Apple sur Mac), installe le CLI GitHub, te connecte avec un code à usage unique dans le navigateur, sans mot de passe ni token, et règle ton nom et ton email dans Git. | `/setup-github` |
| [`setup-cloudflare`](skills/setup-cloudflare/SKILL.md) | Installe le CLI officiel `cf`, te connecte à Cloudflare dans le navigateur, choisit le bon compte et liste tes domaines. | `/setup-cloudflare` |
| [`setup-convex`](skills/setup-convex/SKILL.md) | Te connecte à Convex depuis le terminal (création du compte avec GitHub ou Google au passage), pour que Claude crée les bases de données de tes apps. | `/setup-convex` |
| [`setup-lumail`](skills/setup-lumail/SKILL.md) | Connecte ton compte Lumail à Claude dans le navigateur, sans coller de clé API dans le chat. | `/setup-lumail` |
| [`setup-stripe`](skills/setup-stripe/SKILL.md) | Installe le CLI Stripe et l'associe à ton compte en mode test avec un code de vérification, pour que Claude crée tes produits et teste les paiements. | `/setup-stripe`, seulement si ton app vend. |
| [`setup-brain`](skills/brain/setup-brain/SKILL.md) | Monte ton "brain" : un seul dossier où Claude range tout par projet, avec un `AGENTS.md` qui lui dit qui tu es et où tout se trouve. Interview en 10 questions (qui tu es, ton niveau technique, com
````
