Sandbox
@Synvoya/codeinspectus

Local MCP security scanner for AI-generated apps

CodeInspectus wraps Opengrep, Gitleaks, Trivy, and its own AI-code checks behind one local MCP server and CLI. It normalizes findings into a single schema, adds scan history and rescan support, and keeps execution on your machine with no network egress at scan time.

45 stars9 forksTypeScriptUpdated 10d ago
Who it's for

Builders who want their coding agents to scan, explain, and fix security issues before they ship.

What it delivers

You can run a scan → fix → rescan loop without leaving your local machine.

What it does

Local MCP and CLI access

Exposes security checks through MCP tools like `codeinspectus_scan`, `codeinspectus_rescan`, and `codeinspectus_explain_finding`, plus a CLI for direct use.

Multiple security engines

Runs Opengrep for SAST, Gitleaks for secrets, and Trivy for dependency, IaC, license, and SBOM checks.

AI-app-specific detections

Adds first-party rules for prompt injection, unsafe HTML, admin auth gaps, Supabase issues, unsafe tool execution, and similar app patterns.

Scan history and baselines

Supports baselines, triage, scan history, and comparison so builders can track what changed and what was resolved.

Sealed bundles and exports

Can export SARIF, CSV, issue payloads, and sealed bundles with provenance and redaction-aware artifacts.

Agent rules and workflows

Includes ready-made rules for Claude Code, Codex, Cursor, Windsurf, and related agent workflows like one-finding remediation and multi-agent review.

How to get it

  1. 1The official @contentauth/c2pa-node validator is an optional peer because its upstream…
    # Interactive: inspect coverage, licenses, and sizes; then approve all or choose components.
    npx codeinspectus setup
    
    # Automation after an operator has reviewed the plan:
    npx codeinspectus setup --status
    npx codeinspectus setup --all
    npx codeinspectus setup --select opengrep,gitleaks
  2. 2Re-verify your pinned binaries any time
    npx codeinspectus verify-engines

README

CodeInspectus, by Synvoya

License: Apache 2.0 Node.js npm downloads MCP-ready Local-first No telemetry Official MCP Registry codeinspectus MCP server GitHub stars

A local-first, privacy-preserving security MCP server and CLI. Any AI coding agent (Claude Code, Cursor, Codex, Windsurf, Cline, Aider) can invoke CodeInspectus to scan AI-generated / "vibe-coded" code for real vulnerabilities, map findings to compliance frameworks as honest code-level coverage, and drive a scan → fix → rescan loop — fully on your machine, with no account and zero network egress at scan time.

CodeInspectus demo

Reproduce the V2.1 proof: the codeinspectus@2.1.0 package scans an immutable public Rich commit, finds one high-confidence GitHub Actions expression-injection pattern, applies GitHub's documented intermediate-env remediation in a temporary clone, confirms it as 1 resolved, 0 remaining, 0 introduced, 0 not rechecked, then creates and verifies sealed evidence for both states. Run the reproduction script or read the scanner-derived case study. The recorded pre-publication run used the exact V2.1 tarball; the script defaults to npm after publication. The case uses the ai scanner class to isolate stable native behavior; use a normal full scan for broad repository coverage.

If CodeInspectus is useful, star the repository so other AI-app builders can find it.

CodeInspectus orchestrates three best-in-class OSS engines behind one normalized, CWE-keyed schema, and adds its own AI-code-specific checks that generic scanners miss:

  • Opengrep — SAST / OWASP Top 10 (SARIF)
  • Gitleaks — secrets
  • Trivy — dependency CVEs (SCA), IaC misconfig, secrets, license, SBOM
  • CodeInspectus Pub — first-party, exact-version Dart/Flutter dependency matching and CycloneDX/SPDX inventory from pubspec.lock, backed by a bundled offline OSV Pub snapshot
  • CodeInspectus native checks — client-side secret/bundle exposure, Supabase RLS / inverted-auth (the CVE-2025-48757 class), prompt-injection sinks, model-produced tool arguments reaching Node, Python, or narrowly supported Go, Java, C#, PHP, Rust, and Ruby shell sinks without a visible guard, general model output reaching JavaScript eval/Function or import-proven shell-string APIs, conventional Next.js and import-proven Express admin API handlers missing visible authentication or server-side authorization, Supabase Edge Functions with explicit anonymous deployment but no request authentication or privileged-operation authorization, client-writable user_metadata authorization, and unsanitized model/user output rendered via dangerouslySetInnerHTML (XSS / LLM05), plus explicit API-boundary leaks, raw request-to-database writes, sensitive logging, and evidence-gated security-header/CSP/Referrer-Policy/Permissions-Policy/session-cookie/Supabase-CAPTCHA configuration checks. Separate first-party packs cover six narrow Flutter/Dart source failure modes and eight bounded Android/iOS repository-configuration failures, plus four React Native and two Expo framework-specific mobile failures. A bounded Python AI/API pack covers ten narrow Django, Flask, FastAPI, Starlette, Jinja, OpenAI, Anthropic, LangChain, and OS-command source failures. Separate Go, Java, and C# AI packs each contribute one exact official OpenAI SDK tool-argument-to-shell rule; the PHP pack contributes one equivalent rule for the community-maintained openai-php/client ecosystem, and the Rust pack contributes one bounded rule for the community-maintained async-openai ecosystem. A Ruby pack contributes one equivalent rule for the exact official openai gem. A Firebase configuration pack contributes three literal public-write rules for Firestore, Cloud Storage, and Realtime Database. A GitHub Actions pack contributes two workflow rules for direct untrusted-context shell interpolation and exact pull_request_target checkout-and-execute chains.

The shipped manifest contains 94 curated detections: 72 first-party native rule IDs (29 JavaScript/TypeScript, 6 Flutter/Dart, 4 Android, 4 iOS, 4 React Native, and 2 Expo, plus 10 Python AI/API, 1 Go AI, 1 Java AI, 1 C# AI, 1 PHP AI, 1 Rust AI, 1 Ruby AI, 3 Firebase configuration, 2 GitHub Actions workflow, and 2 JavaScript baseline SAST rules), 18 Opengrep-owned SAST rules, and 4 custom Gitleaks rules. All 20 Opengrep YAML rules remain physically active: the two native-owned rules reconcile exact results and fall back to Opengrep on mismatch or native unavailability. Opengrep, Gitleaks, and Trivy are optional, managed, additive engines.

CodeInspectus explains each engine's coverage, license, platform-specific size, and required action before asking permission. After approval it downloads the official, SHA-pinned engine binaries, stores them outside the npm package, and calls them as local subprocesses. It does not fork them.

Why CodeInspectus?

AI-generated apps often ship with security mistakes that generic scanners miss: exposed client-side secrets, weak Supabase auth patterns, unsafe HTML rendering, prompt-injection sinks, and risky AI/vector-store integrations.

CodeInspectus combines proven local scanners with AI-app-specific rules, then exposes the workflow through an MCP server so coding agents can scan, explain, and help fix issues before shipping.

Install

Prerequisite: Node.js ≥22. Node 24 LTS is recommended. No separate engine or Cosign installation is required. CodeInspectus can bootstrap a SHA-pinned Cosign verifier inside ~/.codeinspectus/ after approval; signature verification remains fail-closed. On Linux, the current upstream Opengrep assets require glibc. Alpine/musl remains supported for native CodeInspectus rules, Gitleaks, and Trivy, but setup marks Opengrep unavailable before any download and reports aggregate scan coverage as partial when it is selected.

The official @contentauth/c2pa-node validator is an optional peer because its upstream package downloads a platform-native binding during its own lifecycle script. Normal CodeInspectus installs do not install that peer. Install it explicitly alongside CodeInspectus when local C2PA validation is required; otherwise candidate assets report partial content_provenance coverage.

# Interactive: inspect coverage, licenses, and sizes; then approve all or choose components.
npx codeinspectus setup

# Automation after an operator has reviewed the plan:
npx codeinspectus setup --status
npx codeinspectus setup --all
npx codeinspectus setup --select opengrep,gitleaks

On a terminal, a first bare npx codeinspectus run opens this guided setup. MCP clients continue to start over piped stdio and expose codeinspectus_setup: agents must request a plan, show it, ask permission, then call install with confirm_downloads=true. Declined choices are saved so users are not repeatedly prompted; setup --reset clears them.

Setup first checks local state without network access. It downloads only missing, mismatched, or newly pinned binaries, verifies them against the immutable lockfile shipped in the npm package, and atomically installs them under ~/.codeinspectus/. It refreshes the offline Trivy vulnerability DB only when it is missing, lacks rescan provenance, or is more than seven days old. Rule-only CodeInspectus upgrades therefore download nothing. After setup, scans perform zero network I/O.

Every scan and codeinspectus_list_rules response includes structured engine_setup state: ready, repair_required, db_refresh_recommended, or unsupported_platform. MCP agents are instructed to explain non-ready state and obtain approval through codeinspectus_setup. There is no silent npm postinstall download. repair-engines remains available for advanced/manual use; the older install-engines command remains a compatibility alias.

If a Trivy DB was installed before 0.3.2, scan output tells your agent that CVE rescan tracking is not yet enabled. The agent should run npx codeinspectus repair-engines once; this re-fetches the DB through the verified install path and records its provenance. Until then, vanished CVEs conservatively report not_rechecked; current scan findings remain complete and unaffected.

Re-verify your pinned binaries any time:

npx codeinspectus verify-engines

CLI, CI, and local evidence workflows

codeinspectus scan . --format sarif --output results.sarif
codeinspectus scan . --format csv --output findings.csv
codeinspectus scan . --format sarif --output results.sarif --fail-on-severity high
codeinspectus scan . --baseline SCAN_ID --fail-on-new-severity high
codeinspectus scan . --diff origin/main --head HEAD
codeinspectus scan . --working-tree --base HEAD
codeinspectus bundle create SCAN_ID --output-dir /outside/repository/scan-results
codeinspectus bundle verify /outside/repository/scan-results
codeinspectus bulk scan /absolute/path/to/local-repositories --concurrency 2
codeinspectus history scan . --from BASE_SHA --to HEAD_SHA --since 2026-07-01 --until 2026-07-30 --max-commits 20
codeinspectus issue export SCAN_ID CI-0001 --adapter github --visibility private

Git-scoped scans retain full repository context, tag changed versus supporting-context findings, and report exact resolved revisions and explicit completeness limits. They never checkout, reset, stage, or modify the repository. See docs/GIT-SCOPED-SCANS.md.

Sealed bundles retain redacted JSON, SARIF, Markdown, coverage, provenance and an additive canonical scan record with content hashes for every artifact. Verification is mandatory before bundle export or comparison. See docs/SEALED-SCAN-BUNDLES.md.

CSV is a deterministic spreadsheet-safe projection of the canonical JSON model. It always retains an explicit scan/coverage row, even with zero findings, and neutralizes formula-triggering cells. See docs/CSV-EXPORT.md for the stable column contract.

The V2 TypeScript SDK is available from codeinspectus/sdk. It is a bounded, shell-free wrapper around the exact installed local CLI and exports versioned finding, coverage, history, baseline, triage and bundle types without duplicating scanner logic. See docs/TYPESCRIPT-SDK.md.

Bulk mode scans already-existing repositories under one explicit local parent with bounded concurrency, per-repository isolation and an atomic resumable manifest. It never clones or requires a GitHub account. See docs/BULK-SCANNING.md.

Repository-history mode is separately opt-in and requires exact revision, UTC date and commit-count bounds. It scans isolated immutable snapshots, marks shallow or truncated history partial, and never describes an old finding as current or a historical secret as active. See docs/REPOSITORY-HISTORY.md.

Issue adapters generate one redacted, review-required GitHub, Jira or Linear JSON payload without authentication or submission. Destination visibility is mandatory and public/private disclosure warnings remain in the artifact. See docs/ISSUE-PAYLOADS.md.

The first command is report-only: findings are retained but do not fail complete scans. The second enforces a severity threshold. Both fail closed with exit 2 when aggregate coverage is partial or unknown; coverage takes precedence over finding severity. Exit 1 is reserved for threshold findings after complete coverage. See the CLI command reference and CI policy and SHA-pinned GitHub Actions workflow for the full exit contract, SARIF upload, artifact privacy, and fork/Dependabot behavior.

Baseline enforcement fails only on findings proven new against a compatible explicit stored scan. Incompatible, partial, or unknown comparison evidence fails closed with exit 2. Local triage adds append-only review context without hiding or changing findings. See baselines and local triage for commands, exact matching, bounds, storage, redaction, schemas, and audit behavior.

Local scan history can be listed, inspected, rerun, and compared without network access:

codeinspectus scans list --repository "$PWD"
codeinspectus scans show SCAN_ID
codeinspectus scans rerun SCAN_ID
codeinspectus scans compare OLD_SCAN_ID NEW_SCAN_ID --format json

Comparison is evidence-gated: absence is Resolved only after compatible producer components and complete like-for-like coverage; otherwise it is Not rechecked / unknown. See the scan history and comparison contract for filters, bounds, V1.x compatibility, corruption handling, and Reopened provenance.

The shipped agent rules also define an approval-gated one-finding remediation workflow: investigate one exact finding, propose the regression and smallest patch, edit only after separate approval, test, then rescan against the exact prior scan. Only a CodeInspectus resolved result supports a scanner-resolution claim; not_rechecked remains an explicit proof gap.

Two explicit, optional workflows extend investigation without changing scanner truth:

  • Threat-model and knowledge-base review treats every repository-controlled document as untrusted context. Documents can explain or prioritize raw findings, but never suppress, downgrade, override, or mark them resolved.
  • Bounded multi-agent review keeps deterministic findings and agent interpretations in separate evidence lanes, applies explicit agent/time/scope/cost limits, and requires an exact-prior deterministic rescan before any scanner-resolution claim.

These rules are included in the npm package under agent-rules/; normal CLI and MCP scans do not load documents, invoke models, or depend on either workflow.

An MCP server is installed once per machine and shared across all your projects — it is not a per-repo npm install dependency.

Client registration

The server command is the same across clients, but each client uses its own configuration format. Clients with JSON MCP configuration use:

{
  "mcpServers": {
    "codeinspectus": { "command": "npx", "args": ["-y", "codeinspectus"] }
  }
}
ClientHow
Claude Codeclaude mcp add-json codeinspectus '{"command":"npx","args":["-y","codeinspectus"]}'
Cursoradd to ~/.cursor/mcp.json (or project .cursor/mcp.json)
VS Codecode --add-mcp '{"name":"codeinspectus","command":"npx","args":["-y","codeinspectus"]}'
Codexuse one of the Codex-specific options below
Windsurf / Cline / Aideradd the JSON block above to that client's MCP configuration

For Codex, choose one registration method:

# Codex CLI
codex mcp add codeinspectus -- npx -y codeinspectus
  • Codex app or IDE extension: open Settings → MCP servers → Add server, choose STDIO, set the command to npx and arguments to -y, codeinspectus, then restart.
  • Codex configuration file: add this to global ~/.codex/config.toml or a trusted project's .codex/config.toml:
[mcp_servers.codeinspectus]
command = "npx"
args = ["-y", "codeinspectus"]
tool_timeout_sec = 600

Codex defaults MCP tool calls to 60 seconds. CodeInspectus runs multiple security engines concurrently and permits up to five minutes per engine, so 600 seconds avoids premature client timeouts on larger repositories. This is a Codex client timeout only; it does not change engine limits or other clients' configurations.

Optional: drop in the ready-made agent-rules/ so your agent auto-runs the scan → fix → rescan loop.

MCP clients that support server instructions, including Codex, also receive the safe workflow automatically: show findings first, obtain granular approval before fixes, and rescan before claiming an issue is resolved. The agent-rule files remain useful when you want the same policy persisted explicitly in a repository.

Tools

ToolPurpose
codeinspectus_scanFull local scan of a path (engines + AI checks). Returns CWE-keyed findings, detected technologies, exact native-pack and Pub dependency coverage, remediations, framework tags, and three-state repository evidence for supported runtime controls.
codeinspectus_setupOffline setup plan, saved decline choices, or approval-gated verified downloads to ~/.codeinspectus; never writes to the target repository.
codeinspectus_rescanRe-scan after fixes; diffs vs a prior scan → resolved / remaining / introduced, with fresh technology and pack coverage.
codeinspectus_compliance_reportPer-framework code-level control coverage (not certification).
codeinspectus_explain_findingDeep explanation + full remediation for one finding.
codeinspectus_generate_sbomCycloneDX/SPDX SBOM using Trivy plus native Pub inventory/fallback (written to the managed dir by default, or a path you choose).
codeinspectus_list_rulesActive detectors, native-pack inventory/rule ownership, engine versions, detection-DB + Trivy/Pub DB provenance and freshness, and structured machine setup/repair state.

CodeInspectus never edits or deletes your source code or repository — it reads and reports; your agent applies the fixes. It stores engine data and scan history under ~/.codeinspectus; the only file it writes is an optional SBOM — to a managed directory by default, or a path you choose (see codeinspectus_generate_sbom).

Each scan also reports a read-only git-safety state: if there's no git repo or uncommitted changes, it recommends creating a checkpoint before fixes — your agent runs git only with your approval; the tool never does.

Source Integrity — V3.1

V3.1 activates the first capability in the stable, non-CWE repository_trust contract across scan, rescan, CLI JSON, MCP structured output, SARIF metadata, and the TypeScript SDK. It deterministically inspects supported repository text for bidirectional overrides/unbalanced controls, zero-width or default-ignorable token characters, concealed Unicode tag sequences, encoded variation-selector runs, and a bounded set of mixed-script identifier confusables.

Every artifact reports escaped code points, Unicode names, exact file/line/code-point column, UTF-8 byte offset, context classification, validator identity, confidence, limitations and an approval-required proposed action. Very long tag/variation runs retain the exact span and sequence length while capping rendered evidence to 64 code points; dense candidates and identifiers are bounded before output materialization and incomplete work is reported as partial. Initial BOMs, legitimate RTL text, emoji variation/ZWJ/tag sequences, international-language joiners and ambiguous confusables are suppressed or kept non-destructive. Scans never edit files; cleanup requires explicit approval for the named file and marker, a reversible edit by the user's coding agent, tests, and a rescan.

This is source-integrity protection, not AI-authorship detection. V3.2's explicit-attribution and C2PA results are separate capability records; hidden Unicode is never promoted into either. CodeInspectus does not claim that hidden Unicode is a Claude watermark or evidence of AI generation.

AI Provenance Audit — V3.2

V3.2 activates two more read-only repository_trust capabilities:

  • explicit_ai_attribution deterministically inspects bounded source/config headers, local git commit trailers, and supported image EXIF/XMP/IPTC/PNG metadata for explicit AI-generator or AI-source declarations. These are verified observations of declarative records—not proof that the statement is truthful, proof of vendor origin, or a statistical authorship judgment.
  • content_provenance uses the optional official Content Authenticity Initiative Node validator to inspect supported local C2PA Content Credentials. Results distinguish valid, trusted, invalid, present-but-inconclusive, and remote-reference evidence. Offline scans never fetch a remote manifest, OCSP response, trust list, or revocation endpoint.

Every parser and traversal path is bounded, rejects symbolic links, and reports exclusions as partial. C2PA and legal/licensing attribution records are protected evidence and are never cleanup-eligible. V3.2 does not edit files, remove metadata, rewrite text, inspect pixels/audio/video frames, or claim that absence of a marker means human authorship. Statistical text-watermark verification remains unavailable until an authoritative, independently verifiable detector with calibrated operating thresholds is available.

See the V3 migration guide for schema and SDK changes.

detected_technologies explains the bounded repository signals CodeInspectus saw. pack_coverage separately reports how many registered native analyzers and rules actually ran. A pack state of ran means those listed rules executed; it is not a claim of complete security coverage for the named language or framework. not_applicable means the installed pack did not match detected project technology; not_run, partial, and unavailable distinguish scanner filtering from incomplete or failed execution. The Flutter pack runs only when bounded repository signals identify Flutter; an ordinary Dart package does not activate it. Android and iOS packs likewise require bounded platform-project evidence and report their own platform metadata. React Native and Expo are separate technology-gated packs: an Expo project can run both, while a bare React Native project never implies that Expo configuration rules ran. The Python AI/API pack requires bounded Python/package/framework evidence. It reports unsupported syntax, source bounds, and deliberately excluded corpora as explicit coverage notes instead of inferring that omitted source is safe. The Go, Java, and C# AI packs require their language plus the exact official OpenAI SDK dependency. The PHP pack requires PHP plus exact openai-php/client or openai-php/laravel Composer evidence; those packages are community-maintained, not official OpenAI SDKs. A generic openai framework tag alone cannot activate it. The Rust pack requires Rust plus exact async-openai Cargo dependency evidence; that crate is community-maintained, not an official OpenAI SDK. The Ruby pack requires Ruby plus exact official openai production Gemfile or runtime gemspec evidence; lockfiles remain Ruby-language evidence because they do not preserve dependency groups. A generic openai framework tag alone cannot activate Go, Java, C#, PHP, Rust, Ruby, or Python analyzers. dependency_coverage sepa

Files in the repo

Repository payload29 top-level entries
  • .github
  • agent-rules
  • assets
  • data
  • detection-db
  • docs
  • evals
  • examples
  • fixtures
  • schemas
  • scripts
  • src
  • .gitignore
  • .gitleaks.toml
  • .nvmrc
  • CHANGELOG.md
  • CONTRIBUTING.md
  • engines.lock.json
  • glama.json
  • LICENSE
  • NOTICE
  • package-lock.json
  • package.json
  • README.md
  • server.json
  • THIRD-PARTY-NOTICES.md
  • tsconfig.json
  • tsup.config.ts
  • vitest.config.ts

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k
anthropics/
claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

145k

Fast, efficient, battle-tested at Alibaba's scale. Hybrid architecture code review tool: deterministic pipelines + LLM Agent, precise line-level comments, built-in multi-language ruleset (NPE, thread-safety, XSS, SQL injection), OpenAI & Anthropic compatible.

22k

An open-source AI agent that brings the power of Gemini directly into your terminal.

107k
sickn33/
agentic-awesome-skills

AAS Core is the local, agent-first control plane for complete catalog discovery, agent-owned selection, stack validation, and planning, backed by 2,115+ agentic skills. Includes CLI, local MCP, catalog, plugins, and Workbench.

46k