{"slug": "show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust", "title": "Show HN: ShellMind-Guard – Multi-file security and concurrency verifier in Rust", "summary": "ShellMind Guard, a Rust-based open-source verifier released on Hacker News' Show HN, traces cross-file taint and guard invariants with an O(V + E) Guard-Set Lattice across 18 source languages and ecosystems, using 17 Tree-sitter AST grammars plus Move's structural parser and .sql schema analysis. The tool ships 177 cataloged verification rules, fingerprints 13,000+ files at over 1 GB/s with BLAKE3 and SQLite WAL while re-linking the global call graph in under 80 ms, and proves exploitability inside isolated cross-OS sandboxes (Linux bwrap, macOS sandbox-exec, Windows WSL2/Job Object) with zero AI API cost. Its author positions ShellMind Guard against regex/single-file SAST scanners and LLM-only code scanners, which it says burn tens of thousands of tokens per scan and cannot execute deterministic data-flow proofs.", "body_md": "**Deterministic Multi-File Security, Business-Logic, Concurrency & Frontier Domain Verifier**\n\n*Traces cross-file taint and guard invariants via an $O(V + E)$ Guard-Set Lattice across 18 source languages & ecosystems + SQL migrations (**17 Tree-sitter AST grammars**: TypeScript, JavaScript, Go, Python, Rust, PHP, Java, C#, Kotlin, Swift, Dart, C, C++, Ruby, Bash/Shell, Terraform/HCL, and Solidity—plus Move's structural parser and `.sql` schema analysis)—alongside isolated Hardware/Firmware (`smg-hw`), Web3 + `revm` Concrete Oracle (`smg-web3`), Post-Quantum Crypto-Agility (` smg-pqc`), and Confidential TEE (` smg-enterprise`) verification—then proves exploitability inside an isolated Cross-OS sandbox (`Linux bwrap`, `macOS sandbox-exec`, `Windows WSL2/Job Object`) with zero AI API cost.*\n\n[**Architecture**](#system-architecture) · [** Verification Engine (177 Rules)**](#the-6-layer-universal-verification-engine) · [** Frontier Domains**](#frontier-verification-domains-hw--web3--pqc--enterprise) · [** Benchmarks & Ground Truth**](#verified-performance-benchmarks--ground-truth-evidence) · [** Quickstart**](#quickstart) · [** CLI Reference (23 Commands)**](#cli-command-reference) · [** AI Agent MCP**](#model-context-protocol-shellmind-guard-mcp) · **Blueprint**\n\nModern software—especially high-velocity, AI-assisted full-stack codebases—suffers from vulnerabilities that span multiple files and execution layers: a route in `routes/checkout.ts` delegates to `services/ledger.ts`, which mutates a balance in `db/queries.ts` without an authentication middleware, ownership filter, or `SELECT ... FOR UPDATE` transaction lock.\n\nConventional security tools fail on these bugs in two predictable ways:\n\n1. **Regex / Single-File SAST Scanners** lack cross-file call-graph and middleware-order semantics, burying engineering teams under hundreds of false positives while missing multi-hop business-logic and race-condition flaws.\n2. **LLM-Only Code Scanners** burn tens of thousands of tokens per scan, hallucinate findings on sanitized paths, cannot execute deterministic data-flow proofs, and cannot verify whether a concurrency bug is actually exploitable at runtime.\n\n**ShellMind Guard** solves both problems with a deterministic, systems-engineered architecture:\n\n- \n**Two-Phase Incremental Ingestion (`BLAKE3` + `SQLite WAL`):** Fingerprints 13,000+ files at >1 GB/s, caching per-file` Tree-sitter` AST summaries in SQLite while**always re-linking the global cross-file call graph in RAM (<80 ms)** so edits to a shared middleware (`auth.ts` ) immediately invalidate downstream routes (`routes.ts` ).\n- \n$O(V + E)$ Guard-Set Lattice Solver:$O(V!)$ path enumeration—terminating in linear time even on cyclic enterprise call graphs.\n- \n**Universal 6-Layer + Cloud-Native Static & Taint Engine (`177` Cataloged Rules):** Covers hardcoded secrets, CORS/JWT/TLS/Dockerfile/Terraform/Kubernetes/CI-CD misconfigurations, offline lockfile advisories, cross-file SQL/Command/Path/SSRF/XSS/ZipSlip taint with sanitizer disproof, missing auth/PKCE/state-machine/transaction locks, IDOR missing ownership filters, and frontend-to-backend API/OpenAPI/GraphQL contract drift.\n- \n**Cross-OS Isolated Exploit Prover (`smg-sandbox`):** Boots your service inside an isolated OS sandbox (**Linux `bwrap` `--unshare-all`** ,**macOS `sandbox-exec` Seatbelt** , or**Windows WSL2 `bwrap` + Win32 Job Object** with optional`--sandbox-mem-mb`` RLIMIT_AS` /`--cgroup-v2` ,`--sandbox-tls` loopback`rustls` ,`--mock-shims` , fast`UNBOOTABLE` diagnostics, and process-group reaper) and fires barrier-synchronized**12-way Last-Byte Sync** concurrent HTTP/HTTPS bursts (`tokio::sync::Barrier` +`tokio::task::JoinSet` ) corroborated by JSON ledger state-anomaly proofs,`WireDiffProxy` TCP mutation counters, and`DbStateSnapshot` conservation diffs.\n- \n**Isolated Frontier Verification Domains (`hw` · `web3` · `pqc` · `enterprise`):** Zero-overhead on standard Web/AppSec repos—auto-activates`smg-hw` (`Tnum` /`SparseOctagon` /CMSIS-SVD/IRQ/Linker W^X) on firmware/kernel code and`smg-web3` (`tree-sitter-solidity` , Foundry/Hardhat, in-process**`revm` v43.0.3** concrete EVM oracle, Solana Anchor, Sui/Aptos Move) on Web3 repos, plus opt-in`smg-pqc` (Shor/Grover/BHT, Mosca HNDL, CycloneDX 1.5 Static CBOM) and`smg-enterprise` (remote Nitro/TDX/SEV-SNP TEE attestation & enclave admission control).\n- \n**Native Model Context Protocol (`shellmind-guard mcp`) Server:** Exposes deterministic, zero-token-overhead security verification over`stdio` JSON-RPC 2.0 for**Claude Code, Cursor, AntiGravity, Windsurf, OpenCode, and Z-Code** .\n\n```\nflowchart TD\n    subgraph Surfaces[\"Access Surfaces (smg / shellmind-guard — 23 Subcommands)\"]\n        C1[\"CLI & CI Merge Gate\\nsmg scan · replay · rules · explain · hook\"]\n        C2[\"60fps Interactive TUI\\nsmg ui · Proxy TUI (ratatui)\"]\n        C3[\"Read-Only MCP Server\\nsmg mcp (JSON-RPC 2.0 Stdio)\"]\n    end\n\n    subgraph Core[\"ShellMind Guard Core Engine (12 Rust Crates · 1T == 16T Deterministic)\"]\n        A1[\"Incremental Ingestion (smg-core)\\nWalkParallel · BLAKE3 · POSIX/NFC\"]\n        A2[\"Polyglot AST & Linker (smg-graph)\\n17 Tree-sitter Grammars · Move · SQL · HCL\"]\n        A3[\"Formal & Lattice Core (smg-graph::formal)\\nO(V+E) Guard Lattice · 2-CFA/SSA · CDCL · SMT\"]\n        A4[\"Frontier Domains (Zero-Overhead Routing)\\nsmg-hw · smg-web3 (revm) · smg-pqc · smg-enterprise\"]\n        DB[(\"SQLite WAL + SMG2 Cache\\nPostcard AST Blobs · Offline OSV DB\")]\n    end\n\n    subgraph Provers[\"Runtime Provers, Live Lab & Actionable Outputs\"]\n        P1[\"Cross-OS Exploit Prover (smg-sandbox)\\nLinux bwrap · macOS Seatbelt · Win WSL2/Job\"]\n        P2[\"Live Lab & Dynamic Suite (smg-dynamic)\\nSafeHttpClient · DAST · SQLi · Nuclei · MITM · TLS · OCI\"]\n        P3[\"Reports & Auto-Patcher (smg-report · smg-ai)\\nSARIF 2.1.0 · CycloneDX/OpenVEX · HTML · CEGIS\"]\n    end\n\n    C1 & C2 & C3 --> A1\n    A1 --> DB\n    A1 --> A2 --> A3\n    A2 --> A4\n    A3 & A4 -->|\"Static Findings\"| P3\n    A3 -->|\"--boot-cmd / replay\"| P1\n    C1 -->|\"Live Lab / OCI\"| P2\n    P1 & P2 -->|\"PROVEN / MITIGATED\"| P3\n```\n\nInside the core engine, every parsed file is lowered once into a bounded CFG & symbol summary and dispatched across three parallel formal verification engines before priority-ranked deduplication:\n\n```\nflowchart LR\n    SRC[\"Source & Specs\\n17 ASTs · Move · SQL\\nSVD · .ld · Foundry\"] --> PARSE[\"Single-Pass CST & Arena\\nDepth-Capped Walk\\nCross-File Import Linker\"]\n\n    PARSE --> E_TAINT[\"1. Guard Lattice & Taint\\nMonotone Worklist O(V+E)\\nDominator Guards · 2-CFA/SSA\"]\n    PARSE --> E_MEM[\"2. Typestate & Abstract Math\\nAlloc/Free/UAF · Pointer Alias\\nTnum · Octagon · CDCL/SMT\"]\n    PARSE --> E_CONC[\"3. Concurrency & Lock Graph\\nGo Struct Mutex · Rust .await\\nISR vs Task ABBA Deadlocks\"]\n\n    E_TAINT & E_MEM & E_CONC --> DEDUP[\"Canonical Family Deduplicator\\nProven > Confirmed > Heuristic\"]\n    DEDUP --> STATIC_OUT[\"Verified Static Findings\\nShortest Unguarded Witness\"]\n```\n\nWhen `--boot-cmd` or `smg replay` is invoked on a concurrency finding (`SMG-RACE-001`), `smg-sandbox` never relies on raw `HTTP 200` counts alone—it aligns final request bytes on an in-process barrier and cross-checks three state oracles:\n\n```\nsequenceDiagram\n    participant CLI as smg-sandbox Prover\n    participant BAR as tokio::sync::Barrier (12x)\n    participant APP as Sandboxed App (bwrap / Seatbelt / WSL2)\n    participant ORA as WireDiffProxy & State Oracles\n\n    CLI->>APP: Boot service inside isolated net/fs namespace + optional WireDiffProxy\n    par 12 Concurrent Workers\n        CLI->>APP: Connect & write HTTP/1.1 request prefix (N - 1 bytes, holding final byte)\n        CLI->>BAR: bar.wait() until all 12 TCP sockets are primed\n    end\n    BAR-->>CLI: Simultaneous release\n    CLI->>APP: Flush final 1 byte ('}') across all 12 sockets in microsecond window\n    APP->>ORA: Concurrent DB/Redis writes (UPDATE / INSERT / DECR)\n    APP-->>CLI: 12 HTTP responses (status codes + JSON ledger bodies)\n    CLI->>ORA: Evaluate 3 Oracles (Ledger Post-State + WireDiffProxy + DbStateSnapshot)\n    Note over CLI,ORA: Overdraft (<0) or Lost Update (12x amount=80 -> same balance=10) => Sandbox: PROVEN\n    Note over CLI,ORA: Distinct arithmetic steps (920..40, min >= 0) => SerializedSolvent (SuspectUnverified)\n    Note over CLI,ORA: 1x 200 OK + 11x 409/429 Lock Rejections => Sandbox: MITIGATED\n```\n\nInstead of enumerating all simple paths between routes and sinks (which degrades to \n\n1. \n**Initialization:** Entry route nodes are initialized with their route-registration and router-level middleware guards; interior nodes start at top ($\\top = \\mathcal{U}$ ).\n2. \n**Fixed-Point Convergence:** A worklist algorithm propagates guard sets in$O(V + E)$ time. Because$\\mathcal{U}$ is finite and intersection is monotone, convergence is guaranteed on arbitrary cyclic graphs.\n3. \n**Shortest Witness Extraction:** When a reachable sink$s$ requires guard$g \\notin \\mathcal{G}_{\\text{out}}(s)$ , a guard-avoiding multi-source BFS reconstructs the shortest unguarded witness chain$(r \\to f_1 \\to \\dots \\to s)$ in$O(V + E)$ time.\n\nShellMind Guard keeps **static confidence tiers** (`Confidence` enum) strictly distinct from **runtime sandbox verification status** (`VerificationStatus` enum) so static mathematical proofs are never conflated with live HTTP exploit execution:\n\n| Field / Badge | Value | Engine Origin | Exact Meaning & Required Evidence | \n|---|---|---|---|\n| **Runtime Status**( `--boot-cmd` /`smg replay` ) | **`Sandbox: PROVEN`**( `VerificationStatus::Proven` ) | `smg-sandbox` | Target service was booted inside an isolated OS sandbox and a live HTTP/HTTPS exploit probe succeeded (e.g. unauthenticated `200` mutation, cross-tenant User B IDOR read, or concurrent race violating ledger/wire/DB invariants). | \n| **Runtime Status** | **`Sandbox: MITIGATED`**( `VerificationStatus::Mitigated` ) | `smg-sandbox` | Live sandbox probe was deterministically blocked by runtime controls ( `401` /`403` auth gate,`409` /`429` lock/idempotency rejection). | \n| **Static Confidence**( `smg scan` , no server booted) | **`Confidence::Proven`***(Static-Proven / Bytecode-Proven)* | `smg-hw` ,`smg-web3` ,`smg-graph` | Defect is proven mathematically or via in-process bytecode execution without booting an HTTP server: e.g. `Tnum` /`SparseOctagon` /SVD register OOB & cyclic stack proofs (`349 Static-Proven` on`zephyr` ),`revm` concrete EVM exploit execution, Trojan-Source`CVE-2021-42574` Bidi overrides, or malicious binary Pickle`REDUCE` opcodes. | \n| **Static Confidence** | **`Confidence::Confirmed`** | `smg-graph` ,`smg-web3` | Complete cross-file AST + Guard-Set Lattice witness path from an entry point to a sink with no dominating guard or matching sanitizer bit. | \n| **Static Confidence** | **`Confidence::Heuristic`** | All static crates | Intra-procedural or pattern-level risk lacking full caller/environment certainty (filterable via `--min-confidence confirmed` ). | \n\nEvery rule ID below maps 1-to-1 to [`RULE_CATALOG`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-graph/src/rules.rs) (`177` built-in rules, CI-enforced against drift via [`tests/readme_catalog_sync.rs`](https://github.com/qira-dev/ShellMind-Guard/blob/main/tests/readme_catalog_sync.rs); inspect any rule offline with `smg explain <RULE_ID>`):\n\n| Layer / `--layers` Filter | Canonical `RULE_CATALOG` IDs | Severity | Category & Invariant Checked | Required Guard / Sanitizer Disproof | \n|---|---|---|---|---|\n| **1**`secrets` | `SMG-SEC-APIKEY` ,`SMG-SEC-AWS` ,`SMG-SEC-STRIPE` ,`SMG-SEC-GITHUB` ,`SMG-SEC-OPENAI` ,`SMG-SEC-ANTHROPIC` ,`SMG-SEC-GCP` ,`SMG-SEC-GOOGLE` ,`SMG-SEC-SLACK` ,`SMG-SEC-JWT` ,`SMG-SEC-KEY` ,`SMG-SEC-DBURI` ,`SMG-SEC-CLIENT-ENV` ,`SMG-SEC-ENTROPY` ,`SMG-SEC-CUSTOM` ,`SMG-SEC-ENV` | `CRITICAL`` HIGH` | **Secrets, Private Keys & `.env` Exposure:** Provider-prefixed tokens (working tree +`--git-history` + opt-in`--verify-live` ), hardcoded JWT tokens (`SMG-SEC-JWT` ), PEM/SSH/PGP/Age private key blocks (`SMG-SEC-KEY` ), credentials in DB URLs (`SMG-SEC-DBURI` ), secrets bundled via`NEXT_PUBLIC_*` /`VITE_*` (`SMG-SEC-CLIENT-ENV` ), Shannon entropy (`.gitleaks.toml` rules (`SMG-SEC-CUSTOM` ), and unignored`.env` files (`SMG-SEC-ENV` ). | Excluded on lockfiles, test fixtures, dev/sample certs ( `devenv/` ,`localhost*.key` ), placeholders (`EXAMPLE` ,`YOUR_API_KEY` ), and`.gitignore` -covered`.env` files. | \n| **1**`config` | `SMG-CFG-CORS` ,`SMG-CFG-JWT-LOGIC` ,`SMG-CFG-TLS` ,`SMG-CFG-CRYPTO` ,`SMG-CFG-DEBUG` ,`SMG-CFG-COOKIE` ,`SMG-CFG-HTTP-HOST` ,`SMG-CFG-SMUGGLE` ,`SMG-CFG-DOCKER` ,`SMG-CFG-PROTO` ,`SMG-CFG-XXE` ,`SMG-CFG-SQL-EXEC` ,`SMG-CFG-SQL-SEARCHPATH` ,`SMG-CFG-SQL-RLS` ,`SMG-CFG-SQL-PRIV` ,`SMG-CFG-IAC-PUBLIC` ,`SMG-CFG-IAC-NET` ,`SMG-CFG-IAC-CRYPTO` ,`SMG-CFG-IAC-IAM` ,`SMG-CFG-IAC-LOG` ,`SMG-CFG-IAC-IPC` | `CRITICAL`` HIGH``MEDIUM` | **App Config, Cloud IaC (`Terraform/HCL`) & `.sql` Policies:** Wildcard CORS + credentials, unverified`jwt.decode` /`alg: \"none\"` , disabled TLS, weak config crypto,`DEBUG=True` , insecure cookies,`ALLOWED_HOSTS=['*']` , proxy header smuggling, privileged`Dockerfile` , prototype pollution, XXE,`.sql` migration hazards (`EXECUTE format` ,`SECURITY DEFINER` , disabled RLS,`SUPERUSER` ), and 78 AWS/GCP/Azure HCL IaC policies (`SMG-CFG-IAC-*` ). | Restrict origins/hosts/CIDRs, verify JWT signatures, enable KMS/TLS 1.2+/audit logging, disable XXE DTDs, enforce S3 public-access blocks, and harden `.sql` procedures. | \n| **2**`deps` | `SMG-DEP-001` ,`SMG-DEP-PROVEN` ,`SMG-DEP-SAFEAPI` | `CRITICAL`` HIGH``LOW` | **Offline Lockfile & Call-Graph Reachability Audit:** Parses`package.json` ,`package-lock.json` ,`Cargo.toml` ,`Cargo.lock` ,`go.mod` ,`requirements.txt` ,`pyproject.toml` ,`poetry.lock` , and`uv.lock` against embedded advisories and local SQLite OSV cache (`smg deps sync` ), upgrading imported vulnerable symbols to`SMG-DEP-PROVEN` and downgrading unreferenced symbols to`SMG-DEP-SAFEAPI` (with`--openvex` export). | Pin semver ranges, upgrade vulnerable packages, and export reachability-backed VEX ( `--openvex` ). | \n| **3**`sqli` ·`xss` ·`cmdi` ·`path` ·`ssrf` | `SMG-SQLI-001` ,`SMG-SQLI-NOSQL` ,`SMG-SQLI-MASS` ,`SMG-XSS-001` ,`SMG-CMDI-001` ,`SMG-CMDI-SSTI` ,`SMG-CMDI-DESER` ,`SMG-PATH-001` ,`SMG-SSRF-001` ,`SMG-SSRF-REDIRECT` ,`SMG-REDIRECT-001` | `CRITICAL`` HIGH` | **Cross-File Sink-Typed Taint Engine:** Tracks untrusted input across imports, struct fields, and closures into SQL/NoSQL/ORM mass assignment, HTML/DOM XSS, OS shell / SSTI /`pickle` /`yaml` /`ObjectInputStream` deserialization, filesystem path traversal, and server-side HTTP SSRF / open redirects. | Sink-matched sanitizer disproof: parameterized SQL ( `$1` /`?` ),`DOMPurify` /`ammonia` /`html.escape` , argv-array`Command` without shell,`yaml.safe_load` ,`filepath.Clean` + prefix check, and CIDR/host allowlists. | \n| **4**`auth` ·`csrf` ·`idor` ·`oauth` ·`state` | `SMG-AUTH-001` ,`SMG-CSRF-001` ,`SMG-IDOR-001` ,`SMG-AUTH-PKCE` ,`SMG-OAUTH-001` ,`SMG-STATE-001` | `HIGH` | **Authentication, Tenant Ownership, OAuth2 & State Machines:** Missing`Auth` middleware on privileged mutations (`SMG-AUTH-001` ), cookie endpoints without CSRF protection (`SMG-CSRF-001` ), resource lookups missing caller ownership predicates (`SMG-IDOR-001` ), OAuth2 flows missing PKCE/`state` /pinned`redirect_uri` (`SMG-AUTH-PKCE` ,`SMG-OAUTH-001` ), and fulfillment/payout transitions skipping prior-state checks (`SMG-STATE-001` ). | Dominating auth guards, `SameSite` /CSRF tokens,`owner_id = current_user.id` scoping, S256 PKCE +`state` binding, and explicit prior-state`WHERE status = ...` guards. | \n| **5**`race` ·`engine` ·`memory` | `SMG-RACE-001` ,`SMG-ENG-DEADLOCK` ,`SMG-CONC-DEADLOCK` ,`SMG-ENG-LEAK` ,`SMG-MEM-BOUNDS` ,`SMG-ENG-INT` | `CRITICAL`` HIGH` | **Concurrency, Deadlocks, Resource Leaks & Native Memory Safety:** Non-atomic balance/inventory updates (`SMG-RACE-001` ), cross-function`A->B / B->A` lock inversions (`SMG-ENG-DEADLOCK` ), sync`Mutex` /`RwLock` held across`.await` (`SMG-CONC-DEADLOCK` ), leaked file/socket/DB handles on early error returns (`SMG-ENG-LEAK` ), C/C++/Rust`unsafe` buffer/UAF/uninit UB (`SMG-MEM-BOUNDS` ), and allocation`a * b` integer overflow (`SMG-ENG-INT` ). | ACID `withTransaction` /`SELECT ... FOR UPDATE` , canonical lock order, drop sync guards before`.await` , RAII/`defer` , and checked bounds/arithmetic. | \n| **6**`frontend` ·`api` ·`smuggle` | `SMG-FE-404` ,`SMG-FE-ERR` ,`SMG-FE-STORAGE` ,`SMG-FE-MSG` ,`SMG-FE-TABNAB` ,`SMG-API-001` ,`SMG-OAPI-INSECURE-SERVER` ,`SMG-OAPI-NO-AUTH-SCHEME` ,`SMG-OAPI-BASIC-AUTH` ,`SMG-OAPI-APIKEY-QUERY` ,`SMG-GQL-NO-QUERY-ROOT` ,`SMG-GQL-SENSITIVE-FIELD` ,`SMG-GQL-DEBUG-FIELD` ,`SMG-GQL-INTROSPECTION` ,`SMG-HTTP-SMUGGLE` | `HIGH`` MEDIUM``LOW` | **Frontend ↔ Backend Contracts, OpenAPI/GraphQL & HTTP Framing:** Frontend calls to non-existent backend routes (`SMG-FE-404` ), swallowed rejections (`SMG-FE-ERR` ), token storage in`localStorage` (`SMG-FE-STORAGE` ), unverified`postMessage` (`SMG-FE-MSG` ),`target=\"_blank\"` tabnabbing (`SMG-FE-TABNAB` ), OpenAPI/GraphQL/WebSocket security posture (`SMG-API-001` ,`SMG-OAPI-*` ,`SMG-GQL-*` ), and CRLF/Host smuggling (`SMG-HTTP-SMUGGLE` ). | Align route contracts, store auth in `httpOnly` cookies, verify`event.origin` , disable prod GraphQL introspection, require bearer OAuth schemes, and strip CRLF/untrusted`Host` . | \n| **Cloud & Runtime**`cicd` ·`k8s` ·`dos` ·`zip` ·`crypto` ·`queue` | `SMG-CICD-001` ,`SMG-CICD-002` ,`SMG-K8S-001` ,`SMG-K8S-002` ,`SMG-DOS-001` ,`SMG-ZIP-001` ,`SMG-CRYPTO-001` ,`SMG-QUEUE-001` | `CRITICAL`` HIGH` | **CI/CD Workflows, Kubernetes, Archive, Crypto & Queue Hygiene:** GitHub Actions`pull_request_target` expression injection &`write-all` /unpinned actions (`SMG-CICD-*` ), privileged/`hostPID` pods & wildcard RBAC (`SMG-K8S-*` ), exponential ReDoS regexes (`SMG-DOS-001` ), ZipSlip archive extraction (`SMG-ZIP-001` ),`AES-ECB` /static IV/non-constant-time MACs (`SMG-CRYPTO-001` ), and async queue consumers dropping tenant/auth context (`SMG-QUEUE-001` ). | Pin Actions by SHA with minimal permissions, drop pod capabilities, bound regexes, canonicalize archive paths, use AEAD + `subtle::ConstantTimeEq` , and re-verify tenant context in workers. | \n| **Mobile**`mobile` | `SMG-MOB-STORAGE` ,`SMG-MOB-IPC` ,`SMG-MOB-TLS` | `CRITICAL`` HIGH` | **Auto-Routed Mobile Security (`Android`/` iOS`/` Flutter`):** Activated when` AndroidManifest.xml` ,`Info.plist` , or`pubspec.yaml` exist: plaintext`SharedPreferences` /`UserDefaults` /`Hive` secrets (`SMG-MOB-STORAGE` ), exported permissionless Android components / mutable`PendingIntent` / WebView bridges (`SMG-MOB-IPC` ), and trust-all TLS / cleartext ATS bypasses (`SMG-MOB-TLS` ). | Use `EncryptedSharedPreferences` /Keychain/`FlutterSecureStorage` , set`android:exported=\"false\"` , and enforce strict TLS validation. | \n| **Deep & Live DAST**`deep` (`--deep` )`dast` (`smg dast` ) | `SMG-FUZZ-SCHEMA` ,`SMG-FUZZ-TAMPER` ,`SMG-FUZZ-CRASH` ,`SMG-FUZZ-ENCODING` ,`SMG-SANDBOX-UNBOOTABLE` ,`SMG-BOOT-001` ,`SMG-DAST-SQLI` ,`SMG-DAST-XSS` ,`SMG-DAST-CMDI` ,`SMG-DAST-SSTI` ,`SMG-DAST-LFI` ,`SMG-DAST-REDIRECT` ,`SMG-DAST-CORS` ,`SMG-DAST-COOKIE` ,`SMG-DAST-CSP` ,`SMG-DAST-HSTS` ,`SMG-DAST-CLICKJACK` ,`SMG-DAST-NOSNIFF` ,`SMG-DAST-REFERRER` ,`SMG-DAST-PERMS` ,`SMG-DAST-CACHE` ,`SMG-DAST-POWERED` ,`SMG-DAST-SERVER-LEAK` ,`SMG-DAST-DOMXSS-SRC-SINK` ,`SMG-DAST-GRAPHQL-INTROSPECTION` | `CRITICAL`` HIGH``MEDIUM`` LOW``INFO` | **Schema Fuzzing & Headless Chrome Live DAST (`--spa`):** Static/OpenAPI numeric schema validation (` SMG-FUZZ-SCHEMA` ), sandbox negative/zero/5xx/UTF-8 fuzzing (`SMG-FUZZ-*` ), and non-destructive live DAST + headless Chrome CDP DOM source-to-sink auditing (`SMG-DAST-*` ). | Enforce positive finite numeric schemas ( `gt=0` ), reject malformed payloads with`400/422` , and harden CSP/HSTS/cookie/CORS headers. | \n\nBuilt as isolated, feature-gated workspace crates (`default = [\"hw\", \"web3\", \"pqc\", \"enterprise\"]`) with **zero latency overhead** on standard Web/AppSec repositories:\n\n| Crate / Flag | Canonical `RULE_CATALOG` IDs | Severity | Mathematical / Execution Engine | Required Guard / Proof Tier | \n|---|---|---|---|---|\n| **`smg-hw`**`--layers hw` | `SMG-HW-MMIO` ,`SMG-HW-BOUNDS` ,`SMG-HW-TOCTOU` ,`SMG-HW-IRQ` ,`SMG-HW-TYPESTATE` ,`SMG-HW-BOOT` ,`SMG-HW-CT` ,`SMG-HW-SECRETS` ,`SMG-HW-STACK` ,`SMG-HW-DMA` ,`SMG-HW-LINKER` | `CRITICAL`` HIGH``MEDIUM` | **Hardware, Firmware & Kernel Verification:** Parses`compile_commands.json` , CMSIS-SVD peripherals (`derivedFrom` ,`<addressBlock>` ), and GNU`.ld` linker memory regions (`SMG-HW-LINKER` W^X`rwx` &`SMG-HW-STACK` overlap/WCSD); runs width-masked`Tnum` &`WrappedInterval` (`i128`` SparseOctagon` (`SMG-HW-DMA` ), alloc/free typestate, and cross-function ISR/ABBA lock checks. | Enforces Flash/SRAM W^X separation, bounded task+ISR stack budgets, D-Cache clean/invalidate around DMA, dominating boot signature + anti-rollback gates, `spin_lock_irqsave` , and key zeroization. | \n| **`smg-web3`**`--layers web3` | `SMG-WEB3-REENTRANCY` ,`SMG-WEB3-STORAGE` ,`SMG-WEB3-ACCESS` ,`SMG-WEB3-ROUNDING` ,`SMG-WEB3-ORACLE` ,`SMG-WEB3-SPOT-ORACLE` ,`SMG-WEB3-ORACLE-STALE` ,`SMG-WEB3-ERC4626-INFLATION` ,`SMG-WEB3-UUPS-UNINIT` ,`SMG-WEB3-IMPL-SELFDESTRUCT` ,`SMG-WEB3-FLASHLOAN-AUTH` ,`SMG-WEB3-DIAMOND-CLASH` ,`SMG-WEB3-REPLAY` ,`SMG-WEB3-SOLANA` ,`SMG-SOL-INIT-IF-NEEDED` ,`SMG-SOL-PDA-NONCANONICAL` ,`SMG-SOL-ARBITRARY-CPI` ,`SMG-WEB3-MOVE` ,`SMG-MOVE-ABILITY-LEAK` ,`SMG-MOVE-SHARED-CAP` ,`SMG-MOVE-ENTRY-NO-AUTH` | `CRITICAL`` HIGH` | **Web3, DeFi, Solana & Move Verification:**`tree-sitter-solidity` CST + Foundry (`out/*.json` ) / Hardhat ingestion; EIP-1967/ERC-7201/EIP-2535 Diamond slot & selector algebra; 5-tuple CEI + read-only reentrancy; ERC-4626 inflation & Chainlink/AMM spot oracle checks;**in-process `revm` v43.0.3 concrete EVM bytecode oracle** ;`Context<T>` -scoped Solana Anchor CPI/PDA checks; and Sui/Aptos Move ability & capability witness checks. | Upgrades verified EVM reentrancy/unauth-init exploits to **`Confidence::Proven`** via` revm` ; enforces`_disableInitializers()` , TWAP/freshness checks, pinned Solana CPI program IDs, canonical PDA bumps, and Move`&AdminCap` guards. | \n| **`smg-pqc`**`--compliance pqc``--cbom <FILE>`` smg tls` | `SMG-PQC-HNDL` ,`SMG-PQC-SHOR` ,`SMG-PQC-GROVER` ,`SMG-PQC-HYBRID` ,`SMG-PQC-DOWNGRADE` ,`SMG-PQC-PARAMS` ,`SMG-X509-WEAK-SIG` ,`SMG-X509-EXPIRED` ,`SMG-X509-NO-SAN` ,`SMG-ELF-BROKEN-CRYPTO` ,`SMG-ELF-QUANTUM-VULN` ,`SMG-TLS-WEAK-CIPHER` ,`SMG-TLS-PQC-READY` ,`SMG-TLS-HSTS` ,`SMG-TLS-LEGACY` ,`SMG-TLS-CERT-EXPIRED` ,`SMG-TLS-CERT-NOT-YET-VALID` ,`SMG-TLS-CERT-HOSTNAME` ,`SMG-TLS-CERT-UNTRUSTED` ,`SMG-TLS-CERT-INVALID` | `CRITICAL`` HIGH``MEDIUM`` INFO` | **Post-Quantum Crypto-Agility, X.509/ELF & Live TLS/STARTTLS:** Evaluates Shor zeroing (`.der` certs, live TLS leaf X.509 certificates (`expired` /`self-signed` /`hostname mismatch` ),`.elf` /`.so` crypto symbols, and live TLS/STARTTLS (`X25519MLKEM768` ); and emits**CycloneDX 1.5 Static CBOM** (`runtimeUnobserved: true` ). | Migrates KEX to `X25519MLKEM768` /`ML-KEM-768+` , signatures to`ML-DSA-65+` /`SLH-DSA` , symmetric ciphers to AES-256 / SHA-384+, renews invalid/expired X.509 certs, and disables SSLv3/TLS 1.0/1.1. | \n| **`smg-enterprise`**` smg enterprise ...``smg verify-attestation` | `status` ,`verify-attestation` ,`verify-license` ,`remote-scan`*(CLI subcommands, not static rules)* | Fail-Closed | **Confidential Compute TEE Attestation, Merkle Audit Log & Remote Enclave Auth:** Hardware TEE quote verification (`Intel TDX v4` ,`AMD SEV-SNP` ,`AWS Nitro COSE_Sign1` ), append-only BLAKE3`MerkleAuditLog` ( | Fails closed on debug-enabled enclaves ( `TD_ATTR_DEBUG` /`DEBUG` ), unpinned PCR0/MRTD measurements, expired/unverified enclave tokens, or non-HTTPS remote endpoints. | \n| **AI / LLM / MCP & Model Security**`--layers ai``--deep-audit` | `SMG-AI-001` ,`SMG-AI-INDIRECT-PROMPT-INJ` ,`SMG-AI-LLM-TO-TOOL-RCE` ,`SMG-MCP-TOOL-POISONING` ,`SMG-MCP-UNICODE-STEGO` ,`SMG-MCP-UNSAFE-STDIO` ,`SMG-AI-TORCH-PICKLE` ,`SMG-AI-PICKLE-RCE` ,`SMG-AI-PICKLE-MALICIOUS-OPCODE` ,`SMG-AI-CHAT-TEMPLATE-SSTI` ,`SMG-AI-REMOTE-CODE` | `CRITICAL`` HIGH` | **AI Agent, MCP & ML Supply-Chain Engine:** Indirect Prompt Injection taint graph (`RAG/Web/Email -> Prompt -> LLM -> Tool/Exec` ), MCP tool-poisoning & Trojan-Source Bidi / Unicode Tag steganography (`U+200B` ,`U+202A..U+202E` ,`U+2066..U+2069` ,`U+E0000..U+E007F` ), pure-Rust binary Pickle opcode inspection (`.pkl` /`.pt` /`.pth` + 64 KiB ZIP EOCD), and Jinja2`chat_template` SSTI inspection. | Enforces data spotlighting/sanitizers, pinned MCP tool schemas, `weights_only=True` /`safetensors` , and sandboxed Jinja2 environments. | \n\n**Why does an Apache-2.0 open-source repository include `smg enterprise verify-license`?**\n\n**Zero local features are license-gated.** Every static rule (`177/177`), frontier crate (` hw`, `web3`, `pqc`), sandbox prover, DAST/SQLi/MITM proxy tool, CBOM/OpenVEX exporter, TUI, and MCP server runs 100% locally and unencumbered under Apache-2.0 with **no license check, no telemetry, and no network call**. The Ed25519 token verifier in [`crates/smg-enterprise/src/license.rs`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-enterprise/src/license.rs) is a **server-side admission-control primitive** for organizations operating their own multi-tenant **remote Confidential Compute TEE Enclave (`smg enterprise remote-scan`)**, allowing the enclave host (where code cannot be modified by untrusted callers) to verify caller authorization and client binary `BLAKE3` measurements before allocating enclave compute.\n\n- \n**Live TLS X.509 Validation & DAST Precision (`smg-dynamic`):** Added pure-Rust` rustls` +`rustls-native-certs` leaf X.509 certificate validation (`SMG-TLS-CERT-EXPIRED` ,`SMG-TLS-CERT-NOT-YET-VALID` ,`SMG-TLS-CERT-HOSTNAME` ,`SMG-TLS-CERT-UNTRUSTED` ,`SMG-TLS-CERT-INVALID` — live-verified on BadSSL & Cloudflare RFC 10024`X25519MLKEM768` ), upgraded`SMG-DAST-SSTI` to double-verified 8-digit arithmetic probes (`${7331*1919}` /`${7333*1913}` ), deduplicated site-wide passive headers per origin, and added`/api/openapi.json` &`/ui/openapi.json` discovery.\n- \n**High-Volume Web, Web3, Systems, Firmware & Hygiene Precision (`smg-graph`, `smg-web3`, `smg-hw`, `smg-core`):** Resolved 82 deduplicated Wave-2 gaps across WordPress PHP XSS, Rails`null_session` /ActiveRecord/`DB.exec` , JS/TS`RegExp.exec()` /React nonce scripts/linear ReDoS, Go/Python/C#/Java SAST, Solidity/Solana`token_interface` /Sui Move`has key, store` capabilities, Go/Rust/C++/Python/Dart concurrency & handle-leak isolation, C/C++ UAF/double-free & firmware full-member`free(h->field)` /`kfree` +`continue` typestate, Android mobile, and secrets/crypto/AI/deps docstring & fixture hygiene, while enforcing`512 KB` monolithic AST/HW caps.\n- \n**Prior `v1.6.0`–` v1.8.3` Milestones:** Completed the 150-repository Wave 1 real-world audit (`v1.6.0` –`v1.8.3` ), adding multi-language SAST/Web3/AI/firmware precision batches, cross-OS CI stability fixes, and verified Before/After telemetry on`vllm` ,`aptos-core` ,`open-webui` ,`smartbugs` , and`railsgoat` (see[`CHANGELOG.md`](https://github.com/qira-dev/ShellMind-Guard/blob/main/CHANGELOG.md) for per-release details).\n\n### New in `v1.5.5` — 10-Repo Real-World Scalability (>100x Faster `smg-hw`), Precision & Security Hardening\n\n- \n**72k-File Embedded & Monorepo Scalability (`zephyr` `>24m47s` → `2m21s`, `smg-hw` `14.94s`):** Eliminated eager`#define` macro map cloning per function and per branch in`smg-hw` (`typestate_irq.rs` , lazy`lookup_const_define` , deterministic sorted`compile_unit_suffix_index` ,`65,536` -entry define cap), replaced the$O(N^2)$ ABBA lock-pair loop with an$O(P)$ hash index, upgraded`compute_wcsd_for_target` to depth-valid memoization (`min_valid_depth` +`500k` step budget) with file-scoped resolution and single-pass Tree-sitter reuse, wired`cfg.scan.max_threads` into`smg-hw` , filtered non-embedded`.ld` scripts and generic desktop tokens (`compile_commands.json` /`read_volatile` /`mmio` ), added$O(N)$ pre-gates in`ai_mcp_model.rs` and$O(1)$ bounds tracking in`memory.rs` , and introduced`--profile-phases` /`SMG_PROFILE_PHASES=1` timing telemetry.\n- \n**Web3, Secrets & AI Precision Without Recall Loss:** Added canonical defect-family deduplication in`smg-web3` (`0` same-line`SMG-WEB3-SOLANA` +`SMG-SOL-ARBITRARY-CPI` duplicates on`wormhole` , scan time`55.55s` →`29.29s` ), Anchor PDA/pinned-address & hardcoded CPI program-ID recognition, and Sui/Aptos Move`public(package)` /`public(friend)` + capability witness handling; calibrated test/dev/sample`SMG-SEC-KEY` paths (`devenv/` ,`demos/` ,`samples/` ,`localhost*.key` /`.pem` ) while preserving`OWASP/crAPI`` 30/30` tracked baseline findings (`SQLI=1` ,`AUTH=16` ,`JWT=7` ,`SEC_KEY=6` ); scoped`Language::Config` away from Python deserialization checks (`.pre-commit-config.yaml` =`0` ), required loader context for`trust_remote_code=True` , and calibrated`benchmarks/` /`examples/` AI findings while keeping runtime`torch.load` (`vllm/model_executor/.../weight_utils.py` ) at`CRITICAL / Confirmed` .\n- \n**Go Concurrency, Trojan-Source (`CVE-2021-42574`), Sandbox Ledger Proof & Catalog Sync:** Qualified Go struct receiver locks via`enclosing_type` , package-scoped cross-file Go deadlock cycles, ignored`RLock -> RLock` pairs, and made early-return`Unlock()` brace-aware; closed Trojan-Source Bidi bypasses with standalone 1-char constant scrubbing and ordered isolate depth (`iso_depth` underflow/balance checks); added JSON ledger lost-update/overdraft vs serialized-solvent discrimination in`smg-sandbox` ; and enforced CI drift parity across`RULE_CATALOG` (`172` rules), CLI subcommands, and`README.md` .\n\n- **Static Engine, SMT & Memory Typestate Precision:** Bounded all remaining recursive AST walkers across 8 languages +`ast.rs` , upgraded`filter_dominating_body_guards` to structural Tree-sitter AST dominance (with`if` /`else` intersection, negated-exit promotion, and brace-free Ruby support), fixed`mem_typestate.rs`` free(p); p = p->next;` RHS-before-rebind UAF +`#ifdef` Tree-sitter function isolation + single-line Rust mutex drops, wired`FieldSensitivePointsTo` &`KCfaContextTable` , enforced pre-sink`OwnershipCheck` /`CsrfProtection` , added monotonic`SymbolArena` overflow IDs, priority-ranked deduplication, sort-disambiguated SMT-LIB2 declarations, and`&mut x` /mutating-method SMT invalidation.\n- **Secrets, OpenVEX, Large Pickle ZIP EOCD & Multi-File IaC:** Wired working-tree`GitleaksConfig` custom rules +`trust_repo_config` -gated allowlists, wired`AutoVexSymbolIndex` into`--openvex` OpenVEX v0.2.0 export, added bounded 64 KiB file-tail ZIP`EOCD` /Central Directory inspection (`inspect_pickle_file_path` ) + strict ML pickle allowlist, and added cross-file`WorkspaceHclVars` (`.tfvars` /`variables.tf` /`aws_s3_bucket_public_access_block` ).\n- **Frontier Domains (`smg-web3` & `smg-hw`), Live DNS Pinning & Containment:** Replaced Solana CPI booleans with field-specific`validated_program_fields` , added two-pass Solidity struct slot sizing +`IERC20` /`enum` Diamond ABI canonicalization +`revm` attacker-gain solvency, zero-storage ETH drain, and view-reentrancy probes; wired`smg-hw` inter-procedural WCSD (cycle/depth-safe) +`SMG-HW-LINKER` RWX checks +`arg0` -only`memcpy` bounds; wired DNS pinning across all live HTTP engines &`smg-ai` ; masked`/app/.git` &`/app/.env*` in Linux`bwrap` and scoped macOS Seatbelt writes to per-run`TMPDIR` ; wired`audit_upgraded_starttls_stream` into`smg tls --starttls` , staged-index`git checkout-index` pre-commit scanning, LAN-to-loopback proxy SSRF`403` , remote CDP loopback/RFC1918 blocking,`smg http-audit --passive-only` , async`proxy_tui` replay/intruder, and full multi-domain`--apply-check` / TUI`[r]` rescan.\n\n*(Version note: pre-1.0 development progressed from `v0.4.0` directly to `v1.4.1` upon completing the 6-batch workspace soundness audit and GA release architecture.)*\n\n- **Trust-Loader & Bounded Sensitive-File Discovery:** Enforced`load_trusted_from_dir` (stripping untrusted`ignore_paths` on untrusted repos), preserved`.gitignore` on source walks with a separate bounded sensitive-file pass + optional`--no-gitignore` , and tightened distro-aware OSV & OCI image parsing.\n- **Static Engine & Domain Scanner Soundness:** Fixed CFG guard-union polarity &`budget_exhausted` propagation, upgraded middleware guard propagation to a true convergence fixpoint worklist, blocked`public_routes = [\"/*\"]` wildcards, hardened JSX sanitizer checks, fixed taint polarity/recursion caps & OpenAPI merge order, prevented SMT`&&` partial-parse false UNSAT, hardened IaC/AI/MCP/Mobile/Web3/HW/PQC scanners, and synchronized`RULE_CATALOG` .\n- **Live Engines, Fail-Closed Attestation & Supply-Chain Hardening:** Enforced unconditional IMDS/link-local deny across all live engines on final resolved destinations (even with`--allow-remote` ), removed OS-shell CMDi metacharacters from default safe DAST mode, enforced fail-closed TEE attestation (`verified: false` ,`cryptographically_verified: false` , TDX`48+120` offset fix), hardened MCP/TUI/Sandbox/Reports, and made`hooks/hooks.json` ,`install.sh` ,`install.ps1` , and CI/Release workflows fail-closed with tag-parity &`SHA256SUMS.txt` provenance attestation.\n\n- \n**Local MITM Inspection Proxy (`smg proxy --mitm-ca` & `smg proxy export-ca`):** Opt-in local ECDSA P-256 Root CA (` 0700` /`0600` ), on-the-fly IP/DNS leaf signing, HTTP/1.1 keep-alive multi-request tunnels, WebSocket upgrade logging (`kind: \"ws\"` ), HTTPS replay in TUI, and strict OS-validated upstream TLS for remote origins.\n- \n**Headless Chrome SPA & DOM-XSS (`smg dast --spa`, `smg http-audit --spa`):** Synchronous Chrome DevTools Protocol (` cdp_engine.rs` ),`0700` throwaway profiles, authenticated crawl (`--cookie` ,`--auth-header` ), XHR/Fetch harvesting, and DOM source-to-sink tracking (`location.hash` /`search` →`innerHTML` /`eval` ).\n- \n**Nuclei-Compatible YAML Templates & Self-Hosted OOB (`smg templates`, `smg oob serve`) + Differential SQLi Prover (` smg sqli`):**` ssl:` ,`websocket:` ,`headless:` ,`file:` ,`flow:` multi-step templates with loopback OOB callbacks, plus non-destructive JSON/GraphQL/multipart boolean & timing differential SQLi verification (`[SMG-VAR]` normalization).\n- \n**Formal Core, STARTTLS, Confidential Computing & OpenVEX:**`smg scan --openvex` ,`smg tls --starttls smtp|imap|ftp` ,`smg verify-attestation --platform tdx|sev-snp|nitro` , pure-Rust`QF_BV` /`QF_LIA` (`i128` GCD + Fourier-Motzkin) /`k-CFA` ($k=2$ ), loopback RFC 9113 HTTP/2 Single-Packet`END_STREAM` race + DB snapshot diff, and polyglot multi-hunk semantic AST patcher.\n\n| Language / DSL | Parser / AST Grammar ( `Crate` ) | Frameworks, Schemas & Idioms Extracted Automatically | \n|---|---|---|\n| **TypeScript / JavaScript** (`.ts` ,`.tsx` ,`.js` ,`.jsx` ,`.mjs` ,`.cjs` ) | `tree-sitter-typescript` (TS & TSX),`tree-sitter-javascript` (`smg-graph` ) | Express, Fastify, Hono, Koa, **Next.js App Router** (`export async function GET/POST/PUT/DELETE/PATCH` ),**NestJS** (`@Controller` ,`@Get` /`@Post` ,`@UseGuards` ),**tRPC** (`publicProcedure` ,`protectedProcedure` ), Prisma, Drizzle, React/Next.js Frontend (`fetch` ,`axios` ) | \n| **Go** (`.go` ) | `tree-sitter-go` (`smg-graph` ) | `net/http` (`http.HandleFunc` ,`mux.HandleFunc` ),**Gin** (`r.GET` ,`r.Group` ,`.Use` ),**Echo** ,**Chi** ,`database/sql` (`db.Query` ,`db.Exec` ,`tx.Exec` ),`sync.Mutex` /`RWMutex` ,`os/exec` | \n| **Python** (`.py` ) | `tree-sitter-python` (`smg-graph` ) | **FastAPI** (`@app.get` ,`@router.post` ,`Depends` ),**Flask** (`@app.route` ,`request.args` ),**Django** (`path()` ,`@login_required` ,`.objects.get/filter` ), PyTorch/HuggingFace loaders,`cursor.execute` ,`subprocess` | \n| **Rust** (`.rs` ) | `tree-sitter-rust` (`smg-graph` ) | **Axum** (`Router::new().route()` ,`.layer()` ),**Actix-Web** (`#[get(\"/...\")]` ,`#[post(\"/...\")]` ,`web::Path` ,`web::Query` ),`unsafe`` MaybeUninit` /ptr bounds,`Mutex` -across-`.await` ,`sqlx` ,`tokio::process::Command` | \n| **PHP** (`.php` ,`.phtml` ) | `tree-sitter-php` (`smg-graph` ) | **Laravel** (`Route::get/post/...` ,`middleware('auth')` ,`DB::transaction` ,`DB::select` ),**Symfony** (`#[Route]` ,`#[IsGranted]` ), PDO`prepare()` , PSR-4`use` resolution | \n| **Java** (`.java` ) | `tree-sitter-java` (`smg-graph` ) | **Spring Boot / MVC** (`@RestController` ,`@RequestMapping` ,`@GetMapping` /`@PostMapping` ,`@PreAuthorize` ,`@Transactional` ),**JAX-RS** (`@Path` ,`@GET` /`@POST` ), JDBC`PreparedStatement` | \n| **C#** (`.cs` ) | `tree-sitter-c-sharp` (`smg-graph` ) | **ASP.NET Core MVC** (`[Route]` ,`[HttpGet]` /`[HttpPost]` ,`[Authorize]` ,`[ValidateAntiForgeryToken]` ) &**Minimal APIs** (`app.MapGet` /`MapPost` ,`.RequireAuthorization()` ), Entity Framework (`FromSqlRaw` vs`FromSqlInterpolated` ) | \n| **Kotlin** (`.kt` ,`.kts` ) | `tree-sitter-kotlin-ng` (`smg-graph` ) | **Ktor** (`routing { get/post }` ,`authenticate(\"...\")` ,`call.parameters` ),**Spring Boot Kotlin** (`@RestController` ,`@PreAuthorize` ),**Android** (`Intent` ,`SharedPreferences` ,`rawQuery` ,`execSQL` ) | \n| **Swift** (`.swift` ) | `tree-sitter-swift` (`smg-graph` ) | **Vapor** (`app.get/post` ,`app.grouped(User.authenticator())` ,`req.db.transaction` ,`sql.raw` +`binds:` ),**iOS** (`URLSession` ,`UserDefaults` ,`FileManager` ,`sqlite3_exec` vs`sqlite3_prepare` ) | \n| **Dart** (`.dart` ) | `tree-sitter-dart` (`smg-graph` ) | **Dart Frog** (`routes/**`` onRequest` ),** Shelf** (`shelf_router`` router.get/post` ), Flutter`Hive` /`FlutterSecureStorage` ,`rawQuery` /`rawUpdate` /`Process.run` | \n| **C / C++** (`.c` ,`.h` ,`.cpp` ,`.cc` ,`.cxx` ,`.hpp` ,`.hh` ,`.hxx` ) | `tree-sitter-c` ,`tree-sitter-cpp` (`smg-graph` +`smg-hw` ) | `#include` header-to-implementation resolution,**Crow** (`CROW_ROUTE` ),**cpp-httplib** (`svr.Get/Post` ), branch-scoped UAF/Double-Free/bounds, CMSIS-SVD MMIO/DMA/ISR/WCSD firmware verification | \n| **Ruby** (`.rb` ,`.rake` ,`.ru` ) | `tree-sitter-ruby` (`smg-graph` ) | **Ruby on Rails** (`routes.rb`` to: 'ctrl#act'` ,`resources` ,`before_action :authenticate_user!` ,`skip_before_action :verify_authenticity_token` , ActiveRecord`.transaction` /`.where` ),**Sinatra** ,`Shellwords.escape` | \n| **Bash / Shell** (`.sh` ,`.bash` ,`.zsh` ) | `tree-sitter-bash` (`smg-graph` ) | `source` /`.` cross-file linking,`eval` /`sh -c` /`curl \\| bash` (`SMG-CMDI-001` ),`psql` /`mysql` /`sqlite3` SQLi, dynamic`curl` /`wget` SSRF,`rm -rf` path taint (clean on`mktemp` /`printf '%q'` /regex guards) | \n| **Terraform / HCL** (`.tf` ,`.tfvars` ) | `tree-sitter-hcl` (`smg-graph` ) | Local `module`` source` +`.tfvars` linking, public S3/GCS/RDS exposure (`SMG-CFG-IAC-PUBLIC` ),`0.0.0.0/0` ingress (`SMG-CFG-IAC-NET` ), disabled encryption/TLS (`SMG-CFG-IAC-CRYPTO` ), IAM`*/*` (`SMG-CFG-IAC-IAM` ), disabled logging/IPC isolation (`SMG-CFG-IAC-LOG` ,`SMG-CFG-IAC-IPC` ) | \n| **Solidity** (`.sol` ) | `tree-sitter-solidity` (`smg-web3` ) | Foundry ( `out/*.json` ) & Hardhat artifacts, ERC-1967 / ERC-7201 / EIP-2535 Diamond layouts, ERC-4626 vaults, Chainlink/AMM oracles, EIP-712/ECDSA, CEI & read-only reentrancy +**`revm` v43.0.3** concrete EVM oracle | \n| **Move** (`.move` ) | Structural Move parser ( `smg-web3` ) | Sui & Aptos modules ( `public entry` vs internal`public(package)` /`public(friend)` ),`copy` /`drop` hot-potato ability leaks (`SMG-MOVE-ABILITY-LEAK` ), shared admin caps (`SMG-MOVE-SHARED-CAP` ), and`&AdminCap` /`signer::address_of` guards (`SMG-MOVE-ENTRY-NO-AUTH` ) | \n| **SQL Migrations** (`.sql` ) | Structural SQL DDL/PLpgSQL analyzer ( `smg-graph` ) | `SECURITY DEFINER` dynamic`EXECUTE format('%s')` (`SMG-CFG-SQL-EXEC` ), missing`SET search_path` (`SMG-CFG-SQL-SEARCHPATH` ), disabled multi-tenant RLS (`SMG-CFG-SQL-RLS` ), and`SUPERUSER` privilege grants (`SMG-CFG-SQL-PRIV` ) | \n\nMeasured on a 4-Core Linux workstation (Ubuntu Wayland, 15 GiB RAM, NVMe SSD, `45 MB` stripped release binary covering 17 embedded Tree-sitter C grammars, bundled SQLite, and `revm`; CI enforces `<= 52 MiB`):\n\n| Workload | Scope | Cold Scan | Warm Cached Scan | Notes | \n|---|---|---|---|---|\n| **Enterprise TypeScript Monorepo** | 575 directories / **13,225 `.ts` files** | **414 ms** | **195 ms** | Full walk + `BLAKE3` +`Tree-sitter` +**76 ms** ) | \n| **2,000-Node Cyclic Sink Chain** | Stress test ( `test_b11_2000_node_all_sink_chain_is_linear` ) | **< 15 ms** | **< 5 ms** | Proves linear | \n| **120-Module Polyglot CI-Green Suite** | Go ( `chi` /`net/http` +`$1` SQL) + TS/React + SOPS`.yaml` | **374 ms** (P50) | **< 40 ms** | `0`` PROVEN` /`CONFIRMED` false positives (`adversarial_precision_bench` ) | \n| **MCP `shellmind_guard_scan` Tool Call** | JSON-RPC 2.0 `stdio` round-trip | **19 ms** | **4 ms** | Zero LLM token overhead | \n\nEvery precision and recall figure in ShellMind Guard is backed by an auditable, reproducible ground-truth harness rather than subjective manual sampling:\n\n1. **Deterministic Adversarial Corpus ([`crates/smg-graph/tests/adversarial_precision_bench.rs`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-graph/tests/adversarial_precision_bench.rs)):**`125` paired vulnerable (`67` positive) and adversarial safe-twin (`58` negative) multi-file cases spanning** 25 rule families** and 6 trap classes (`BaselineVuln` ,`BaselineSafe` ,`ScopeCollisionTrap` ,`DominatorGuardTrap` ,`OneHopWrapperTrap` ,`CheckedBoundsTrap` ), gated on every CI push via:\n\n```\nSMG_ENFORCE_PRECISION_GATE=1 cargo test -p smg-graph --test adversarial_precision_bench -- --nocapture\n```\n\n *(Automated hands-off on every code push, PR, release tag, and weekly schedule via [`.github/workflows/benchmarks.yml`](https://github.com/qira-dev/ShellMind-Guard/blob/main/.github/workflows/benchmarks.yml) and [`scripts/run_benchmarks.sh`](https://github.com/qira-dev/ShellMind-Guard/blob/main/scripts/run_benchmarks.sh): CI artifacts are retained for GitHub Actions' 90-day maximum, while every `v*` release attaches `benchmark-report.md` and `benchmark-metrics.json` **permanently** to GitHub Releases.)*\n2. **External Vulnerable & Production Reference Baselines:**  - **`OWASP/crAPI` (`1,062` files):** Evaluated against**30 known ground-truth flaws across 4 core categories** (`SMG-SQLI-001 = 1` ,`SMG-AUTH-001 = 16` ,`SMG-CFG-JWT-LOGIC / SMG-SEC-JWT = 7` ,`SMG-SEC-KEY = 6` in`services/chatbot/certs/server.key` ), verifying`30/30` (`100%` tracked-flaw recall) on every tuning pass.\n  - **`expressjs/express` (`lib/*.js` production core):** Evaluated at`--min-confidence confirmed` (`--ci` default gate:`HIGH` /`CRITICAL` non-test findings), verifying**`0` false positives** on clean framework routing/middleware internals.\n\n| Ground-Truth Suite / Rule Family | Positive Flaws ( `TP` ) | False Negatives ( `FN` ) | Safe Adversarial Twins ( `TN` ) | False Positives ( `FP` ) | Measured Recall | Measured Precision | \n|---|---|---|---|---|---|---|\n| **`SQLI` — Parameterized `$1` / `?` & Allowlist Traps** | 10 | 0 | 11 | 0 | **100.0%** | **100.0%** | \n| **`CMDI` / `SSTI` / `DESER` — Argv Array & `safe_load` Traps** | 12 | 0 | 4 | 0 | **100.0%** | **100.0%** | \n| **`AUTH` & `IDOR` — AST Dominator & Router-Mount Traps** | 7 | 0 | 7 | 0 | **100.0%** | **100.0%** | \n| **`AI` / `MCP` — `weights_only=True` & Balanced-RTL Traps** | 4 | 0 | 3 | 0 | **100.0%** | **100.0%** | \n| **`CICD` & `K8S` — 40-Char SHA Pin & Pod Security Traps** | 7 | 0 | 5 | 0 | **100.0%** | **100.0%** | \n| **`MEM` / `ENG` / `RACE` — `SELECT FOR UPDATE` & Bounds Traps** | 6 | 0 | 7 | 0 | **100.0%** | **100.0%** | \n| **`PATH` / `XSS` / `SSRF` — `Clean`+Prefix & `DOMPurify` Traps** | 7 | 0 | 5 | 0 | **100.0%** | **100.0%** | \n| **`SEC` / `SEC_CFG` / `CFG` / `IAC` — SOPS, KMS & Placeholder Traps** | 7 | 0 | 7 | 0 | **100.0%** | **100.0%** | \n| **`CRYPTO` / `OAUTH` / `STATE` / `QUEUE` / `ZIP` / `DOS` / `API` / `SMUGGLE` / `FE`** | 7 | 0 | 9 | 0 | **100.0%** | **100.0%** | \n| **Total CI Adversarial Corpus (`125` Cases across `25` Families)** | **67** | **0** | **58** | **0** | **100.0%** | **100.0%** | \n| **`OWASP/crAPI` Tracked Multi-Service Baseline (`1,062` files)** | **30 / 30** | **0** | — | — | **100.0%***(tracked set)* | Audited per release | \n| **`expressjs/express` Production `lib/` (`HIGH`+` CRITICAL`, `Confirmed+`)** | — | — | Production `lib/` | **0** | — | **0 Confirmed+ FPs** | \n\nCold full-repository static scans (`smg scan <repo> --json`) measured on a 4-Core Linux workstation (NVMe SSD, 15 GiB RAM) across **161,823 source & config files** (`0` crashes, `0` panics, `0` OOMs, `< 1 GiB` peak RSS across all 10 repositories):\n\n| Target Repository | Files | `v1.5.0` Baseline | `v1.5.5` Measured | Speedup / Precision Delta | Engineering Root-Cause Fix | \n|---|---|---|---|---|---|\n| **`zephyrproject-rtos/zephyr`** | 71,953 | `> 24m 47s`*(stopped)* | **` 141.32 s`** (` hw = 14.94 s` ) | **`> 10x` total · `> 100x` `smg-hw`** | Lazy `#define` lookup,`O(P)` lock hash index,`min_valid_depth` WCSD memoization | \n| **`wormhole-foundation/wormhole`** | 3,392 | `55.55 s` (`409` hits /`88` Crit) | **`29.29 s`** (` 358` hits /`66` Crit) | **`1.90x` faster · `0` CPI/Move dups** | Canonical defect-family dedup, Anchor PDA & Move `public(package)` scoping | \n| **`vllm-project/vllm`** | 9,860 | `228.51 s` (`smg-hw` ran on CUDA) | **`188.87 s`** (` hw = 97 ms` ) | **`1.21x` faster · `0` config/Bidi FPs** | Desktop token filter, `Language::Config` guard, runtime`torch.load`` CRITICAL` kept | \n\n| Repository | Ecosystem / Engine Focus | Files | Cold Scan Time | Throughput | Peak RSS | Verified `v1.5.5` Telemetry & Highlights | \n|---|---|---|---|---|---|---|\n| **`OWASP/crAPI`** | Polyglot API (Java/Py/Go/JS) | 1,062 | **2.25 s** | 472 files/s | 60.4 MB | `30/30` tracked baseline flaws (`SQLi=1, Auth=16, JWT=7, Key=6` ) | \n| **`wormhole-foundation/wormhole`** | Solana / Sui Move / Solidity ( `smg-web3` ) | 3,392 | **29.29 s** | 116 files/s | 180.6 MB | `358` findings (`66` Crit),`0` same-line Solana/CPI duplicates (`web3 = 1.68 s` ) | \n| **`openssl/openssl`** | C / Crypto / Memory Typestate | 6,207 | **40.87 s** | 152 files/s | 230.4 MB | Deep C buffer/integer/typestate scan ( `smg-hw` skipped on desktop`.ld` ) | \n| **`bytecodealliance/wasmtime`** | Rust / `unsafe` / JIT | 7,773 | **53.89 s** | 144 files/s | 280.2 MB | `smg-hw` skipped automatically on desktop JIT (`0`` SMG-HW-STACK` FPs) | \n| **`hashicorp/vault`** | Go / Secrets / Concurrency | 9,641 | **57.39 s** | 168 files/s | 207.3 MB | Struct-qualified Go mutex ( `Core::statelock` ) & package-scoped cycles | \n| **`vllm-project/vllm`** | Python + CUDA ( `smg-ai` , Pickle) | 9,860 | **188.87 s** | 52 files/s | 668.0 MB | `hw = 97 ms` ;`0``.pre-commit` /Unicode FPs;`weight_utils.py`` torch.load``CRITICAL` intact | \n| **`signalapp/Signal-Android`** | Java / Kotlin Mobile ( `smg-mob` ) | 11,481 | **63.71 s** | 180 files/s | 378.6 MB | Low-noise mobile storage/IPC/TLS; `0` balanced-RTL Bidi FPs | \n| **`envoyproxy/envoy`** | High-Scale C++ Proxy | 15,336 | **76.16 s** | 201 files/s | 416.0 MB | Bounded AST depth caps, only `12` Criticals across 15.3k C++ files | \n| **`grafana/grafana`** | Go + TypeScript/React Monorepo | 25,118 | **89.81 s** | 280 files/s | 505.2 MB | Full-stack frontend + backend + config pass; `devenv/` sample keys downgraded | \n| **`zephyrproject-rtos/zephyr`** | Embedded C / RTOS ( `smg-hw` ) | **71,953** | **141.32 s** | **509 files/s** | **991.7 MB** | `smg-hw` completed in**`14.94 s`** (` 2,104` findings,**`349` `Static-Proven`** ) | \n| **Aggregate (10 Repositories)** | **6 Security & Frontier Domains** | **161,823** | **743.56 s** | **218 files/s** | **< 1.0 GiB** | **`0` crashes · `0` panics · `0` OOMs · `0` LLM API cost** | \n\nBoth installer scripts are pinned to an immutable release tag (`v1.9.8`) and verify the downloaded archive against the release `SHA256SUMS.txt` manifest before installing `smg` and `shellmind-guard`:\n\n**Linux & macOS:**\n\n```\ncurl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/qira-dev/ShellMind-Guard/v1.9.8/install.sh | bash -s -- --version v1.9.8\n```\n\n**Windows (PowerShell):**\n\n```\n& ([scriptblock]::Create((irm https://raw.githubusercontent.com/qira-dev/ShellMind-Guard/v1.9.8/install.ps1))) -Version v1.9.8\n```\n\nRun ShellMind Guard automatically on every push or pull request using the official composite [`action.yml`](https://github.com/qira-dev/ShellMind-Guard/blob/main/action.yml) (verifies release `SHA256SUMS.txt` automatically):\n\n```\nname: ShellMind Guard Security Scan\non: [push, pull_request]\n\npermissions:\n  contents: read\n  security-events: write\n\njobs:\n  smg:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: qira-dev/ShellMind-Guard@v1.9.8\n        with:\n          path: .\n          ci: true\n          fail-on: high\n          sarif: smg-results.sarif\n      - uses: github/codeql-action/upload-sarif@v3\n        if: always()\n        with:\n          sarif_file: smg-results.sarif\n```\n\n**Use Standalone CLI (`smg` or `shellmind-guard`) or Load as an AI Coding Plugin (Claude Code / MCP + Skills + Commit Hook):**\n\n```\n# 0. Launch interactive TUI workspace directly (default when running `smg` in an interactive terminal)\nsmg\n\n# 1. Verify binary, sandbox backend, cgroups v2, git, advisory cache & AI readiness (add --probe-ai to test Ollama/API)\nsmg doctor .\n\n# 2. Install standalone Git pre-commit hook (scans staged git index locally with zero AI cost)\nsmg hook install .\n\n# 3. Install shell auto-completions (bash, zsh, fish, powershell)\nsmg completions bash > ~/.local/share/bash-completion/completions/smg\n\n# 4. Install as a Claude Code plugin from GitHub Marketplace (Claude Code 2.1.275+)\n/plugin marketplace add qira-dev/ShellMind-Guard\n/plugin install shellmind-guard@shellmind-guard\n\n# Or load a local clone directly (provides MCP tools, /shellmind-guard:guard-scan, /shellmind-guard:guard-fix & PreToolUse hook)\nclaude --plugin-dir /path/to/ShellMind-Guard\ngit clone https://github.com/qira-dev/ShellMind-Guard.git\ncd ShellMind-Guard\n\n# Install both `smg` (default short binary) and `shellmind-guard` into ~/.cargo/bin (with all frontier crates)\ncargo install --path . --locked\n\n# Or build the lightweight core binary without optional frontier crates (`hw`, `web3`, `pqc`, `enterprise`)\ncargo install --path . --no-default-features --locked\n```\n\n**Optional Runtime Prover Dependency:** Install `bubblewrap` (`sudo apt install bubblewrap` on Debian/Ubuntu or `sudo dnf install bubblewrap` on Fedora) to enable OS-isolated `--boot-cmd` exploit verification on Linux (macOS uses built-in `/usr/bin/sandbox-exec` Seatbelt; Windows uses WSL2 `bwrap` + Win32 Job Objects). Static verification works everywhere with zero external dependencies.\n\n```\n# Auto-detect project stack, write .shellmind-guard.toml, and generate .github/workflows/shellmind-guard.yml\nsmg init /path/to/your/repo --ci\n# Human-readable colored terminal report with rustc-style source snippets & summary bar\nsmg scan /path/to/your/repo\n\n# Machine-readable or PR-ready reports (text | compact | table | markdown | json | sarif)\nsmg scan /path/to/your/repo --format table\nsmg scan /path/to/your/repo --format markdown --output security-report.md\nsmg scan /path/to/your/repo --format sarif --cyclonedx bom-vex.cdx.json --openvex out.vex.json\nsmg scan /path/to/your/repo --changed-since origin/main --ci\n\n# Filter specific static, cloud-native, or frontier layers:\n# (auth,race,concurrency,taint,sqli,cmdi,path,ssrf,xss,csrf,idor,secrets,config,deps,frontend,\n#  cicd,k8s,dos,zip,crypto,queue,api,ai,oauth,smuggle,state,engine,memory,mobile,hw,web3,pqc,deep)\nsmg scan /path/to/your/repo --layers secrets,sqli,xss,csrf,idor,race,ai,api,k8s --min-confidence confirmed\nsmg scan /path/to/firmware-repo --layers hw --ci\nsmg scan /path/to/defi-repo --layers web3 --ci\nsmg scan /path/to/your/repo --compliance pqc --cbom cbom.cdx.json --ci\nsmg scan /path/to/your/repo --write-baseline .smg-baseline.json\nsmg scan /path/to/your/repo --baseline .smg-baseline.json --exclude-rule SMG-CFG-CORS --ci\n\n# Inspect all 177 built-in guard rules or explain vulnerable vs fixed code patterns\nsmg rules --layer race\nsmg explain SMG-RACE-001\n\n# Opt-in sync of local offline SQLite OSV advisory DB (or import offline JSON bundle) & check status\nsmg deps sync /path/to/your/repo\nsmg deps sync --from-file /path/to/osv.json\nsmg deps status\n```\n\nRun ShellMind Guard against the included vulnerable Node/TypeScript payment fixture ([`fixtures/vuln-payment-node`](https://github.com/qira-dev/ShellMind-Guard/blob/main/fixtures/vuln-payment-node)) to see static findings upgraded to **`Sandbox: PROVEN`** via live `bwrap` execution and 12-way barrier-synchronized race probing:\n\n```\nsmg scan fixtures/vuln-payment-node \\\n  --boot-cmd \"node server.mjs\" \\\n  --sarif .shellmind-guard/report.sarif \\\n  --html .shellmind-guard/report.html\n```\n\n*(Note: In scan output, the first ID—e.g. `SMG-RACE-001` or `SMG-RACE-002`—is the sequential per-scan **finding instance ID** accepted by `smg replay`, followed in parentheses by the canonical **` RULE_CATALOG` ID** `(SMG-RACE-001)`.)*\n\nVerbatim live output (initial fixture `balance = 100`; `SMG-AUTH-001` withdraws `10` leaving `balance = 90`; `SMG-RACE-001` then fires `12` concurrent `amount = 80` withdrawals = `960` requested against `90` available):\n\n```\nShellMind Guard Scan | 5 files (8 symbols, 6 edges, 2 routes) | 485ms (delta: +0 / 5 cached)\n  2 finding(s) detected | CRIT:1 HIGH:1 MED:0 LOW:0 PROVEN:2 | [AUTH/IDOR=1 RACE/LOCK=1]\n\n  [HIGH] [PROVEN] SMG-AUTH-001 (SMG-AUTH-001) -> Unauthenticated path to BalanceUpdate in `debitBalance`\n      Entry: POST /api/v1/checkout/withdraw\n      [1] src/routes/checkout.ts:8  POST /api/v1/checkout/withdraw\n      [2] src/services/ledger.ts:3  processWithdrawal\n      [3] src/db/queries.ts:1       debitBalance\n\n  [CRITICAL] [PROVEN] SMG-RACE-001 (SMG-RACE-001) -> Missing transaction/lock guard before `debitBalance` (Double-Spend Risk)\n      Entry: POST /api/v1/checkout/withdraw\n      [1] src/routes/checkout.ts:8  POST /api/v1/checkout/withdraw\n      [2] src/services/ledger.ts:3  processWithdrawal\n      [3] src/db/queries.ts:1       debitBalance\n\nShellMind Guard Sandbox Proof (bwrap=isolated):\n  [PROVEN] SMG-AUTH-001 (SMG-AUTH-001) -> Unauthenticated request executed with HTTP 200 (payload: {\"ok\":true,\"balance\":90})\n  [PROVEN] SMG-RACE-001 (SMG-RACE-001) -> 12/12 concurrent requests returned HTTP 200 (Last-Byte Sync, 1 distinct bodies; state proof: 12x amount=80 mutations returned identical balance=10 [11 lost updates, 960 total requested])\n```\n\nSimply observing multiple `HTTP 200` responses does **not** prove a double-spend if an account had sufficient initial balance (`1,000`) and serialized all 12 debits (` 920, 840, ..., 40`). `smg-sandbox` prevents false race proofs across three corroboration layers:\n\n| Corroboration Layer | Module & Function | Invariant Checked | Verdict When Sufficient Balance Serializes Cleanly | \n|---|---|---|---|\n| **1. JSON Ledger Post-State Classifier** | [`verifier.rs::classify_race_ledger_bodies`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-sandbox/src/verifier.rs) | Inspects numeric ledger fields ( `balance` ,`remaining` ,`credits` ,`available` ,`stock` ) across all`2xx` responses against request`amount` : flags negative overdraft (`balance < 0` ) or duplicate post-state across non-zero mutations (`12x amount=80 -> all balance=10` =`11` lost updates). | Arithmetic step sequence ( `920, 840, 760, 680` with`min >= 0` ) is classified`SerializedSolvent` →**`SuspectUnverified`***(never marked `PROVEN`)* . | \n| **2. Wire-Level DB/Redis Mutation Oracle** | [`wire_oracle.rs::WireDiffProxy`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-sandbox/src/wire_oracle.rs) +`apply_wire_diff_corroboration` | Counts non-idempotent TCP wire write frames ( `UPDATE` /`INSERT` / Redis`DECRBY` ) emitted during a single barrier burst (`[WireDiffProxy: N non-idempotent write mutation frames]` ). | `0..1` write frames or`409` /`429` lock rejection preserves`Mitigated` /`SuspectUnverified` . | \n| **3. Pre/Post DB Conservation Snapshot Diff** | [`h2_race_snapshot.rs::diff_db_snapshots`](https://github.com/qira-dev/ShellMind-Guard/blob/main/crates/smg-sandbox/src/h2_race_snapshot.rs) | Compares `before` vs`after`` DbStateSnapshot` (`balances` ,`row_counts` ) against`expected_net_delta` and`max_allowed_row_growth` during RFC 9113 HTTP/2 single-packet bursts. | Atomic single withdrawal ( `alice: 100 -> 0` ,`rows: +1` ) yields`violated: false` . | \n\n```\n# Replay live exploit proof for a specific finding instance ID and print minimal <= 2048 B witness context\nsmg replay SMG-RACE-002 fixtures/vuln-payment-node \\\n  --boot-cmd \"node server.mjs\" \\\n  --patch\n\n# Apply a unified diff inside an isolated temporary workspace and verify mitigation across all domains\nsmg replay SMG-SQLI-001 /path/to/your/repo \\\n  --patch-file fix.diff \\\n  --apply-check\n# Simply run bare `smg` in any repository, or pass explicit UI/sandbox filters:\nsmg ui fixtures/vuln-payment-node --deep --boot-cmd \"node server.mjs\"\n```\n\n- \n**`[j]` / `[k]` / `↑` / `↓` / Mouse Click:** Navigate and select findings in the sorted queue (`PROVEN > SEVERITY > Confidence` )\n- \n**`[/]` / `[c]` / `[f/1-4]`:** Live fuzzy search (`/` ), cycle Guard Category (`c` ), or filter Severity/Status (`f` /`1-4` )\n- \n**`[Enter]` / `[r]`:** Run non-blocking background` bwrap` exploit replay or delta-cached live rescan with animated spinner\n- \n**`[z]` / `[` / `]` / `\\`:** Toggle full-pane Source Inspector zoom (` z` ) and scroll source code lines (`[` /`]` or mouse wheel)\n- \n**`[p]` (then `[a]` / `[y]`):** Generate & inspect colorized unified patch diff /`<= 2 KB` prompt, and run isolated`--apply-check` (`a` )\n- \n**`[e]` / `[y]`:** Open exact witness hop file:line in`$VISUAL` /`$EDITOR` (`e` ), or copy finding/patch via OSC 52 (`y` )\n- \n**`[g]` / `[s]` / `[L]`:** Export HTML/SVG graph (` g` ), SARIF 2.1.0 (`s` ), or toggle Event Log drawer (`L` )\n\nAll **23 built-in subcommands** exposed by `smg` / `shellmind-guard` ([`src/lib.rs`](https://github.com/qira-dev/ShellMind-Guard/blob/main/src/lib.rs)):\n\n| Domain | Subcommand | Purpose & Safety Posture | \n|---|---|---|\n| **Core Static, Sandbox & TUI** | `smg` /`smg ui [PATH]` | Launch panic-safe 60fps 4-workspace `ratatui` TUI (with live replay, diff preview &`--apply-check` ). | \n|  | `smg init [PATH] [--ci] [--hook]` | Auto-detect project stack, scaffold `.shellmind-guard.toml` , CI workflow, and optional git hook. | \n|  | `smg index [PATH] [--json]` | Run parallel `ignore` walker +`BLAKE3` hashing + SQLite WAL delta index synchronization. | \n|  | `smg scan [PATH] [FLAGS]` | Run full multi-layer static + frontier scan with optional `--boot-cmd` sandbox proof, SARIF, VEX & CBOM. | \n|  | `smg replay <ID> [PATH]` | Re-execute an isolated sandbox PoC for a finding ID ( `--patch` ,`--patch-file` ,`--apply-check` ). | \n|  | `smg rules [--layer <L>] [--json]` | Browse all `177` built-in rules in`RULE_CATALOG` filtered by layer. | \n|  | `smg explain <ID> [--path <P>]` | Show vulnerable vs fixed code examples for a rule ID or exact source witness hops for a finding ID. | \n| **Agent, Git & Environment** | `smg mcp` | Start newline-delimited `stdio` JSON-RPC 2.0 MCP server for AI coding agents. | \n|  | `smg hook install\\|uninstall\\|status` | Manage standalone staged-index Git `pre-commit` secret & config guard hook. | \n|  | `smg completions <SHELL>` | Generate shell completion scripts ( `bash` ,`zsh` ,`fish` ,`powershell` ). | \n|  | `smg doctor [PATH] [--probe-ai]` | Audit local sandbox backend ( `bwrap` /Seatbelt/WSL2),`cgroups v2` , git, OSV DB, and AI readiness. | \n| **Live Lab, DAST & Proxy***(Loopback/lab-locked by default; IMDS/link-local unconditionally blocked)* | `smg http-audit [URL] [--schema <F>]` | Non-destructive passive HTTP posture check ( `--passive-only` ,`--spa` ) & offline OpenAPI/GraphQL linter. | \n|  | `smg dast <URL> [--spa] [--passive-only]` | Proof-based active DAST crawler + headless Chrome CDP ( `cdp_engine.rs` ) DOM XSS flows. | \n|  | `smg sqli <URL> [FLAGS]` | Non-destructive differential SQLi prover across query, form, JSON, GraphQL, multipart, headers & cookies. | \n|  | `smg idor --config <FILE>` | 2-user ( `User A` vs`User B` ) authorization / IDOR / BFLA regression verifier (`--allow-mutations` loopback-only). | \n|  | `smg templates <TARGET> [--oob-server]` | Nuclei-compatible YAML engine ( `http` ,`ssl` ,`websocket` ,`headless` ,`file` ,`flow` multi-step). | \n|  | `smg oob serve [--listen <ADDR>]` | Self-hosted loopback TCP HTTP + UDP callback listener for `interactsh` -style OOB verification. | \n|  | `smg proxy [--mitm-ca] [export-ca]` | Localhost HTTP/HTTPS inspection proxy with TUI history, Repeater, Intruder & ECDSA P-256 CA. | \n| **Supply Chain, Crypto & TEE** | `smg deps sync\\|status` | Sync OSV.dev advisories (or `--from-file` airgapped bundle) into offline SQLite`advisories.db` . | \n|  | `smg image <TAR_OR_ROOTFS>` | OCI/Docker image `.tar` /`.tar.gz` & rootfs OS (`dpkg` /`apk` ) + app lockfile CVE scanner. | \n|  | `smg tls <HOST:PORT> [--starttls <P>]` | Live TLS/STARTTLS protocol, cipher, HSTS, X.509 & hybrid PQC ( `X25519MLKEM768` ) auditor. | \n|  | `smg verify-attestation --platform ...` | Offline fail-closed cryptographic verifier for `tdx` ,`sev-snp` , and`nitro` binary attestation quotes. | \n|  | `smg enterprise status\\|verify-license\\|verify-attestation\\|remote-scan` | Local `/dev/{nsm,tdx_guest,sev-guest}` hardware probe, enclave admission token verifier, and remote TEE scan client. | \n\nRuntime exploit verification (`smg replay` / `--boot-cmd`) adapts to the host operating system's native containment primitives; isolation strength varies by OS:\n\n| Host OS | Sandbox Backend | Filesystem & Sensitive Path Masking | Network & Process Isolation | Notes / Trade-offs | \n|---|---|---|---|---|\n| **Linux** | `bubblewrap` (`bwrap --unshare-all` ) | Read-only bind mounts + masked `/app/.git` &`/app/.env*` , per-run`tmpfs` | Full kernel user, PID, mount & network namespace isolation (loopback-only) + optional `RLIMIT_AS` /`cgroups v2` | Strongest isolation tier; requires `bubblewrap` installed on host. | \n| **macOS** | `sandbox-exec` (Seatbelt profile) | Read-only workspace + writes restricted to per-run `TMPDIR` | Outbound network denied except loopback ( `127.0.0.1` /`::1` ) + process-group reaper | Apple marks `sandbox-exec` as deprecated in macOS documentation, though Seatbelt profiles remain enforced on current macOS releases. | \n| **Windows** | WSL2 `bwrap`*(preferred)* or Win32 Job Object fallback | Full `bwrap` mount isolation inside WSL2; Win32 Job Object fallback does not provide mount/FS namespaces | Full namespace isolation in WSL2; Win32 Job Object enforces process-tree termination ( `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` ) and memory/process limits without network namespaces | Use WSL2 + `bubblewrap` on Windows when auditing untrusted target services. | \n\nShellMind Guard includes a built-in, newline-delimited **JSON-RPC 2.0 Stdio MCP Server** (`shellmind-guard mcp`) so AI coding agents (**Claude Code, Cursor, AntiGravity, Windsurf, OpenCode, Z-Code**) can run deterministic multi-file security verification without burning context tokens on raw file reads.\n\nAdd the following to your `.mcp.json`, `~/.claude.json`, or `.cursor/mcp.json`:\n\n```\n{\n  \"mcpServers\": {\n    \"shellmind-guard\": {\n      \"command\": \"shellmind-guard\",\n      \"args\": [\"mcp\"]\n    }\n  }\n}\n```\n\n| Tool Name | Input Schema | Description | \n|---|---|---|\n| `shellmind_guard_scan` | `{ \"path\"?: string, \"layers\"?: string[], \"min_confidence\"?: \"proven\"\\|\"confirmed\"\\|\"heuristic\", \"deep\"?: boolean }` | Runs the polyglot AST ( `17` Tree-sitter grammars + Move + SQL) + Guard-Set Lattice + Frontier domain scan and returns structured JSON findings (`<= 32 KiB` bounded) with confidence, witness hops, and remediation. | \n| `shellmind_guard_explain_finding` | `{ \"path\"?: string, \"finding_id\": string }` | Resolves a finding instance `id` (e.g.`SMG-RACE-002` ) or canonical`rule_id` (e.g.`SMG-SQLI-001` ,`SMG-FUZZ-SCHEMA` ) and returns exact source lines around every hop in`witness_path` , a`<= 2 KB` patch prompt, and concrete remediation guidance. | \n| `shellmind_guard_init` | `{ \"path\"?: string, \"ci\"?: boolean, \"hook\"?: boolean, \"overwrite\"?: boolean }` | Detects the repository language stack, writes `.shellmind-guard.toml` , and optionally scaffolds`.github/workflows/shellmind-guard.yml` or installs`.git/hooks/pre-commit` . | \n\nShellMind Guard works out of the box with zero configuration, or can be customized via `.shellmind-guard.toml` in your repository root:\n\n```\n[guards]\n# Functions, decorators, or middleware identifiers treated as authentication guards\nauth_guards = [\n  \"requireAuth\", \"authenticate\", \"verifyJwt\", \"withAuth\", \"requireAdmin\",\n  \"ensureAuthenticated\", \"AuthGuard\", \"UseGuards\", \"protectedProcedure\",\n  \"login_required\", \"AuthMiddleware\"\n]\n\n# Wrappers or SQL clauses treated as concurrency / transaction lock guards\nlock_guards = [\n  \"withTransaction\", \"FOR UPDATE\", \"acquireLock\", \"idempotencyKey\",\n  \"BeginTx\", \"db.Transaction\", \"$transaction\"\n]\n\n# Intentionally unauthenticated routes (suppresses SMG-AUTH-001 only; never suppresses SQLi/CMDi/Race)\npublic_routes = [\n  \"/health\", \"/healthz\", \"/readyz\", \"/metrics\",\n  \"/login\", \"/register\", \"/signup\", \"/webhook\"\n]\n\n# Custom router registration methods (if your framework wraps standard HTTP verbs)\ncustom_routes = []\n\n[scan]\nignore_paths = [\"node_modules\", \"target\", \"dist\", \"build\", \".next\", \".shellmind-guard\"]\nmax_threads = 4\nmax_file_bytes = 2097152\n\n[sandbox]\n# Default boot command, loopback base_url (http:// or https://), IDOR/body overrides, and resource/mock hardening\n# boot_cmd = \"node server.mjs\"\n# base_url = \"http://127.0.0.1:3000\"\n# user_a_header = \"Authorization: Bearer token-user-a\"\n# user_b_header = \"Authorization: Bearer token-user-b\"\n# probe_body = '{\"amount\": 100}'\n# memory_limit_mb = 512\n# use_cgroup_v2 = false\n# mock_shims = false\n\n[ai]\n# Opt-in only (disabled by default = zero network calls; requires --trust-repo-config)\n# provider = \"disabled\"          # \"disabled\" | \"ollama\" | \"openai_compatible\"\n# endpoint = \"http://127.0.0.1:11434\"\n# model = \"qwen2.5-coder:7b\"\n# api_key_env = \"OPENAI_API_KEY\"\n```\n\nShellMind Guard is organized as a modular Rust Cargo workspace (zero runtime Python, Node.js, or JVM dependencies; Tree-sitter C grammars and bundled SQLite compile natively via Cargo):\n\n```\nShellMind-Guard/\n├── Cargo.toml                     # Workspace root (Rust 2024 Edition, `unsafe_code = \"forbid\"`)\n├── action.yml                     # Official SHA256-verified composite GitHub Action\n├── .github/workflows/\n│   ├── ci.yml                     # Cross-OS CI matrix (Ubuntu, macOS, Windows + Clippy + Dogfood gate)\n│   ├── benchmarks.yml             # Zero-maintenance precision, O(V+E) scaling & phase-latency CI scorecard\n│   └── release.yml                # Tag-parity check, 5-target release matrix & SLSA provenance attestation\n├── scripts/\n│   └── run_benchmarks.sh          # Reproducible offline precision & phase-latency benchmark runner\n├── .claude-plugin/\n│   ├── plugin.json                # Claude Code / agent plugin manifest & icon\n│   └── marketplace.json           # GitHub marketplace index (`qira-dev/ShellMind-Guard`)\n├── .mcp.json                      # Standalone & plugin stdio MCP configuration (`shellmind-guard mcp`)\n├── hooks/hooks.json               # PreToolUse `Bash|PowerShell` secret/config commit guard hook\n├── skills/\n│   ├── guard-scan/SKILL.md        # `/shellmind-guard:guard-scan` MCP + CLI workflow\n│   └── guard-fix/SKILL.md         # `/shellmind-guard:guard-fix` all-rule remediation + `--apply-check`\n├── src/\n│   ├── bin/smg.rs                 # Short primary CLI (`smg`; launches TUI directly on interactive TTY)\n│   ├── main.rs                    # Compatibility alias binary (`shellmind-guard`)\n│   ├── lib.rs                     # Unified 23-subcommand CLI entrypoint & module exports\n│   ├── cli.rs                     # Clap CLI argument definitions across all 23 subcommands\n│   ├── commands/                  # Subcommand dispatch handlers (`scan`, `replay`, `ui`, `init`, live engines, etc.)\n│   ├── pipeline.rs                # Multi-phase static, frontier & sandbox scan orchestration\n│   ├── render.rs                  # Terminal, table, compact, markdown, JSON & SARIF output formatting\n│   ├── baseline.rs                # Baseline diffing & suppression management\n│   ├── hooks.rs                   # Staged-index Git pre-commit & Claude Code hook runner\n│   ├── rules_catalog.rs           # Re-export of `smg_graph::RULE_CATALOG` (177 rules) + shell completion generator\n│   └── mcp.rs                     # Stdio JSON-RPC 2.0 Model Context Protocol server (`<= 32 KiB` bounded responses)\n├── tests/\n│   └── readme_catalog_sync.rs     # CI drift gate verifying `RULE_CATALOG` <-> emitted rules <-> `README.md` parity\n├── crates/\n│   ├── smg-core/                  # .shellmind-guard.toml config, ignore::WalkParallel + BLAKE3 scanner,\n│   │                              # 19-language/DSL enum, SQLite WAL + FTS5 store & local `advisories.db` index\n│   ├── smg-graph/                 # Parallel Tree-sitter AST across 16 core languages + `.sql` DDL analyzer,\n│   │                              # domain routing (`web`/` system_engine`/` mobile`/cloud/AI), `RULE_CATALOG` (177 rules),\n│   │                              # Phase 9/10 cross-file field/closure taint, SMT (`QF_BV`/` QF_LIA`) & O(V+E) Lattice\n│   ├── smg-dynamic/               # Unified `SafeHttpClient`, live DAST/CDP (` dast_audit.rs`, `cdp_engine.rs`),\n│   │                              # SQLi (`sqli_audit.rs`), IDOR (` idor_audit.rs`), Nuclei (` templates_audit.rs`),\n│   │                              # OOB (`oob_server.rs`), MITM Proxy (` proxy.rs`, `proxy_mitm.rs`), TLS/X.509/PQC\n│   │                              # (`tls_audit.rs`), passive HTTP/OpenAPI/GraphQL (` http_audit.rs`), OCI (` oci_image.rs`),\n│   │                              # OSV sync (`deps_sync.rs`) & opt-in live verifier (` live_verify.rs`)\n│   ├── smg-sandbox/               # Linux Bubblewrap (`--unshare-all`) + macOS Seatbelt + Windows WSL2/Job Object,\n│   │                              # Last-Byte Sync + ledger/wire/DB race oracles, rustls TLS loopback & `--deep` fuzzing\n│   ├── smg-report/                # SARIF 2.1.0, CycloneDX 1.5 VEX, OpenVEX v0.2.0 & HTML/SVG witness graph exporter\n│   ├── smg-tui/                   # Panic-safe 60fps 4-workspace `ratatui` UI, proxy TUI & Side-by-Side Diff modal\n│   ├── smg-ai/                    # Deterministic polyglot AST codemods, 3-iter CEGIS loop & opt-in TLS patcher\n│   ├── smg-hw/                    # Isolated `--features hw` Firmware/MMIO/Tnum/Octagon/IRQ/Boot/Linker/DMA verifier\n│   ├── smg-web3/                  # Isolated `--features web3` `tree-sitter-solidity` (17th Tree-sitter grammar),\n│   │                              # structural Move parser, Solana Anchor AST & in-process `revm` v43.0.3 EVM oracle\n│   ├── smg-pqc/                   # Opt-in `--features pqc` Shor/Grover/Mosca HNDL, X.509/ELF audit & CycloneDX CBOM\n│   └── smg-enterprise/            # Isolated `--features enterprise` Nitro/TDX/SEV-SNP TEE attestation, BLAKE3 Merkle\n│                                  # audit log & remote enclave Ed25519 admission-token verifier\n└── fixtures/\n    ├── vuln-payment-node/         # Runnable multi-file Node/TS double-spend race, SQLi & auth fixture\n    └── vuln-auth-rust/            # Multi-file Rust Axum unauthenticated role-mutation fixture\n```\n\nFurther engineering documentation:\n\n- [**`docs/BLUEPRINT.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/docs/BLUEPRINT.md) — Master System Architecture, Lattice Mathematics & Sandbox Isolation Spec\n- [**`docs/PLANNING.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/docs/PLANNING.md) — Module Specifications, Crate Stack & Engineering Risk Matrix\n- [**`docs/ROADMAP.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/docs/ROADMAP.md) — Phase-by-Phase Engineering Milestones & Verification Gates\n- [**`docs/ROADMAP_PHASES_21_26.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/docs/ROADMAP_PHASES_21_26.md) — Frontier & Formal Engine Phase Specs (Phases 21–26)\n- [**`SECURITY.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/SECURITY.md) — Sandbox Isolation Model & Vulnerability Disclosure Policy\n- [**`CONTRIBUTING.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/CONTRIBUTING.md) — Architecture Invariants & Developer Contribution Guide\n- [**`action.yml`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/action.yml) — Official Composite GitHub Action (SHA256-Verified CI Gate & SARIF Export)\n- [**`CHANGELOG.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/CHANGELOG.md) — Release History\n\nExternal contributions—new language idioms, framework guards, frontier rules, and false-positive counterexamples—are welcome! Every PR is automatically verified for zero precision/recall regression and zero documentation drift:\n\n1. **Read the Engineering Invariants & 4-Step Rule Protocol:** Follow[**`CONTRIBUTING.md`**](https://github.com/qira-dev/ShellMind-Guard/blob/main/CONTRIBUTING.md) (` O(V + E)` lattice complexity, single-pass`Tree-sitter` +`OnceLock<Regex>` , fail-closed untrusted repo config, paired`TP` +`TN` adversarial safe-twins, and`RULE_CATALOG` sync).\n2. **Run the Local Verification & Benchmark Gate:**\n\n```\ncargo fmt --all -- --check\ncargo clippy --workspace --all-targets --locked -- -D warnings\nbash scripts/run_benchmarks.sh\n```\n\nLicensed under the [Apache License, Version 2.0](https://github.com/qira-dev/ShellMind-Guard/blob/main/LICENSE).", "url": "https://wpnews.pro/news/show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust", "canonical_source": "https://github.com/qira-dev/ShellMind-Guard", "published_at": "2026-12-02 14:29:00+00:00", "updated_at": "2026-12-02 14:47:02.582565+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "agent-protocols", "developer-tools", "ai-safety"], "entities": ["ShellMind Guard", "Rust", "Tree-sitter", "BLAKE3", "SQLite", "Model Context Protocol", "revm", "Move"], "also_reported_by": [], "takeaway": "ShellMind Guard replaces LLM-only scanning with a deterministic O(V + E) guard-set lattice over 17 Tree-sitter grammars, re-linking the cross-file call graph in under 80 ms and proving exploits in bwrap, sandbox-exec or WSL2 sandboxes at zero AI API cost.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust", "markdown": "https://wpnews.pro/news/show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust.md", "text": "https://wpnews.pro/news/show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust.txt", "jsonld": "https://wpnews.pro/news/show-hn-shellmind-guard-multi-file-security-and-concurrency-verifier-in-rust.jsonld"}}