CodeAFsec: security audits

sec: security audits

Audit local code with /sec: repository or changes, evidence and suggested fixes, with Markdown, JSON and SARIF reports.

Read the code, trace the risk, and report what the evidence supports.
  • /sec
  • /sec changes since main
  • /sec whole repository thorough

sec is the security specialist built into CodeAF, based on SEC-AF. It reads local code for injection, authentication flaws, data exposure and other security problems, then challenges candidate findings against the code. It returns locations, evidence and suggested fixes. There is nothing extra to install on macOS or Linux.

SEC-AF is the original project imported into CodeAF as /sec. The instructions below describe the built-in specialist; you do not need to deploy the standalone SEC-AF service to use it.

Try it in CodeAF

Where

In a conversation on a local repository or folder.

Type
/sec changes since main

Then press Enter. Use /sec alone for the whole repository.

You see

A task starts at once, wearing the sec badge. Open it to follow recon, hunt, prove, remediate and report, or stop it.

Choose the scope

  • /sec reads the whole repository.
  • /sec changes audits branch changes, including uncommitted edits and untracked code. It chooses the branch's base; on the default branch it starts from the last commit.
  • /sec changes since main names the base explicitly.
  • /sec whole repository thorough asks for a deeper audit. The depth choices are quick, standard and thorough; standard is the default.

Changes mode requires git history. It excludes docs, configuration, lock and data files, and top-level test, vendor and dependency folders. Nearby callers are read for context; findings are limited to changed and nearby files. Use a whole-repository audit when that scope is too narrow. A changes run with no eligible code ends with nothing to audit.

You can also ask the chat to audit the repository or its changes in plain words. It proposes a sec task whose brief specifies scope and depth.

How sec works

Recon maps the architecture and security context. Hunters search for different classes of vulnerability. Provers trace data flow, examine validation and weigh an attack hypothesis against the code. Remediation produces suggested fixes for confirmed or likely findings; it applies no patches. The report separates those findings from unclear or ruled-out candidates.

Up to eight agent sessions run at once. Every model call goes through CodeAF and counts toward the run's limits. The conversation's working seat reads code and its light seat handles short structured calls. A run defaults to $5 and four hours, or less when the conversation has less remaining. /budget conversation can lower the ceiling; shell flags can set it explicitly.

Where the result lands

The chat receives a summary with severity, confidence, file and line, weakness and a one-line fix. The full reports live in the task's record folder:

  • sec-report.md: the readable findings, evidence and suggested patches.
  • sec-report.json: the complete result as data.
  • sec-report.sarif: SARIF 2.1.0 for code-scanning tools and editors.

A failed hunt or a stop during analysis is reported as analysis incomplete, with coverage and failure details. Findings already checked may remain useful, but partial analysis is not a clean bill of health. A stop before a result is assembled may leave no report. Inspect the ending and coverage before acting on the findings.

What it reads and what it cannot prove

sec's tools only read, list and search inside the audited folder. It makes no branch, commit or file changes there, and runs no shell, test, build, app or exploit. Its proof is analysis of the source, not a live attack. It audits a local folder, not a URL, and does not query a live vulnerability database. A recent dependency advisory can be missed.

No findings means none were reported within this run's scope, depth and limits. It does not guarantee that the code is secure or that every vulnerability was found. sec cannot read steering messages while running; stop it and restart with a different brief. It is absent from Windows builds.

From the terminal

Flags go before the brief:

codeaf sec run --changes --base main --depth standard --max-cost 5 --max-hours 4
codeaf sec run --help

--dir chooses a folder, --severity filters reported severity, and --model and --light select models. The help lists the remaining controls, including compliance mapping and per-agent limits.

Things to build

  • Before a release: audit the whole repository, read the coverage and evidence, and decide which findings need a fix.
  • Before pushing a change: run /sec changes since main to focus on code the branch changed.
  • Audit, then fix: ask the chat to hand selected confirmed or likely findings to senior-dev. It waits for your yes before proposing the coding task; the audit itself changes nothing.

Go further

Coming soon: describe the org you want and CodeAF builds it: teams, managers, budgets, standing orders.

Source: CodeAF v0.8.0 manual.