Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

docs(code-scan): add how it works

tanayvaswanie7e145c197c6
diff --git a/docs/content/docs/code-scanning-github-bot.mdx b/docs/content/docs/code-scanning-github-bot.mdx
index 0a01c1a7..a08d438a 100644
--- a/docs/content/docs/code-scanning-github-bot.mdx
+++ b/docs/content/docs/code-scanning-github-bot.mdx
@@ -18,6 +18,27 @@ There are **TWO** ways to set up the bot:
Both run the scan through **Claude** by default, which is the recommended provider. To use Codex, Cursor, or the built-in judge instead, see [Choosing a Provider](/docs/code-scanning-github-bot#choosing-a-provider).
+## How It Works
+
+The scan runs in your own CI and posts results through Confident AI, so the comment appears from `deepteam[bot]` with no bot token stored in your repo. Authentication uses the GitHub Actions OIDC token, which Confident AI verifies is bound to this repository and pull request before commenting.
+
+```mermaid
+sequenceDiagram
+ participant Dev as Developer
+ participant CI as GitHub Actions
+ participant Scan as deepteam scan
+ participant CAI as Confident AI
+ participant GH as GitHub
+
+ Dev->>CI: Open or update a pull request
+ CI->>Scan: deepteam scan --provider claude --comment
+ Scan->>Scan: Scan the diff and classify findings
+ Scan->>CAI: POST findings + GitHub OIDC token
+ CAI->>CAI: Verify OIDC (repository and PR)
+ CAI->>GH: Post review comments as deepteam[bot]
+ GH-->>Dev: Inline comments + summary on the PR
+```
+
## Hosted GitHub App
The quickest path is the hosted DeepTeam GitHub App, which sets everything up for you:
diff --git a/docs/content/docs/code-scanning-introduction.mdx b/docs/content/docs/code-scanning-introduction.mdx
index bc2a64c6..b080fa5c 100644
--- a/docs/content/docs/code-scanning-introduction.mdx
+++ b/docs/content/docs/code-scanning-introduction.mdx
@@ -30,6 +30,30 @@ By default the report is printed as Markdown and the command exits with code `1`
Code scanning is particularly useful for **CI/CD pipelines**, where you want to catch AI-security issues on every pull request before they are merged.
:::
+## How It Works
+
+`deepteam scan` collects your code (whole files or just a git diff), batches it, sends each batch to the chosen [provider](/docs/code-scanning-github-bot#choosing-a-provider), and maps every result into `deepteam`'s vulnerability taxonomy. It then renders a report and, optionally, comments on your pull request.
+
+```mermaid
+sequenceDiagram
+ participant CLI as deepteam scan
+ participant Collector as Collector
+ participant Scanner as CodeScanner
+ participant Engine as Provider engine
+ participant Report as Report
+
+ CLI->>Collector: collect files or git diff
+ Collector-->>CLI: CodeChunks
+ CLI->>Scanner: scan(chunks)
+ loop For each batch of chunks
+ Scanner->>Engine: generate_findings(prompt)
+ Engine-->>Scanner: findings (deepteam taxonomy)
+ end
+ Scanner-->>CLI: deduped findings
+ CLI->>Report: render (markdown / sarif / json)
+ Note over CLI: With --comment, findings post as deepteam[bot]
+```
+
## Running a Scan
The `deepteam scan` command takes a `path` argument, which can be a file or a directory and is defaulted to `.`.