跳到正文
DEV Community· Dennison Bertram·· 3 小時前AI 評分56

如何在終端機對自己的程式碼庫進行有系統的安全審查

A structured security review of your own repo, from the terminal

AI 導讀

Cloudflare 的開源 security-audit skill(MIT)列出六階段安全審查流程,涵蓋架構盤點、按覆蓋範圍排查、候選項驗證及結構化報告。free-pi 將該方法整合在單一 Agent 中,但沒有獨立複核或執行目標程式碼的 OS 強制沙盒,用戶須自行驗證所有發現。

正文

Cover image for A structured security review of your own repo, from the terminal

Dennison Bertram

Most "AI security review" prompts give you a pile of plausible-sounding warnings. Cloudflare's open-source security-audit skill (MIT) describes a more disciplined method: map the code, hunt by coverage, try to disprove every candidate, and write findings as structured records.

I work on free-pi, a free terminal coding agent that bundles the skill's audit method and reference checklists. This post explains the method and how to check its output. It is a guide, not a recorded run, and the commands are illustrative. Only review code you own or have permission to test.

The six phases in the skill's README

  1. Reconnaissance: map architecture, trust boundaries and input surfaces into architecture.md and coverage-ledger.json.
  2. Coverage-led hunting: work through units from the ledger.
  3. Candidate validation: try to disprove each candidate.
  4. Structured output: findings.json with confirmed, needs_validation and rejected records, checked against a JSON schema.
  5. Record verification: re-check source claims.
  6. Reporting: REPORT.md, FINDINGS-DETAIL.md and NEEDS-VALIDATION.md.

The skill also has reference files of attack classes for web and auth protocols, client-side code, supply chain, cloud deployment, memory safety and more.

What free-pi does differently from the skill's design

The skill's README expects an agent that can run parallel sub-agents, so the agent that finds a problem is never the agent that checks it, plus an OS-enforced sandbox for running target code. free-pi has neither. It runs the skill in a single agent that follows the method itself.

So the independent checking in the skill's design does not happen. The same agent raises and judges each candidate, and you should validate every finding yourself. Do not ask it to build or run code from a repo you do not trust.

Starting it

From your repo root:

security audit this codebase

A direct request asks for the full method; narrower questions get lighter guidance. The skill's default output directory is ~/security-audit-skill/<repo-name>/run-<N>, outside your repo.

Checking the results

  • confirmed: follow the source trace in the code yourself.
  • needs_validation: each should name one unknown fact, and you often know the answer.
  • rejected: skim to see what was set aside.

The skill's authors say a single run found roughly half of what repeated runs found, so run it again after your first round of fixes.

Limits

It reads code. It cannot see your cloud settings, registry permissions or branch protection. Treat every finding as a lead to verify, not a verdict.

To try it: npx free-pi-cli, sign in with GitHub, and ask for a security audit. More at freepi.ai.

來源:DEV Community · dev.to