Nullsec Documentation
Nullsec is an AI-powered security analysis platform that audits websites, codebases, and MCP servers. It combines deterministic static analysis with LLM-assisted code reasoning to catch vulnerabilities that pattern-based scanners miss — then generates actionable fix prompts and automated pull requests.
System Architecture
Nullsec is a distributed system with clear separation between the user-facing application, the scanning engine, the analysis pipeline, and the patch generation layer.
Scan Pipeline
Every scan follows the same multi-stage pipeline. Stages run in sequence, with progress events emitted to the client via Supabase Realtime at each transition.
Web Surface Scanner
The web scanner probes a live URL across 9 isolated check modules. Each module is an async function that returns findings and never crashes the scan — failures are caught, logged, and reported as "could not complete."
Code Scanner
The code scanner analyzes a repository's source for vulnerabilities invisible from the web surface. It downloads the repo as a tarball, runs analysis in a temporary sandbox, and deletes all source after completion.
File Priority for AI Analysis
Not all files are equal. The scanner prioritizes by vulnerability likelihood:
Secret Detection Engine
The secret detection engine combines 21+ provider-specific regex patterns with Shannon entropy analysis to identify credentials that are hardcoded, committed to git history, or bundled into client-side JavaScript.
Shannon Entropy Formula
The entropy analysis catches generic high-entropy strings that don't match a known provider pattern — custom API keys, generated tokens, and obfuscated credentials. It runs on variables matching *_KEY, *_SECRET, *_TOKEN, *PASSWORD*, and *_CREDENTIAL*.
Redaction Policy
Matched secrets are always redacted in storage, output, and display. Only the first 4 and last 4 characters are retained:
sk_live_••••••••••••4xQ2
AKIA••••••••••••B7VX
ghp_••••••••••••••••k9MnDependency Audit
The dependency scanner parses manifests and lockfiles across four ecosystems, then batch-queries the OSV.dev vulnerability database.
AI Code Analysis Pipeline
The AI layer sends prioritized source files to Claude for security-focused reasoning. It identifies vulnerability classes that pattern-based scanners structurally cannot detect — broken access control, insecure business logic, confused-deputy attacks, and architectural auth gaps.
Analysis Decision Tree
Token Cost Model
MCP Server Verification
Dedicated verification for Model Context Protocol servers — the tool layer connecting AI models to external capabilities. The scanner inventories tools, classifies capabilities, and analyzes confused-deputy attack surfaces.
Capability Classification
Scoring Formula
The security score is computed deterministically — by code, never by the AI model — ensuring reproducible, auditable results.
Score Computation
Category Weight Distribution
Severity Deduction Matrix
Hard Override Rules
Any exposed live secret → score capped at 55 (Grade D)
A codebase with perfect headers and TLS but a committed database password is not a B — it's an F.
Grade Thresholds
Severity Model
Findings are classified by the intersection of exploitability and impact:
Fix Prompt Generation
Every finding generates a copy-pasteable prompt for Claude, Cursor, or any AI coding tool. The loop: AI writes code → Nullsec finds the bug → fix prompt → AI fixes it → re-scan.
Prompt Requirements
- Specific — exact file and line number
- Descriptive — vulnerability explained precisely
- Instructive — tells the AI exactly what to change
- Constrained — specifies what NOT to change
- Self-contained — works standalone, no references to other findings
Auto-Fix Security PRs
Connect a GitHub repo, scan it, generate minimal patches, and open a pull request — all human-supervised.
Patch Generation Pipeline
Safety Rails
| Rail | Enforcement |
|---|---|
| No auto-merge | No merge API call exists. PRs are opened, never merged. |
| Patch size limit | Reject if > 50 lines changed in one file |
| PR file limit | Reject if > 5 files touched |
| Syntax validation | Every patched file parsed for validity before proposal |
| Risk labeling | Auth/session/payment patches marked HIGH RISK |
| Commit pinning | Patches target the exact commit SHA scanned |
| PR rate limit | Max 3 PRs per repo per day |
| AI validation | Zod schema, 1 retry, then drop. No invented patches. |
| Token encryption | AES-256-GCM at rest. App private key in env only. |
| Audit trail | Every generation, accept, reject, and PR creation logged |
Security Reports
Reports are private by default. Publishing generates a shareable URL and enables the trust badge. Dismissed findings are struck through, never deleted — and the score never changes on dismissal.
Trust Badges
Dynamic SVG served from the Nullsec domain. Cannot be forged. Supports dark/light themes. Expires after 90 days (Standard) or 180 days (Priority). MCP servers display "MCP Verified."
<!-- Embed on your site or README -->
<a href="https://app.trynullsec.com/r/a8f3x">
<img src="https://app.trynullsec.com/api/badge/a8f3x.svg" />
</a>Plans & Pricing
| Surface Scan | Full Audit ($79) | Priority ($199) | |
|---|---|---|---|
| URL scan | ✓ | ✓ | ✓ |
| GitHub scan | — | ✓ | ✓ |
| AI code analysis | — | 50 files, 6K tok/chunk | 100 files, 12K tok/chunk |
| Findings | Top 5 | All | All |
| Fix prompts | — | ✓ | ✓ |
| Auto-fix PRs | — | ✓ | ✓ |
| Badge validity | — | 90 days | 180 days |
| Re-scan | — | — | 1 included (30d) |
| PDF export | — | ✓ | ✓ |
Quick Start
CLI (nullsec-guard)
# Scan the current directory — no accounts, no cloud
npx nullsec-guard
# Enable AI-powered deep analysis
export ANTHROPIC_API_KEY=sk-ant-...
npx nullsec-guard
# Get copy-pasteable fix prompts for Claude / Cursor
npx nullsec-guard --fix-prompts
# CI/CD — fail the build on high+ findings
npx nullsec-guard --ci --fail-on highCLI: nullsec-guard
Open-source CLI. No accounts, no cloud. npmjs.com/package/nullsec-guard
npx nullsec-guard [path] [options]
--json JSON to stdout
--markdown Save .md report
--sarif SARIF 2.1.0 for GitHub
--fix-prompts Copy-paste fix prompts
--no-ai Skip AI (no API key needed)
--ci Exit non-zero on findings
--fail-on <sev> Threshold (low|medium|high|critical)
--mcp Force MCP analysisAPI Reference
| Method | Endpoint | Description |
|---|---|---|
POST | /api/scans | Create and enqueue a scan |
GET | /api/scans/:id | Scan status + report |
PATCH | /api/scans/:id/public | Toggle public/private |
GET | /api/scans/:id/pdf | PDF export |
GET | /api/repos | Connected GitHub repos |
POST | /api/repos/:id/scan | Scan a connected repo |
POST | /api/repos/:id/patches/generate | Generate patches |
PATCH | /api/patches/:id | Accept/reject patch |
POST | /api/repos/:id/pr | Create PR |
GET | /api/badge/:badgeId | Dynamic SVG badge |
Privacy & Data Handling
- Zero source code retention. Repos are cloned, analyzed, and deleted. Only redacted findings persist.
- Secrets always redacted. First 4 + last 4 characters only.
- Without AI: fully local. No network calls except OSV.dev.
- With AI:code snippets sent to Anthropic's API. Not the full repo.
- No telemetry in CLI. No analytics, no tracking.
- GitHub tokens AES-256-GCM encrypted at rest.
Known Limitations
- Static analysis only — no runtime testing. Can produce false positives.
- AI is probabilistic — can miss issues, can flag safe code. Human review required.
- Documentation false positives — example credentials in docs may be flagged. Dismissal is available.
- Lockfile preferred for dependency accuracy. Falls back to manifest ranges.
bun.lockbnot supported (binary format).- Max scan depth: 200 files, 100 MB, 10 directory levels.
- Not a penetration test. Automated first-layer audit only.