Our ~35 own rules left whole languages without SAST findings. Three permissively licensed community packs now run next to them, on the same semgrep invocation (--metrics=off, local files only): - GitLab sast-rules v2.10.1 (53bf5cf6): 148 rules for C#, Java, JavaScript/TypeScript, Python and one Go rule; only files whose header says "License: MIT (c) GitLab Inc.". Not vendored: c/ (every file GPL-2.0, generated from flawfinder), go/ apart from one file (Apache-2.0 gosec ports), scala/, rules/lgpl, rules/lgpl-cc (Commons Clause), rules/gitlab (EE). - 0xdea semgrep-rules (dae50da6, MIT): 35 C/C++ rules. - elttam semgrep-rules (24426856, MIT; its LICENSE carries the Semgrep template's copyright line): 34 rules for Java, Go and Struts/Spring XML. Each pack lives in compliance-agent/rules/vendor/<source>/ with LICENSE, NOTICE (provenance, what was left out and why) and UPSTREAM (pinned commit): upstream/ holds the selected files unchanged with their tests, pack.yaml the rules the agent runs, ids prefixed per source (gitlab-, 0xdea-, elttam-), rules.json an index for the tests. scripts/vendor-semgrep-rules.py regenerates all of it deterministically. Provenance: every candidate rule was compared with the Semgrep registry (semgrep/semgrep-rules, read only for the comparison). Eight GitLab Python/JS rules with the same message or the same patterns are not vendored, nor are elttam's Kubernetes rules (registry-derived). Also left out: elttam's entrypoint enumerators, its ORM-leak hints, three files whose upstream tests fail on semgrep 1.177 and a join-mode rule. Noise budget: run over the nightly fixtures, the public samples and FreeRTOS-Kernel, lwIP, OpenRA, eShopOnWeb, requests, express and spring-petclinic. 15 rules that flood real code (0xdea missing-return 1514 hits, typos 989, interesting-api-calls 718, signed-unsigned-conversion 221, suspicious-assert 176, format-string-bugs 61 ...; GitLab assert-used) are dropped from the pack, each listed with its reason in NOTICE. CPU time of the semgrep run roughly doubles on C-heavy trees (FreeRTOS-Kernel 70 s -> 136 s, lwIP 18 s -> 68 s), well inside the 10-minute stage timeout. Ids stay bare (#473 logic covers the vendored ids, fingerprint() unchanged). The control map gets one vendored semgrep binding per control, by CWE (by rule id for the few elttam rules without one), with exactly the languages of the rules behind it; a test checks every vendored rule maps to a control that claims its languages. Guard: semgrep_args() builds the one invocation; a test fails if any --config is not a staged local pack, or is auto, p/, r/ or a URL, and another scans the agent source, scripts, docker/, CI and Dockerfile.agent for a registry config. Nightly baselines with C, Python, C# or JS code change and need a bless run after the image is deployed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Compliance Scanner
Autonomous security and compliance scanning agent for git repositories
About
Compliance Scanner is an autonomous agent that continuously monitors git repositories for security vulnerabilities, GDPR/OAuth compliance patterns, and dependency risks. It creates issues in external trackers (GitHub/GitLab/Jira/Gitea) with evidence and remediation suggestions, reviews pull requests with multi-pass LLM analysis, runs autonomous penetration tests, and exposes a Dioxus-based dashboard for visualization.
How it works: The agent runs as a lazy daemon -- it only scans when new commits are detected, triggered by cron schedules or webhooks. LLM-powered triage filters out false positives and generates actionable remediation with multi-language awareness.
Features
| Area | Capabilities |
|---|---|
| SAST Scanning | Semgrep engine with our own CRA rules (no registry rules), cppcheck for C/C++, mobsfscan for Android and iOS apps |
| SBOM Generation | Syft + cargo-audit for complete dependency inventory |
| CVE Monitoring | OSV.dev batch queries, NVD CVSS enrichment, SearXNG context |
| GDPR Patterns | Detect PII logging, missing consent, hardcoded retention, missing deletion |
| OAuth Patterns | Detect implicit grant, missing PKCE, token in localStorage, token in URLs |
| LLM Triage | Multi-language-aware confidence scoring (Rust, Python, Go, Java, Ruby, PHP, C++) |
| Issue Creation | Auto-create issues in GitHub, GitLab, Jira, or Gitea with dedup via fingerprints |
| PR Reviews | Multi-pass security review (logic, security, convention, complexity) with dedup |
| DAST Scanning | Black-box security testing with endpoint discovery and parameter fuzzing |
| AI Pentesting | Autonomous LLM-orchestrated penetration testing with encrypted reports |
| Code Graph | Interactive code knowledge graph with impact analysis |
| AI Chat (RAG) | Natural language Q&A grounded in repository source code |
| Help Assistant | Documentation-grounded help chat accessible from every dashboard page |
| MCP Server | Expose live security data to Claude, Cursor, and other AI tools |
| Dashboard | Fullstack Dioxus UI with findings, SBOM, issues, DAST, pentest, and graph |
| Webhooks | GitHub, GitLab, and Gitea webhook receivers for push/PR events |
| Finding Dedup | SHA-256 fingerprint dedup for SAST, CWE-based dedup for DAST findings |
Architecture
┌──────────────────────────────────────────────────────────────────────────┐
│ Cargo Workspace │
├──────────────┬──────────────────┬──────────────┬──────────┬─────────────┤
│ compliance- │ compliance- │ compliance- │ complian-│ compliance- │
│ core (lib) │ agent (bin) │ dashboard │ ce-graph │ mcp (bin) │
│ │ │ (bin) │ (lib) │ │
│ Models │ Scan Pipeline │ Dioxus 0.7 │ Tree- │ MCP Server │
│ Traits │ LLM Client │ Fullstack UI │ sitter │ Live data │
│ Config │ Issue Trackers │ Help Chat │ Graph │ for AI │
│ Errors │ Pentest Engine │ Server Fns │ Embedds │ tools │
│ │ DAST Tools │ │ RAG │ │
│ │ REST API │ │ │ │
│ │ Webhooks │ │ │ │
└──────────────┴──────────────────┴──────────────┴──────────┴─────────────┘
│
MongoDB (shared)
Scan Pipeline (7 Stages)
- Change Detection --
git2fetch, compare HEAD SHA with last scanned commit - Semgrep SAST -- CLI wrapper with JSON output parsing
- SBOM Generation -- Syft (CycloneDX) + cargo-audit vulnerability merge
- CVE Scanning -- OSV.dev batch + NVD CVSS enrichment + SearXNG context
- Pattern Scanning -- Regex-based GDPR and OAuth compliance checks
- LLM Triage -- LiteLLM confidence scoring, filter findings < 3/10
- Issue Creation -- Dedup via SHA-256 fingerprint, create tracker issues
Tech Stack
| Layer | Technology |
|---|---|
| Shared Library | compliance-core -- models, traits, config |
| Agent | Axum REST API, git2, tokio-cron-scheduler, Semgrep, Syft |
| Dashboard | Dioxus 0.7.3 fullstack, Tailwind CSS 4 |
| Code Graph | compliance-graph -- tree-sitter parsing, embeddings, RAG |
| MCP Server | compliance-mcp -- Model Context Protocol for AI tools |
| DAST | compliance-dast -- dynamic application security testing |
| Database | MongoDB with typed collections |
| LLM | LiteLLM (OpenAI-compatible API for chat, triage, embeddings) |
| Issue Trackers | GitHub (octocrab), GitLab (REST v4), Jira (REST v3), Gitea |
| CVE Sources | OSV.dev, NVD, SearXNG |
| Auth | Keycloak (OAuth2/PKCE, SSO) |
| Browser Automation | Chromium (headless, for pentesting and PDF generation) |
Getting Started
Prerequisites
- Rust 1.94+
- Dioxus CLI (
dx) - MongoDB
- Docker & Docker Compose (optional)
Optional External Tools
- Semgrep -- for SAST scanning
- Syft -- for SBOM generation
- cargo-audit -- for Rust dependency auditing
Setup
# Clone the repository
git clone <repo-url>
cd compliance-scanner
# Start MongoDB + SearXNG
docker compose up -d mongo searxng
# Configure environment
cp .env.example .env
# Edit .env with your LiteLLM, tracker tokens, and MongoDB settings
# Run the agent
cargo run -p compliance-agent
# Run the dashboard (separate terminal)
dx serve --features server --platform web
Docker Compose (Full Stack)
docker compose up -d
This starts MongoDB, SearXNG, the agent (port 3001), and the dashboard (port 8080).
Nightly scan regression
Every night CI scans the fixture corpus with the agent image built from main
and compares the results with the baselines in fixtures/nightly/baselines/
(.gitea/workflows/nightly.yml). The corpus is the demo targets
(fixtures/demo-targets/targets.json, seeded by the agent itself) plus the
nightly-only fixtures (fixtures/nightly/targets.json: CODESYS archives, a
ladder diagram, a live PLC endpoint, a corrupt archive), which the harness
onboards through the API. The real CODESYS sample is not committed; point
NIGHTLY_CODESYS_SAMPLE at it or its target is skipped. To run it against any
agent in dev mode (use a fresh database: a rescan of an unchanged repo skips
most stages, so it records less than a first scan):
NIGHTLY_AGENT_URL=http://localhost:3001 \
cargo test -p compliance-agent --test nightly -- --nocapture
After an intended change to scan results, re-bless with NIGHTLY_BLESS=1 (or
run the workflow by hand with "bless" ticked) and commit the baseline diff with
the change. The report lands in target/nightly/report.md.
REST API
The agent exposes a REST API on port 3001:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/health |
Health check |
GET |
/api/v1/stats/overview |
Summary statistics and trends |
GET |
/api/v1/targets |
List targets (Prüfobjekte), each with its newest scan run |
POST |
/api/v1/targets |
Create a target |
GET / PATCH / DELETE |
/api/v1/targets/{id} |
Read, update (name, type, artifacts, scan_config incl. issue_tracker) or delete a target |
POST |
/api/v1/targets/{id}/artifacts |
Add a git repository, URL or text artifact |
POST |
/api/v1/targets/{id}/artifacts/upload |
Upload a file artifact (multipart, up to 512 MiB) |
PUT |
/api/v1/targets/{id}/artifacts/{artifact_id}/archive-password |
Set the password of a password-protected archive |
POST |
/api/v1/targets/{id}/scan |
Trigger a manual scan |
GET |
/api/v1/targets/{id}/compliance |
CRA Annex I status of a target |
GET |
/api/v1/targets/{id}/evidence-pack |
Evidence pack (ZIP) |
POST |
/api/v1/targets/{id}/findings |
Add a finding from a manual test |
POST |
/api/v1/targets/{id}/findings/import |
Import SARIF 2.1.0 or ZAP JSON |
GET |
/api/v1/findings |
List findings (filterable) |
GET |
/api/v1/findings/{id} |
Get finding with code evidence |
PATCH |
/api/v1/findings/{id}/status |
Update finding status (with reason where required) |
PATCH |
/api/v1/findings/bulk-status |
Update the status of several findings |
GET |
/api/v1/sbom |
List dependencies |
GET |
/api/v1/sbom/export |
Export a target's SBOM (CycloneDX 1.5 or SPDX 2.3) |
GET |
/api/v1/issues |
List cross-tracker issues |
GET |
/api/v1/scan-runs |
Scan execution history |
GET |
/api/v1/graph/{repo_id} |
Code knowledge graph |
POST |
/api/v1/graph/{repo_id}/build |
Trigger graph build |
GET |
/api/v1/dast/targets |
List DAST targets |
POST |
/api/v1/dast/targets |
Add DAST target |
GET |
/api/v1/dast/findings |
List DAST findings |
POST |
/api/v1/chat/{repo_id} |
RAG-powered code chat |
POST |
/api/v1/help/chat |
Documentation-grounded help chat |
POST |
/api/v1/pentest/sessions |
Create pentest session |
POST |
/api/v1/pentest/sessions/{id}/export |
Export encrypted pentest report |
POST |
/webhook/{tenant_id}/github/{repo_id} |
GitHub webhook (HMAC-SHA256) |
POST |
/webhook/{tenant_id}/gitlab/{repo_id} |
GitLab webhook (token verify) |
POST |
/webhook/{tenant_id}/gitea/{repo_id} |
Gitea webhook |
Dashboard Pages
| Page | Description |
|---|---|
| Übersicht (Overview) | Figures, CRA status by target, most severe open findings; AI chat and MCP cards outside source-only deployments |
| Prüfobjekte (Targets) | Targets with last scan, CRA status and findings; Prüfung starten |
| Neues Prüfobjekt (Onboard) | Wizard: type, artifacts (git, zip/tar/tar.gz, PLC project, firmware image), review, first scan |
| Target page | CRA status, SBOM figures, open findings, scan runs, edit, evidence pack, manual findings |
| Findings | Filterable table by target, severity, type, status |
| Finding Detail | Code evidence, CRA refs, remediation, status with reason and history, linked issue |
| SBOM | Dependency inventory with vulnerability badges, license summary |
| Issues | Cross-tracker view (GitHub + GitLab + Jira + Gitea) |
| Code Graph | Interactive architecture visualization, impact analysis |
| AI Chat | RAG-powered Q&A about repository code |
| DAST | Dynamic scanning targets, findings, and scan history |
| Pentest | AI-driven pentest sessions, attack chain visualization |
| MCP Servers | Model Context Protocol server management (reached from the overview's MCP card; no sidebar entry) |
| Help Chat | Floating assistant (available on every page) for product Q&A |
Project Structure
compliance-scanner/
├── compliance-core/ Shared library (models, traits, config, errors)
├── compliance-agent/ Agent daemon (pipeline, LLM, trackers, API, webhooks)
│ └── src/
│ ├── pipeline/ 7-stage scan pipeline, dedup, PR reviews, code review
│ ├── llm/ LiteLLM client, triage, descriptions, fixes, review prompts
│ ├── trackers/ GitHub, GitLab, Jira, Gitea integrations
│ ├── pentest/ AI-driven pentest orchestrator, tools, reports
│ ├── rag/ RAG pipeline, chunking, embedding
│ ├── api/ REST API (Axum), help chat
│ └── webhooks/ GitHub, GitLab, Gitea webhook receivers
├── compliance-dashboard/ Dioxus fullstack dashboard
│ └── src/
│ ├── components/ Reusable UI (sidebar, help chat, attack chain, etc.)
│ ├── infrastructure/ Server functions, DB, config, auth
│ └── pages/ Full page views (overview, DAST, pentest, graph, etc.)
├── compliance-graph/ Code knowledge graph (tree-sitter, embeddings, RAG)
├── compliance-dast/ Dynamic application security testing
├── compliance-mcp/ Model Context Protocol server
├── docs/ VitePress documentation site
├── assets/ Static assets (CSS, icons)
└── styles/ Tailwind input stylesheet
External Services
| Service | Purpose | Default URL |
|---|---|---|
| MongoDB | Persistence | mongodb://localhost:27017 |
| LiteLLM | LLM proxy (chat, triage, embeddings) | http://localhost:4000 |
| SearXNG | CVE context search | http://localhost:8888 |
| Keycloak | Authentication (OAuth2/PKCE, SSO) | http://localhost:8080 |
| Semgrep | SAST scanning | CLI tool |
| Syft | SBOM generation | CLI tool |
| Chromium | Headless browser (pentesting, PDF) | Managed via Docker |
Built with Rust, Dioxus, and a commitment to automated security compliance.