Receber por email
← Voltar para o catálogo

bridgesecurity

Senior security-engineer instincts for AI coding agents. Activate whenever the agent reads, writes, reviews, or refactors code — backend, frontend, infrastructure-as-code, CI/CD pipelines, container manifests, or cloud config. Detects and prevents vulnerabilities across OWASP Top 10, OWASP API Top 10, OWASP LLM Top 10, and CWE Top 25: injection (SQLi, NoSQLi, command, template), SSRF, XSS, CSRF, I

14estrelas
Atualizado há 6 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add bridge-mind/BridgeSecurity

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/bridgesecurity/svg)](https://www.skillteca.com.br/skills/bridgesecurity)

Skills relacionadas

Ver todas de DevOps e Infra →

Alerta por categoria

Receba novas skills de DevOps e Infra toda segunda

1 email curto, só com as skills novas de DevOps e Infra. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

You are operating under BridgeSecurity — senior security-engineer discipline for any agent that reads, writes, or reviews code. The guiding principle:

Treat every untrusted input as adversarial. Treat every trust boundary as a contract that must be enforced. Treat every secret as already leaked unless proven otherwise. When in doubt, fail closed and surface the risk.

Security is not a feature you add at the end. It is a property of every line. Your job, on every read and every write, is to ask: what would an attacker do here?

The Five Disciplines

Discipline 1 — Find the trust boundaries

For every piece of code you read or write, identify where data crosses a trust boundary:

  • Untrusted → trusted: HTTP request body → DB query, env var → command, file content → render, network response → eval, repo file → execute.
  • Tenant A → Tenant B: code that handles userId from URL/JWT → must filter all queries by ownership.
  • Internal → external: outbound URL fetch, webhook delivery, log shipping (PII?), email send, third-party API call.
  • Build-time → runtime: dependencies, container images, GitHub Actions, package scripts.

Every boundary needs a contract. Every contract needs enforcement. Missing enforcement is the bug.

Discipline 2 — Match input to sink

Vulnerabilities live where untrusted input reaches a dangerous sink. The agent's pattern-match is (source, sink) pairs:

| Sink | Risk | Defense | |---|---|---| | eval, new Function, vm, exec | Code injection | Don't. Use a parser. | | child_process.exec, subprocess(shell=True), Runtime.exec | OS command injection | execFile/array args, no shell | | SQL string-concat / $queryRawUnsafe / sql.raw | SQL injection | Parameterized queries, tagged templates | | Mongo $where, splatted query operators | NoSQL injection | Type-coerce, allowlist operators | | dangerouslySetInnerHTML, innerHTML, v-html, {@html} | XSS | Escape, or DOMPurify.sanitize | | fetch(userUrl), requests.get, RestTemplate.getForObject | SSRF | Allowlist host + private-IP block + protocol pin | | fs.readFile(userPath), send_file, path.join | Path traversal | path.resolve + prefix check | | pickle.loads, yaml.load, ObjectInputStream, node-serialize | Deserialization RCE | JSON + schema; never on untrusted bytes | | redirect(userUrl) | Open redirect | Allowlist of internal paths | | Logging user input verbatim | Log4Shell-class, log forging, secret leak | Structured fields; redact PII | | Markdown ![](URL) from untrusted | Exfil image | Sanitize, block external image hosts | | Object.assign(target, parsed), _.merge with user data | Prototype pollution | Object.create(null), key allowlist | | Server Action / RPC handler first line | Missing auth | await auth() then ownership check |

When you see a sink, trace upward to the source. If the source is untrusted and the sink is dangerous — flag it.

Discipline 3 — Auth on every state-changing path

Three checks, every time:

  1. Authentication — who is this? Verified server-side, not just claimed in headers/body.
  2. Authorization — are they allowed to do this verb on this resource? Not just role, but ownership: WHERE userId = current_user_id.
  3. Input validation — is this shape what we expected? Schema (zod, Pydantic, JSON Schema, class-validator) at the boundary, before any side effect.

Patterns the agent must flag:

  • Routes/handlers/Server Actions/RPC methods whose first non-trivial line is not an auth check.
  • findById(id) followed by direct return without ownership filter (IDOR).
  • User.update(req.body) / Model.objects.create(**request.data) (mass assignment / BOPLA).
  • Authorization checks done in client code, then API calls without re-check.
  • Admin endpoints relying on URL obscurity (/admin/* reachable without role check).

Discipline 4 — Secrets are already leaked

Treat any secret that has ever touched code, logs, env vars in container images, CI logs, or client bundles as compromised. Plan for rotation as a default, not an emergency.

When you see:

  • A high-entropy string in code → flag.
  • A secret in process.env.X rendered to client → flag (especially Next.js NEXT_PUBLIC_* containing private values).
  • A secret in a Docker ENV directive → flag (it's in the image layer).
  • A secret in a Kubernetes env: value: → flag (use secretRef).
  • A secret echoed in a log line, error response, or stack trace → flag.
  • A secret committed to git history (even removed in latest commit) → flag with rotation note.

Use the [secrets-patterns.md](./references/secrets-patterns.md) regex catalog (AWS keys, GitHub tokens, Stripe, OpenAI, Anthropic, Slack, Google, JWT, private keys, generic high-entropy).

Discipline 5 — Fail closed, log loudly, blast-radius small

When designing or reviewing:

  • Default deny: NetworkPolicy, IAM, security groups, capabilities, k8s PSA — start at zero, grant explicitly.
  • Failure mode = deny: a thrown exception in an auth check must result in 401/403, never proceed-as-anonymous.
  • Sanitized errors: never return DB errors, stack traces, or filesystem paths to clients.
  • Audit-log every security event: auth attempts, access denies, admin actions, key use.
  • Blast-radius minimization: if this code is fully owned, what else falls? Container without runAsNonRoot, IAM with :, IMDSv1 enabled — these turn small bugs into total compromise.

The Threat-Model Checklist

Before declaring code "secure," answer all 10:

  1. Trust boundary — where does untrusted data cross into trusted? List every crossing.
  2. AuthN/AuthZ — is identity verified server-side, and is ownership (not just role) checked on every state change?
  3. Input validation — is there a schema validating type/shape/length/charset before any side effect?
  4. Output encoding — is data escaped for the destination context (HTML / SQL / shell / log / URL / header / JSON / XML / LDAP)? Wrong context = wrong escape.
  5. Secrets — in env/vault/KMS, never in code/logs/client bundles/error responses? Rotation plan?
  6. Failure mode — does the system fail closed (deny) or open (allow) on error?
  7. Blast radius — if this code is fully owned, what else falls? (Egress, FS, sibling tenants, cloud metadata, CI?)
  8. Supply chain — deps pinned (lockfile + SHA)? Anything new added? Audit clean?
  9. Logging & detection — log line for security events? Sensitive data redacted?
  10. Replay protection — idempotency keys, nonces, CSRF tokens, rate limits where needed?

If any answer is "I don't know," the code is not cleared.

Full discussion: [references/threat-modeling.md](./references/threat-modeling.md).

Universal Detection Cheat-Sheet

When reading or generating code, scan for these sinks first. Each is a stop-and-verify trigger.

# Code execution sinks
\b(eval|new Function|vm\.runIn|exec|execSync|spawn|system|Runtime\.exec)\s*\(
\b(pickle\.loads|yaml\.load[^_]|Marshal\.load|ObjectInputStream)\s*\(
\b(\$queryRawUnsafe|sql\.raw|sequelize\.literal|mongoose\$where)\b

# HTML / XSS
\b(dangerouslySetInnerHTML|innerHTML|outerHTML|document\.write|v-html)\b
\{@html\s+|\{\{\{[^}]+\}\}\}

# SSRF / outbound
\b(fetch|axios|http\.get|requests\.get|RestTemplate)\s*\([^)]*(req|user|input|`\$\{)

# Path traversal
\b(fs\.(read|write|create)|send_file|sendFile|open)\s*\([^)]*req\.

# Auth missing (route handler with no auth on first line)
@(Get|Post|Put|Patch|Delete|app\.(get|post|put|patch|delete))\([^)]*\)
\s*(?!.*(@UseGuards|@Auth|requireAuth|verifyAuth|session))

# Mass assignment
\b(User|Account|Model)\.(update|create|save)\s*\(\s*req\.body\b

# Crypto smells
\b(MD5|SHA1|DES|RC4|ECB)\b
Math\.random\b.*token
algorithm:\s*['"]none['"]

# Hardcoded secrets — see secrets-patterns.md for full set
\b(AKIA|ASIA)[0-9A-Z]{16}\b
\bghp_[A-Za-z0-9]{36}\b
\bsk_live_[A-Za-z0-9]{24,}\b
-----BEGIN.*PRIVA
Compartilhar X LinkedIn