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.
- 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.
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 reportednever seen to refuse. - Bypasses & side-effect leaks: Out-of-order transitions, privilege escalation paths, or
outeffects 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 itsdeclassifyTo<Sink>names;opaque.fruntime implementations insrc/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, ordecodeSender; derivingbyfrom 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
HttpClientwithout stricthttps:+ 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
startsWithinstead of canonical normalization, trailing separator, and symlink resolution. - Unvalidated
redirect/next/returnTotargets allowing open redirects (including protocol-relative//evil.com). - Unsafe deserialization or plain-object indexing
obj[userKey]exposing__proto__/constructorcollisions instead of schema decoding plusMap/Object.hasOwn. - Secret & error leakage:
Secret…values, keys, tokens, cookies, PII, raw SQL, or stack traces written toConsole/structured logs, returned in error payloads, serialized to clients, or exposed viaVITE_*env vars (Quint'sSecret…check covers only the spec, not shell logs/responses). - Resource & cost guards: Missing request body size limits, missing
HttpClienttimeouts/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/idFromStringfrom untrusted client strings without authenticatedtenantId/userIdscoping and format validation; cross-tenant sharing inside one DO; omittingdecodeStateon wake; responding before storage persists (). - CORS, CSRF, webhooks & headers:
Access-Control-Allow-Origin: *paired with credentials/sensitive data, or reflecting arbitraryOrigin.- Cookie-authenticated state changes lacking CSRF protection (
SameSite=Lax/StrictplusOrigincheck 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-storeon authenticated API responses). - Secrets, bindings & stage isolation: Secrets placed in unredacted Worker
env,envVars, orVITE_*(wrap secrets withRedacted.make); missingassertStageGuardprotecting production IDs/domains;CLOUDFLARE_*/ALCHEMY_*leaking into cached Turbo tasks instead ofpassThroughEnvoncache: falsetasks; missingAlchemy.RemovalPolicy.retain()or unintended DOdeleted_classesmigrations.
4. React UI and client surface
- XSS & untrusted URLs:
dangerouslySetInnerHTML, unsanitized HTML/Markdown/SVG,eval/new Function, or dynamichref/src/actionacceptingjavascript:,data:, orvbscript: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:
postMessagehandlers missing exactevent.originchecks or posting sensitive data withtargetOrigin: "*";target="_blank"/window.openmissingnoopener; tokens, secrets, or PII stored inlocalStorage/sessionStorage, URL query/hash (leaked viaReferer/history/logs), hydration payloads, or hidden/locked views. - Dev exposures: Debug/impersonation bypasses reachable in production builds, or running a device script or
vite --hoston untrusted networks ().
5. Supply chain, environment, and CI
- Dependencies: Unpinned or suspicious new packages, unnecessary
onlyBuiltDependenciesentries inpnpm-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
opaquesecurity 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
- Spec first (): When a security or abuse invariant is missing from the model, encode the
bysender,Secret…type, guard, oralways/step/lawrule inspec/**/*.mdand complete the loop (pnpm check). Never weaken or delete a rule without telling the user why. - Boundaries & proofs: Fix validation, auth derivation, DO scoping, parameterized SQL, SSRF/path/redirect/XSS guards, webhook verification, headers, and Alchemy/CI configs in
src/andalchemy.run.ts. Prove pure TypeScript security helpers with//@contracts (). - 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/senderby, tampered/oversized input, invalid webhook signature, or quota exhaustion. Runpnpm test:deploy(offlineworkerd) when Worker routing, headers, bindings, or DO isolation changed. Never write tests touching onlygen/. - Re-verify: Confirm
pnpm check,pnpm lint,pnpm analyze(where defined), andpnpm 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
- Threat model (Phase A) / Audit scope (Phase B): assets, trust boundaries, adversaries, and surfaces covered.
- Findings resolved: grouped by
P0/P1/P2withfile:line, exploit/abuse path, and root-cause fix. - Verification: automated gates passed (
pnpm check,pnpm lint,pnpm test:deploy), spec rules/proofs added, and abuse journey tests added or extended. - Accepted risks or escalations: deferred
P2s, product tradeoffs, or required production secrets needing user input (or state explicitly that none remain).