Make It Secure make-it-secure

Model threats and abuse vectors before building a feature, and audit specs, generated cores, VibeLang shells, React UIs, and Cloudflare/Alchemy deployments after building for security flaws, attack vectors, and abuse against a developer's or user's wishes.

Works in Claude, ChatGPT, Codex and more
Our test
—
not tested yet
GitHub stars
20k
elizaos/eliza
Added by
0
members
Updated
Dec 6
commit e932464
Content
1 file
no scripts · 15 KB
License
MIT
free to use

What our test found

Not tested yet. Our model tries every skill on a realistic request and scores the result, the most popular skills first. Until then, the safety checks on the right still apply.

View on GitHub ↗
name: make-it-secure
description: "Model threats and abuse vectors before building a feature, and audit specs, generated cores, VibeLang shells, React UIs, and Cloudflare/Alchemy deployments after building for security flaws, attack vectors, and abuse against a developer's or user's wishes."

Make it secure

Run this skill twice for any feature: Phase A before writing spec transitions or shell code, and Phase B after implementation and automated gates pass. Read in full first, once per session.

Formal checks prove the rules you state, and hunts general defects, leaks, rendering issues, and performance bugs. This skill applies an adversarial mindset across the full stack to find both security vulnerabilities (auth bypass, data leaks, injection, tampering) and abuse vectors (using valid features against a developer's or user's wishes: cost amplification, spam, scraping, quota evasion, replay, or griefing).

Encode every formalizable security invariant in spec/ so pnpm check simulates and proves it; enforce everything touching the outside world at strict system boundaries ().

Phase A: Pre-build threat and abuse modeling

Before adding spec transitions, shell handlers, Worker routes, or UI flows, model how an attacker or abuser could subvert the feature.

1. Map assets, boundaries, adversaries, and abuse cases
  • Assets: user/tenant records, PII, credentials/sessions/secrets, financial or quota balances, compute/storage/LLM/API spend, outbound reputation (email, SMS, webhooks), and durable state integrity.
  • Trust boundaries: browser ↔ Worker/API, Worker ↔ Durable Object/DB/external API, untrusted inputs (HTTP, WS, webhooks, OAuth, URLs, CLI args, config, env, localStorage) ↔ VibeLang shell, tenant A ↔ tenant B, low-privilege ↔ privileged callers, and untrusted PR CI ↔ privileged deploy CI.
  • Adversaries: unauthenticated internet callers, low-privilege authenticated users (horizontal IDOR or vertical role escalation), compromised/scripted clients (bypassing React can(), forging or replaying requests), malicious payloads (injection, SSRF, path traversal, oversized inputs), abusive automation (bots, scraping, credential stuffing, race bursts), and spoofed or misbehaving external services/webhooks.
  • Abuse questions:
  • Isolation & authz: Can caller A read, mutate, infer existence of, or trigger effects on caller B's resources, or skip a workflow gate?
  • Exposure: What values must never leave the server, enter logs/errors/URLs/VITE_*, appear on locked views, or leak via existence/timing oracles?
  • Cost & resource amplification: What cheap or unauthenticated call triggers expensive Worker CPU/subrequests, DO storage growth, R2/KV writes, LLM tokens, paid APIs, or outbound messages?
  • Replay, races & business-logic abuse: Can duplicate webhooks, replayed/reordered requests, concurrent tabs, spam, promo/seat farming, or shared-resource griefing bend valid features against developer or user wishes?
2. Encode defenses in the spec and boundaries first

Design these defenses before writing shell code (, ):

| Threat or abuse class | Structural defense to design first | |---|---| | Spoofed identity, authz bypass, IDOR | Model authenticated actors via a transition parameter named by () so enabled/step never read caller identity from parseEvent; guard ownership/role/tenant in can*; add eval_refuse_<guard> witnesses | | Secret or PII leakage | Type sensitive values with a Secret… prefix () so model blocks flow into public fields, outputs, or branches except via reviewed declassify… functions | | Workflow skip or unauthorized side effects | Write step rules over (before, via, after, out) so no transition skips prerequisites, escalates privilege, or emits side effects (charge, email, webhook) without authorization | | Cost, quota, or economic abuse | Add always and can* bounds on balances, quotas, rates, and collection sizes; define payload, pagination, and per-actor rate limits at the edge | | Replay, duplication, or races | Model idempotency keys/nonces and import net as N from "./net" when loss, duplication, or reordering matters; keep multi-writer security state in a single-writer SQLite Durable Object rather than stored(key) (, ) | | Untrusted input or pure security logic | Define Effect Schemas, branded IDs (UserId, TenantId), and decodeSender/decodeEvent/decodeState boundaries (); put pure crypto/policy logic Quint cannot express in src/**/*.ts with proved //@ contracts () |

Phase B: Post-build security and abuse audit

Run pnpm check, pnpm lint, and pnpm analyze (where defined) first so you never spend audit effort on checks tooling already enforces. Skip generated and build directories (gen/, dist/, .vibe/, .spec-cache/, node_modules/).

  • Incremental scope (feature or PR): audit changed files, their owning spec/ modules, and every touched auth, storage, Worker/DO, UI, or external boundary.
  • Full scope (app or milestone): audit all active non-generated spec, shell, Worker/DO, UI, CLI, and deploy/CI files. Shard large scopes by surface (Model/Spec, Shell/Boundaries, Workers/DO/Alchemy, UI/Client, Supply Chain/CI) per .
1. Quint spec, gen/, and //@ proofs
  • Authz & vacuous guards: Transitions missing by, guards omitting ownership/role/tenant checks, or guards reported never seen to refuse.
  • Bypasses & side-effect leaks: Out-of-order transitions, privilege escalation paths, or out effects emitted before payment, approval, or verification completes.
  • Replay, race & TOCTOU: Missing idempotency keys/nonces; security-sensitive shared state kept in stored(key) (unlocked read-modify-write across concurrent writers) instead of a serialized SQLite Durable Object.
  • Economic & DoS bounds: Missing non-negative/ceiling invariants on amounts, counts, or rates; unbounded lists/maps/sets in state enabling memory or storage exhaustion.
  • Secrets & opaque functions: Over-broad declassify… outputs; a *.egress.* module whose sink is not the one its declassifyTo<Sink> names; opaque.f runtime implementations in src/ whose assumed spec laws are unproved (//@) or callable before wiring.
2. VibeLang shell and Effect boundaries (src/, package scripts)
  • Unvalidated inputs & spoofed senders: HTTP, WebSocket, RPC, webhook, CLI, config, env, or storage inputs reaching logic without Effect Schema, decodeEvent, decodeState, or decodeSender; deriving by from client-supplied headers/body/params instead of verified session/token claims.
  • Injection & ReDoS: Unparameterized/interpolated SQL in DO SQLite, D1, or Postgres/Hyperdrive; shell/CLI command interpolation; catastrophic-backtracking regexes on untrusted input.
  • SSRF, traversal, redirects & object injection:
  • User-controlled URLs passed to HttpClient without strict https: + host allowlist and blocking of loopback, link-local (169.254.169.254), RFC1918, and IPv6 private/ULA ranges (including across redirects).
  • Path containment using naive startsWith instead of canonical normalization, trailing separator, and symlink resolution.
  • Unvalidated redirect/next/returnTo targets allowing open redirects (including protocol-relative //evil.com).
  • Unsafe deserialization or plain-object indexing obj[userKey] exposing __proto__/constructor collisions instead of schema decoding plus Map / Object.hasOwn.
  • Secret & error leakage: Secret… values, keys, tokens, cookies, PII, raw SQL, or stack traces written to Console/structured logs, returned in error payloads, serialized to clients, or exposed via VITE_* env vars (Quint's Secret… check covers only the spec, not shell logs/responses).
  • Resource & cost guards: Missing request body size limits, missing HttpClient timeouts/AbortSignal, unbounded pagination/fan-out, or unthrottled public/expensive operations (LLM calls, outbound email/webhooks).
3. Cloudflare Workers, Alchemy v2, and Durable Objects
  • Routing & auth middleware: runWorkerFirst / static asset routing bypassing Worker auth; unauthenticated /api/*, admin, debug, preview, or cron endpoints; missing HTTP method checks.
  • DO isolation & ID spoofing: Building idFromName / idFromString from untrusted client strings without authenticated tenantId/userId scoping and format validation; cross-tenant sharing inside one DO; omitting decodeState on wake; responding before storage persists ().
  • CORS, CSRF, webhooks & headers:
  • Access-Control-Allow-Origin: * paired with credentials/sensitive data, or reflecting arbitrary Origin.
  • Cookie-authenticated state changes lacking CSRF protection (SameSite=Lax/Strict plus Origin check or CSRF token).
  • Inbound webhooks missing constant-time HMAC verification over raw request bytes plus a timestamp replay window.
  • Missing security headers where applicable (Content-Security-Policy, X-Content-Type-Options: nosniff, frame-ancestors/X-Frame-Options, Referrer-Policy, Strict-Transport-Security, Cache-Control: no-store on authenticated API responses).
  • Secrets, bindings & stage isolation: Secrets placed in unredacted Worker env, envVars, or VITE_* (wrap secrets with Redacted.make); missing assertStageGuard protecting production IDs/domains; CLOUDFLARE_*/ALCHEMY_* leaking into cached Turbo tasks instead of passThroughEnv on cache: false tasks; missing Alchemy.RemovalPolicy.retain() or unintended DO deleted_classes migrations.
4. React UI and client surface
  • XSS & untrusted URLs: dangerouslySetInnerHTML, unsanitized HTML/Markdown/SVG, eval/new Function, or dynamic href/src/action accepting javascript:, data:, or vbscript: instead of an explicit safe-scheme allowlist (https:, http:, mailto:).
  • Client-only security illusions: Treating React can(event, by) or hidden controls as authorization (UI gating is UX only; the server/DO/machine boundary must enforce every rule).
  • Clickjacking, cross-window & client storage: postMessage handlers missing exact event.origin checks or posting sensitive data with targetOrigin: "*"; target="_blank"/window.open missing noopener; tokens, secrets, or PII stored in localStorage/sessionStorage, URL query/hash (leaked via Referer/history/logs), hydration payloads, or hidden/locked views.
  • Dev exposures: Debug/impersonation bypasses reachable in production builds, or running a device script or vite --host on untrusted networks ().
5. Supply chain, environment, and CI
  • Dependencies: Unpinned or suspicious new packages, unnecessary onlyBuiltDependencies entries in pnpm-workspace.yaml, or unaddressed high/critical advisories (run pnpm's dependency audit when network is available).
  • Secrets hygiene & CI boundaries: Committed .env*, keys, tokens, .alchemy/, .wrangler/, or insecure fallback secrets (env.SECRET ?? "dev-secret"); untrusted PR CI jobs touching deploy secrets or poisoning privileged deploy caches ().

Triage, remediation, and verification

Report only verified findings with exact file:line citations and a concrete exploit or abuse path (attacker action → line/rule bypassed → impact). Skip style/comment complaints, issues already caught by pnpm check/pnpm lint, and hypothetical bugs already ruled out by proved spec rules plus verified boundaries.

  • `P0` (Critical): Exploitable authn/authz bypass, cross-tenant read/write, injection (SQLi/XSS/command), SSRF, secret/credential leak, forged sender/webhook, or unbounded cost/resource abuse.
  • `P1` (High): Missing rate/quota/size bound on public or expensive paths, replay/TOCTOU/race on sensitive state, broken CORS/CSRF/header posture, unvalidated external boundary, or unproved opaque security assumption.
  • `P2` (Medium): Defense-in-depth hardening (verbose error details, missing security telemetry, loose input bounds, minor header tightening).
Fix at the root cause, in order
  1. Spec first (): When a security or abuse invariant is missing from the model, encode the by sender, Secret… type, guard, or always/step/law rule in spec/**/*.md and complete the loop (pnpm check). Never weaken or delete a rule without telling the user why.
  2. Boundaries & proofs: Fix validation, auth derivation, DO scoping, parameterized SQL, SSRF/path/redirect/XSS guards, webhook verification, headers, and Alchemy/CI configs in src/ and alchemy.run.ts. Prove pure TypeScript security helpers with //@ contracts ().
  3. Abuse regression tests: Following , extend the existing journey test citing the relevant story or rule with negative/abuse steps through the real shell (src/): unauthenticated caller, wrong tenant/sender by, tampered/oversized input, invalid webhook signature, or quota exhaustion. Run pnpm test:deploy (offline workerd) when Worker routing, headers, bindings, or DO isolation changed. Never write tests touching only gen/.
  4. Re-verify: Confirm pnpm check, pnpm lint, pnpm analyze (where defined), and pnpm test:deploy (where Workers/assets exist) pass after fixes, then re-audit all modified files and touched seams.
Stop condition

Stop when automated gates are green and zero unresolved P0 or P1 security or abuse findings remain. Escalate explicitly when mitigating an abuse vector requires a product tradeoff (auth model, strict rate limits, billing caps) or missing production secrets. Never commit standalone Markdown audit or threat-model reports (); durable rules belong in spec/.

Report

  1. Threat model (Phase A) / Audit scope (Phase B): assets, trust boundaries, adversaries, and surfaces covered.
  2. Findings resolved: grouped by P0 / P1 / P2 with file:line, exploit/abuse path, and root-cause fix.
  3. Verification: automated gates passed (pnpm check, pnpm lint, pnpm test:deploy), spec rules/proofs added, and abuse journey tests added or extended.
  4. Accepted risks or escalations: deferred P2s, product tradeoffs, or required production secrets needing user input (or state explicitly that none remain).