# vercel-labs/deepsec — AlpLab Radar Static Code Audit

- Ring: `adopt`
- Category: `dev`
- Overall score: `3.9/5`
- Implementation check: `verified`
- Maturity: `active`
- Audited commit: `631c499e3a5e` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-01T20:26:55Z
- Repository: https://github.com/vercel-labs/deepsec
- Radar entry: https://radar.alplab.co/#repo/vercel-labs/deepsec
- License: `Apache-2.0`
- CI workflows: `.github/workflows`
- Tags: `vulnerability-scanner`, `static-analysis`, `ai-agents`, `security`, `typescript`, `cli`

## Summary

A TypeScript monorepo CLI (npm package deepsec) that pairs a fast regex-matcher/tech-detection scanner (~180 built-in matchers) with AI coding-agent investigation (Claude, Codex, Pi backends) to find, revalidate, triage, and export vulnerabilities across whole codebases or PR diffs, with resumable per-file state, atomic locking, and optional fan-out across Vercel Sandbox microVMs with egress-firewalled credential brokering.

## Implementation Check

Every README claim traces to working code: all workflow-reference commands are wired in packages/deepsec/src/cli.ts, resume/locking is implemented in packages/core/src/run.ts (acquireProcessLock, registerActiveRun, isReclaimableLock), sandbox fan-out with host-side-only credentials is in packages/deepsec/src/sandbox/setup.ts (buildWorkerNetworkPolicy, BROKERED_TOKEN_PLACEHOLDER), and only env var names — never key values — are persisted (packages/deepsec/src/preflight.ts, packages/deepsec/src/env-file.ts with 0600 atomic writes).

## When to Use

Use it for deep security review of large existing codebases (or PR-diff gating) when you can afford real AI token costs and want a self-hosted, resumable, parallel scanner with strong sandboxing; use sandbox mode for untrusted/vendored-heavy code. Not for cheap/fast SAST-only gating, air-gapped machines without AI credentials, or budgets that can't absorb scans the README itself prices in the thousands of dollars.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.5/5 |
| usability | 4.0/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 4.0/5 |

## Code Evidence

Scanner: packages/scanner/src/index.ts RegexScannerDriver.scan and scanFiles implement the glob+matcher pipeline with ignore globs, tech gating (evaluateGate), per-language stats; packages/scanner/src/matchers/ holds ~180 matchers across 15+ ecosystems (rce.ts, js-nextjs-server-action.ts, py-sql-raw.ts, tf-iam-wildcard.ts). Processor: packages/processor/src/index.ts process() does atomic batch claiming under acquireProcessLock, stale-lock reclaim via PID liveness, quota-abort via AbortController, cost caps, and a ContentFilterBrake with chunked retry; packages/processor/src/agents/shared.ts parseInvestigateResults/classifyQuotaError plus in-session JSON/field/ID repair loops handle malformed model output fail-loud. CLI: packages/deepsec/src/cli.ts registers init/setup/scan/process/revalidate/triage/enrich/report/export/metrics/status/sandbox. Security engineering: packages/core/src/paths.ts assertSafeSegment/assertSafeFilePath block traversal; git calls use argv form with explicit metacharacter rationale (packages/processor/src/agents/shared.ts buildRevalidatePrompt, packages/processor/src/enrich.ts getRecentCommitters); packages/scanner/src/declarative-matcher.ts regexSafetyError compiles AI-generated matchers data-only with ReDoS guards; packages/deepsec/src/sandbox/download.ts extractTarballLocally does two-pass allowlisted extraction with size/entry caps; packages/processor/src/agents/codex-sdk.ts buildCodexEnv strips all secrets from the agent's environment via an allowlist. Tests/CI: e2e/pipeline.test.ts runs init→scan→process→revalidate→export through the bundled CLI with a stub agent plugin; .github/workflows/ci.yml runs build/lint/knip/typecheck/unit/bundle on Node 22 and 24 with pinned action SHAs, and the repo dogfoods deepsec on its own PRs (.github/workflows/deepsec.yml) — the sandbox download allowlist even cites a self-found 'archive-extraction-untrusted' finding.

## Issues Found

Minor: packages/core/src/run.ts writeFileRecord uses a plain non-atomic writeFileSync (unlike the atomic writeProjectConfig), so an interrupted write can corrupt a FileRecord — deliberately mitigated by salvageFileRecord salvage-with-warnings on read, but atomic-file.ts already exists and could be reused.

## Key Risks

Nothing was executed — tests and CI demonstrably exist and cover the core path, but pass/fail was not verified. Processing costs scale with codebase size (README warns of thousands of dollars per large scan) and requires an OpenAI/Anthropic key, a claude/codex/pi login, or Vercel AI Gateway credentials; sandbox fan-out additionally needs a Vercel account. Local (non-sandbox) runs intentionally give the coding agent shell access on the host (documented threat model; Codex local mode is workspace-write with networkAccessEnabled:false) and prompt injection via vendored code is acknowledged, not solved. No GitHub releases/tags exist yet (version 2.3.16 lives in packages/deepsec/package.json only), so flag defaults and docs may shift between npm versions — SKILL.md itself warns this. Finding quality ultimately depends on the underlying models; revalidate is recommended to cut false positives.

## Reviewed Files

- `README.md`
- `package.json`
- `packages/deepsec/package.json`
- `SKILL.md`
- `docs/architecture.md`
- `.env.example`
- `.github/workflows/ci.yml`
- `.github/workflows/deepsec.yml`
- `packages/deepsec/src/cli.ts`
- `packages/deepsec/src/preflight.ts`
- `packages/deepsec/src/env-file.ts`
- `packages/deepsec/src/file-sources.ts`
- `packages/deepsec/src/resolve-project-id.ts`
- `packages/deepsec/src/commands/init.ts`
- `packages/deepsec/src/commands/process.ts`
- `packages/deepsec/src/setup/generated-matchers.ts`
- `packages/deepsec/src/auth/vercel-link.ts`
- `packages/deepsec/src/sandbox/request-proxy.mjs`
- `packages/deepsec/src/sandbox/setup.ts`
- `packages/deepsec/src/sandbox/upload.ts`
- `packages/deepsec/src/sandbox/download.ts`
- `packages/core/src/run.ts`
- `packages/core/src/paths.ts`
- `packages/scanner/src/index.ts`
- `packages/scanner/src/declarative-matcher.ts`
- `packages/scanner/src/matchers/rce.ts`
- `packages/processor/src/index.ts`
- `packages/processor/src/enrich.ts`
- `packages/processor/src/agents/shared.ts`
- `packages/processor/src/agents/codex-sdk.ts`
- `e2e/pipeline.test.ts`
