Community程式設計與開發github.com

security-test

Defensive application security review (white-box) of backend, frontend, mobile, admin panel, database and CI/infra code using OWASP Top 10:2025, ASVS 5.0 and OWASP LLM/Agentic Top 10. Finds security leaks such as broken access control/IDOR, injection, auth/session flaws, secrets in code or bundles, insecure defaults and fail-open fallbacks, weak crypto, missing headers, PII exposure, vulnerable dependencies, and reports by severity into testcase.md. Use when asked for "security test", "security review", "find vulnerabilities", "OWASP check", "secure code review", or "is this safe".

security-test 是什麼?

security-test is a Antigravity agent skill that defensive application security review (white-box) of backend, frontend, mobile, admin panel, database and CI/infra code using OWASP Top 10:2025, ASVS 5.0 and OWASP LLM/Agentic Top 10. Finds security leaks such as broken access control/IDOR, injection, auth/session flaws, secrets in code or bundles, insecure defaults and fail-open fallbacks, weak crypto, missing headers, PII exposure, vulnerable dependencies, and reports by severity into testcase.md. Use when asked for "security test", "security review", "find vulnerabilities", "OWASP check", "secure code review", or "is this safe".

相容平台~Claude Code~Codex CLI~Cursor✓Antigravity
Part ofMobile
npx skills add https://github.com/joshijignesh/faultline/tree/HEAD/skills/security-test

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

security-test 是做什麼的?

Goal: find where data, secrets, or privileges leak by reading the code (white-box). It's safe to run anywhere: it only reads code and runs local scanners. For the system around the code (infra, CI/CD, identity, monitoring, backups, incident readiness), use cybersecurity-test.

Follow references/core-rules.md, references/automation-workflow.md, references/severity-model.md. Write the report in the format of references/testcase-template.md. Prefix IDs with SEC-. For every detected language, also apply references/languages/<language>.md (index: references/languages/README.md).

Mandatory sweeps (do these first, every run)

These five sweeps catch the findings a long checklist most often lets slip. Run them before the layer checklist. Record each result in the report's Mandatory security sweeps table (template §2c), writing "none found" plus what you searched when nothing turns up. A blank sweep row means the audit is incomplete.

  1. List every file, dotfiles included. git ls-files (or ls -a per directory). Read .env*, .env.example, config/*, application*.properties|yml, settings*.py, appsettings*.json, wp-config.php, Info.plist, AndroidManifest.xml, docker-compose*, and CI files. Some search tools skip dotfiles by default.
  2. Insecure fallbacks and defaults. Search for env reads with a literal fallback: || ', ?? ", ?: ", getenv("X", ", os.environ.get("X", ", ENV.fetch("X", ", env('X', ', System.getenv(...) ?:. Any secret, key, URL, or auth flag with a hard-coded fallback is a finding (at least High for secrets).
  3. Debug and error exposure. DEBUG = True, APP_DEBUG=true, display_errors, include-stacktrace, err.stack / traceback / stackTraceToString / err.Error() sent to clients, exposed actuator, pprof, or swagger.
  4. Auth basics, one line each. Password hashing algorithm · token or session expiry · rate limit or lockout on login/OTP/reset · constant-time comparison of tokens/MACs · where the role/admin decision comes from (server session vs client header/body/localStorage).
  5. Language sinks. For each detected language, search for every API in its guide's Risky APIs table (e.g. strcpy|sprintf|printf( for C/C++, pickle|yaml.load for Python, unserialize for PHP) and list each hit with a verdict.

Procedure

  1. Map the attack surface: entry points (routes, GraphQL resolvers, RPC, webhooks, jobs, deep links, admin routes), the auth middleware, and where data sinks (DB, shell, file system, HTML, logs, third parties).
  2. Trace untrusted input from source to sink for every entry point.
  3. Walk the checklist below per layer (after the mandatory sweeps).
  4. Run any scanners available locally. Use what is installed and skip what isn't: npm audit --omit=dev, pnpm audit, pip-audit, osv-scanner, semgrep --config auto, gitleaks detect, trufflehog filesystem ., bandit -r, gosec ./..., snyk test / Snyk MCP (vendor snyk-fix), CodeQL. Zero scanner findings does not mean secure.
  5. Verify each Critical or High finding before reporting it (vendor fp-check). Then search for variants of each confirmed bug (vendor variant-analysis).
  6. For PRs, run a diff-focused review (vendor differential-review).

OWASP Top 10:2025 quick map

A01 Broken Access Control · A02 Security Misconfiguration · A03 Software Supply Chain Failures · A04 Cryptographic Failures · A05 Injection · A06 Insecure Design · A07 Authentication Failures · A08 Software/Data Integrity Failures · A09 Logging & Alerting Failures · A10 Mishandling of Exceptional Conditions. For depth, use vendor owasp-security (ASVS 5.0 L1–L3 plus language-specific quirks).

Checklist by layer

Backend / API (BE)

Access control (A01): most Critical findings live here

  • Every route has an auth middleware. List routes without one and justify each.
  • Object-level authorization: every findById(req.params.id) also checks owner or tenant (stops IDOR/BOLA).
  • Function-level authorization: admin and staff endpoints check the role on the server, not only by hiding the UI.
  • Multi-tenant: every query is scoped by tenantId/orgId, including counts, exports, search, and file URLs.
  • Mass assignment: the update DTO allowlists fields, so role, isVerified, balance, ownerId can't be set by the client.
  • CORS isn't * together with credentials. Origins come from an allowlist.

Injection (A05)

  • SQL/NoSQL: parameterised queries only. Look for string concatenation, raw(, $where, {$ne:}, query(\...${`.
  • Command: no exec/spawn with user input (shell: true), and no eval/Function()/vm.
  • Path traversal: user-supplied paths are normalised and confined to a base directory.
  • SSRF: user-supplied URLs are allowlisted and private, link-local, and metadata IPs blocked (169.254.169.254).
  • Template injection, XXE (XML parsers with external entities off), unsafe deserialization (pickle, yaml.load, Java ObjectInputStream).
  • Log injection: user input that goes into logs is sanitised (CRLF).

Authentication and session (A07)

  • Passwords hashed with argon2id, bcrypt, or scrypt. Never MD5, SHA1, or unsalted.
  • JWT: algorithm pinned (no none, no HS/RS confusion), exp checked, secret is strong and from env, aud/iss validated.
  • Login, OTP, and reset are rate-limited, with lockout or backoff. OTP has an expiry and is single-use.
  • Reset tokens are random, expiring, single-use, and not logged.
  • Sessions rotate on login and privilege change. Logout invalidates the session on the server.
  • No user enumeration through different messages or timing.

Secrets and config (A02, A04)

  • No secrets in source, git history, Docker images, or client bundles (gitleaks).
  • No fail-open fallbacks: process.env.SECRET || 'dev-secret', if (!authEnabled) next(), rejectUnauthorized: false, DEBUG=True in prod.
  • Strong crypto: AES-GCM, random IVs, crypto.randomBytes or secrets, not Math.random() for tokens.
  • TLS is enforced, and HSTS is set.

Errors and logging (A09, A10)

  • No stack traces or SQL errors returned to clients in prod.
  • Security events (login fail, permission denied, admin actions) are logged, without passwords, tokens, OTPs, card data, or full PII.
  • Exceptions in auth or authorization code fail closed.

Frontend web (FE)

  • XSS: no dangerouslySetInnerHTML, innerHTML, v-html, or [innerHTML] with untrusted data unless sanitised (DOMPurify).
  • href/src built from user data are checked against javascript: URLs.
  • Security headers: CSP, X-Content-Type-Options, frame-ancestors/X-Frame-Options, Referrer-Policy, Permissions-Policy.
  • Tokens: prefer httpOnly + Secure + SameSite cookies. If a token is in localStorage, record it as a Medium finding with an XSS dependency.
  • CSRF protection for cookie-auth state-changing requests.
  • No secrets in the bundle: grep the build output for sk_, secret, private_key, AKIA, service-role keys (e.g. Supabase service_role), Firebase admin keys.
  • Source maps aren't public in prod, and no debug routes are shipped.
  • Open redirect: ?next= / ?redirect= validated against an allowlist.
  • Third-party scripts pinned with SRI where possible.

Mobile (MOB)

  • Tokens kept in Keychain/Keystore (expo-secure-store, react-native-keychain), not AsyncStorage or plain SharedPreferences.
  • No API secrets embedded in the app binary. Anything shipped in an app is public.
  • android:allowBackup, debuggable, cleartext traffic (usesCleartextTraffic, ATS exceptions) off in release.
  • Deep-link handlers validate parameters and don't perform privileged actions without auth.
  • WebViews: javaScriptEnabled only if needed, no file:// access, originWhitelist restricted, and bridges (postMessage) validated.
  • Logs (console.log) stripped in release and contain no tokens or PII.
  • Screenshots or app-switcher snapshots of sensitive screens are protected if required.
  • Certificate pinning where the threat model needs it.

Admin panel (ADM)

  • Admin is on a separate auth realm or role. MFA is required. Sessions are short.
  • Every admin API checks the role on the server. Test with a normal user's token (expect 403).
  • Role hierarchy: support can't escalate to super-admin or edit their own role.
  • Impersonation ("login as user") is audited, time-boxed, and visibly flagged.
  • Exports apply the same tenant scoping and redact sensitive columns. CSV formula injection is escaped.
  • An immutable audit log records actor, action, target, before/after, IP, and time.
  • Admin URL is not guessable-only security (/admin hidden ≠ protected).

Database (DB)

  • App DB user has least privilege: no superuser, no DDL at runtime.
  • Row-level security, or tenant-scoped views, where multi-tenant (e.g. Supabase RLS enabled on every table with correct policies).
  • PII and sensitive columns are encrypted at rest or tokenised where required. Passwords are hashed, never encrypted.
  • Backups are encrypted and access-controlled.
  • DB isn't reachable from the public internet. Credentials are rotated.
  • Migrations don't seed default admin credentials.
  • Data retention and deletion support GDPR/DPDP (right to erasure and export).

Infra / CI / supply chain (INF)

  • Lockfile committed. Dependencies have no known critical CVEs (vendor supply-chain-risk-auditor).
  • No curl | sh in build steps. Docker images pinned by digest, running as non-root.
  • GitHub Actions: third-party actions pinned by SHA, least-privilege permissions:, no pull_request_target combined with checkout of PR code, secrets not echoed.
  • Cloud storage buckets aren't public unless intended. Presigned URLs are short-lived.
  • AI/LLM features: prompt-injection handling, tool and permission scoping, output treated as untrusted (OWASP LLM Top 10). See vendor owasp-security.

Output

Add SEC-* findings to testcase.md with the OWASP category, an optional CVSS score, evidence (file:line), exploit scenario, and fix. Record security Good Points too, e.g. "RLS enabled on all tables".

Scope, prerequisites, and missing tools

Don't use it for infrastructure, CI/CD, or operational security posture (cybersecurity-test) or for functional bugs without a security impact (negative-test, logical-test). It reads code and runs local scanners only.

Prerequisites: read access to the repository. Optional: the project's own test runner and the scanners listed in the language guides. Nothing extra needs to be installed; every check also works by reading the code.

If something is missing: if a tool, the test runner, or a running app isn't available, or a step is blocked, record it as NOT RUN: <reason> and continue statically. Always finish by writing the report.

Example finding row

IDLayerTypeFindingLocation / EvidenceFailure scenarioFixStatus
SEC-BE-001BESECURITYIDOR on order read (OWASP A01)orders_controller.rb:12 Order.find(params[:id])User B reads user A's order by changing the idcurrent_user.orders.find(params[:id])Open

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

相關技能