Security audit

From CoWork-OS/CoWork-OS · View interactive version

Security audit is an AI agent skill from the GitHub repository CoWork-OS/CoWork-OS. Answer security questions about code, review a file or change for vulnerabilities, or run a full multi-agent audit of a codebase with a coverage ledger and independently verified findings.

How to use this skill

Skill file

Security Audit

Two modes share one skill:

diff, or "is this safe?". Answer in the conversation. Write no files.

Runs six phases with sub-agents and writes a findings file and a report.

Loading this skill never starts a full audit by itself.

{baseDir} is this skill's folder and {artifactDir} is the task's output folder. The skill

prompt gives both as real paths.

Choose the mode

Run a full audit only when the user:

Everything else is advise mode. If the request could be either ("check this project for

security issues"), ask one short question: a quick answer now, or a full audit that runs

several agents and takes longer.

Use other skills when they fit better: dependency-check for known-vulnerable package versions,

code-review / code-reviewer for general PR review, and architecture-design when the user

wants a design document rather than bugs.

Advise mode

  1. Read the code the question is about, plus the callers and sinks needed to follow the data.

Read at depth. A name or a comment is not evidence.

  1. For larger scopes you may delegate one or two read-only helpers with spawn_agent

(worker_role: "researcher"). Give each a narrow question and the paths to start from.

  1. For each issue, state the invariant that breaks: who the attacker is, what they control,

which control should stop them, the path from entry to sink with file:line references,

and the smallest harmful effect.

  1. Label every issue confirmed (the trace holds in the source you read) or **needs

validation** (it depends on configuration, deployment or runtime behaviour you could not

see, so say what would settle it). Drop anything you refuted.

  1. Give a concrete fix for each confirmed issue. Severity only for confirmed issues.

Full audit

Read the phase references as you reach each phase. Do not load them all up front.

| Phase | What happens | Reference |

| ----- | ------------ | --------- |

| 1. Map | Four parallel read-only agents map the product, actors, entry points and execution limits. You write architecture.md and seed coverage-ledger.json. | {baseDir}/references/recon.md |

| 2. Hunt | Hunter waves take ledger units, read the code and return candidates. A fresh coverage reviewer checks each wave for gaps. | {baseDir}/references/hunting.md, {baseDir}/references/attack-classes.md |

| 3. Challenge | Each candidate goes to a fresh verifier that did not find it and tries to refute it. Verdict: confirmed, needs_validation or rejected. | {baseDir}/references/verification-and-report.md |

| 4. Record | You write findings.json and run both checkers. | {baseDir}/references/record-formats.md |

| 5. Re-check | A second fresh verifier re-checks every confirmed and needs_validation record. | {baseDir}/references/verification-and-report.md |

| 6. Report | You write REPORT.md and, when needed, NEEDS-VALIDATION.md. | {baseDir}/references/verification-and-report.md |

Setup

Before phase 1, settle these and record them in run.json (see

{baseDir}/references/record-formats.md):

Surfaces outside a scoped run become out_of_scope ledger units, never covered.

The report then says each finding was verified once.

gaps, then phases 3 and 5 in full.

by a different hunter, and a re-check of every rejected candidate with high impact.

wave, keep enough in reserve for the coverage review and for one or two verifiers per

candidate you expect. If the budget runs out, stop hunting, finish phases 3 to 6 for what

you have, and mark the run incomplete.

workspace, or use a folder the user names. Phase 1 explains how to reuse them.

only if the user agrees for this run. Then run them yourself with run_command: offline,

no dependency installs, any test server bound to 127.0.0.1, inputs and outputs under

{artifactDir}/scratch/. Never probe a deployed system, staging included. Without that

consent, leads that need execution stay needs_validation.

How agents are used in CoWork

phase 1 and for hunter waves. Use spawn_agent with wait: true for a single reviewer or

verifier.

Challengers (phase 3) and re-checkers (phase 5) use worker_role: "verifier". Both roles are

read-only and have no shell. They read with read_file, grep, glob and list_directory,

and they return their result as their final answer.

architecture.md, coverage-ledger.json, findings.json and the reports. Write with

write_file. Run the matching checker with run_command after every write:

```bash

node {baseDir}/scripts/check-ledger.mjs {artifactDir}/coverage-ledger.json

node {baseDir}/scripts/check-findings.mjs {artifactDir}/findings.json --ledger {artifactDir}/coverage-ledger.json

```

The first checks the ledger. The second checks findings (from phase 4 on) and cross-checks

them against the ledger. Fix what they report and run them again. Never edit a checker to

make a file pass.

nor another verifier's verdict. The agent that found something never verifies it.

prompt gives. If an answer is not valid JSON, or wraps the JSON in prose, discard it and

give the same work to a new agent. Do not repair it yourself.

Principles

at. A unit is covered only when a hunter reports the paths it read and the checks it ran.

reach to a sink, through code you have read. "This pattern is often vulnerable" is not a

finding.

it depends on something outside the source, and the record says what would settle it.

rejected keeps refuted candidates on record so the next run does not hunt them again.

separately, then the overall rating.

file, line and type. Show at most the first four characters. Never copy a full secret into

any output or prompt.

candidate has a verdict, both checkers pass) or incomplete with the reason in run.json

and at the top of REPORT.md.

Mistakes to avoid

the user's consent for this run.

Finish

In the conversation, give the user:

Do not paste the whole report.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.