Skip to content

How It Works

Saeed Yari edited this page Dec 1, 2026 · 1 revision

How It Works

Architecture

flowchart LR
    subgraph package["asvs-mcp: read-only, offline"]
        csv[("ASVS 5.0.0 CSV<br/>bundled, CC BY-SA 4.0")] --> asvs["asvs.py<br/>lookups + BM25 search"]
        map[("pci_dss_mapping.json<br/>IDs only")] --> pci["pci_dss.py<br/>PCI DSS mapping"]
        tools["server.py<br/>7 tools, 2 resources, 2 prompts"] --> asvs
        tools --> pci
        tools --> scanners["scanners/<br/>code, web headers + nginx,<br/>repository"]
        scanners --> asvs
        tools --> security["security.py<br/>input caps, masking,<br/>untrusted tags, audit log"]
    end
    client["MCP client"] <-- "stdio" --> tools
    client <-. "stdio, optional" .-> pcisrv["PCI DSS compliance<br/>assistant (separate server)"]
Loading

The bundled standard

  • Source: OWASP's official OWASP_Application_Security_Verification_Standard_5.0.0_en.csv from the OWASP/ASVS repository, tag v5.0.0_release.
  • Unmodified: a test checks its SHA-256, so the file in the package is byte for byte OWASP's. A few Markdown escapes in the official text (such as \__Host-) are cleaned up only when a requirement is displayed.
  • License: the file keeps its own license, CC BY-SA 4.0 (© OWASP Foundation). The rest of the project is Apache-2.0.
  • Levels: each requirement records the level where it first applies; level 2 includes level 1, and level 3 includes everything.

Search

search_asvs_requirements ranks requirements with BM25 over the requirement text and its section and chapter names, which count extra. Light stemming lets store, stored and storing match. Common acronyms that ASVS spells out (XSS, SQLi, SSTI, JWT, CSP, SRI, MFA, OTP, DoS, PII) are expanded with the words the standard uses; the expansion counts half, so it cannot outweigh what you typed. A query that is an ID puts that requirement and its children first.

The scanners

  • Code (scan_code_for_security_issues): a list of line-based rules, each with a regular expression, severity, ASVS ID, CWE, fixed description and remediation, and optionally the languages it applies to, a pattern that suppresses it and a context it needs. Cryptography, secrets, cookies and logging need more context and have their own checks.
  • Web (audit_http_security_headers): parses raw response headers, or collects the headers an nginx config adds and runs the same header checks, plus nginx-specific TLS, redirect, server_tokens and autoindex checks.
  • Repository (audit_directory): walks the folder, routes each file to the right scanner and groups the findings.

Every finding takes its ASVS level from the bundled standard and its PCI DSS IDs from the community mapping.

Security model

  • Read-only and offline. The server makes no file writes, network calls or subprocess calls; it reads the bundled data once at startup. A test fails if server code imports networking or subprocess modules or opens files for writing.
  • Input caps. Code, header and config inputs are limited to 500,000 characters, directory paths to 4,096, queries to 500, and other text parameters to 100.
  • No secrets in output. Every tool result passes through a sanitizer that masks card numbers (first 6 / last 4) and redacts well-known secret formats (AWS, GitHub, Stripe, Slack, Google keys, private key headers). The scanners also hide secret values they detect, and cookie values are never echoed.
  • Untrusted content is marked. Anything quoted from scanned input is wrapped in <scanned_artifact> tags, and tag look-alikes inside it are neutralized so the content cannot close the block. Finding descriptions and remediation text are fixed templates, and the server instructions tell the model to treat tagged content as data, never as instructions.
  • Directory audits stay inside the folder. audit_directory refuses the filesystem root, your home folder itself and system paths, skips every symlink, opens files with O_NOFOLLOW, skips .git, node_modules, virtualenvs, vendor, build output, binaries and files over 500 KB, and stops at max_files.

Configuration

Variable Effect
ASVS_MCP_AUDIT_LOG=1 Writes one metadata-only JSON line per tool call to stderr (tool, status, latency, input size, finding and result counts; never inputs or results)

Clone this wiki locally