Deterministic Multi-File Security, Business-Logic, Concurrency & Frontier Domain Verifier
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.
Architecture · Verification Engine (177 Rules) · Frontier Domains · Benchmarks & Ground Truth · Quickstart · CLI Reference (23 Commands) · AI Agent MCP · Blueprint
Modern 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.
Conventional security tools fail on these bugs in two predictable ways:
- 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.
- 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.
ShellMind Guard solves both problems with a deterministic, systems-engineered architecture:
- Two-Phase Incremental Ingestion (BLAKE3 + SQLite WAL): Fingerprints 13,000+ files at >1 GB/s, caching per-file Tree-sitter AST summaries in SQLite whilealways 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 ). - $O(V + E)$ Guard-Set Lattice Solver:$O(V!)$ path enumeration—terminating in linear time even on cyclic enterprise call graphs. - 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. - Cross-OS Isolated Exploit Prover (smg-sandbox): Boots your service inside an isolated OS sandbox (Linux bwrap --unshare-all ,macOS sandbox-exec Seatbelt , orWindows WSL2 bwrap + Win32 Job Object with optional--sandbox-mem-mb RLIMIT_AS /--cgroup-v2 ,--sandbox-tls loopbackrustls ,--mock-shims , fastUNBOOTABLE diagnostics, and process-group reaper) and fires barrier-synchronized12-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, andDbStateSnapshot conservation diffs. - Isolated Frontier Verification Domains (hw · web3 · pqc · enterprise): Zero-overhead on standard Web/AppSec repos—auto-activatessmg-hw (Tnum /SparseOctagon /CMSIS-SVD/IRQ/Linker W^X) on firmware/kernel code andsmg-web3 (tree-sitter-solidity , Foundry/Hardhat, in-processrevm v43.0.3 concrete EVM oracle, Solana Anchor, Sui/Aptos Move) on Web3 repos, plus opt-insmg-pqc (Shor/Grover/BHT, Mosca HNDL, CycloneDX 1.5 Static CBOM) andsmg-enterprise (remote Nitro/TDX/SEV-SNP TEE attestation & enclave admission control). - Native Model Context Protocol (shellmind-guard mcp) Server: Exposes deterministic, zero-token-overhead security verification overstdio JSON-RPC 2.0 forClaude Code, Cursor, AntiGravity, Windsurf, OpenCode, and Z-Code .
flowchart TD
subgraph Surfaces["Access Surfaces (smg / shellmind-guard — 23 Subcommands)"]
C1["CLI & CI Merge Gate\nsmg scan · replay · rules · explain · hook"]
C2["60fps Interactive TUI\nsmg ui · Proxy TUI (ratatui)"]
C3["Read-Only MCP Server\nsmg mcp (JSON-RPC 2.0 Stdio)"]
end
subgraph Core["ShellMind Guard Core Engine (12 Rust Crates · 1T == 16T Deterministic)"]
A1["Incremental Ingestion (smg-core)\nWalkParallel · BLAKE3 · POSIX/NFC"]
A2["Polyglot AST & Linker (smg-graph)\n17 Tree-sitter Grammars · Move · SQL · HCL"]
A3["Formal & Lattice Core (smg-graph::formal)\nO(V+E) Guard Lattice · 2-CFA/SSA · CDCL · SMT"]
A4["Frontier Domains (Zero-Overhead Routing)\nsmg-hw · smg-web3 (revm) · smg-pqc · smg-enterprise"]
DB[("SQLite WAL + SMG2 Cache\nPostcard AST Blobs · Offline OSV DB")]
end
subgraph Provers["Runtime Provers, Live Lab & Actionable Outputs"]
P1["Cross-OS Exploit Prover (smg-sandbox)\nLinux bwrap · macOS Seatbelt · Win WSL2/Job"]
P2["Live Lab & Dynamic Suite (smg-dynamic)\nSafeHttpClient · DAST · SQLi · Nuclei · MITM · TLS · OCI"]
P3["Reports & Auto-Patcher (smg-report · smg-ai)\nSARIF 2.1.0 · CycloneDX/OpenVEX · HTML · CEGIS"]
end
C1 & C2 & C3 --> A1
A1 --> DB
A1 --> A2 --> A3
A2 --> A4
A3 & A4 -->|"Static Findings"| P3
A3 -->|"--boot-cmd / replay"| P1
C1 -->|"Live Lab / OCI"| P2
P1 & P2 -->|"PROVEN / MITIGATED"| P3
Inside 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:
flowchart LR
SRC["Source & Specs\n17 ASTs · Move · SQL\nSVD · .ld · Foundry"] --> PARSE["Single-Pass CST & Arena\nDepth-Capped Walk\nCross-File Import Linker"]
PARSE --> E_TAINT["1. Guard Lattice & Taint\nMonotone Worklist O(V+E)\nDominator Guards · 2-CFA/SSA"]
PARSE --> E_MEM["2. Typestate & Abstract Math\nAlloc/Free/UAF · Pointer Alias\nTnum · Octagon · CDCL/SMT"]
PARSE --> E_CONC["3. Concurrency & Lock Graph\nGo Struct Mutex · Rust .await\nISR vs Task ABBA Deadlocks"]
E_TAINT & E_MEM & E_CONC --> DEDUP["Canonical Family Deduplicator\nProven > Confirmed > Heuristic"]
DEDUP --> STATIC_OUT["Verified Static Findings\nShortest Unguarded Witness"]
When --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:
sequenceDiagram
participant CLI as smg-sandbox Prover
participant BAR as tokio::sync::Barrier (12x)
participant APP as Sandboxed App (bwrap / Seatbelt / WSL2)
participant ORA as WireDiffProxy & State Oracles
CLI->>APP: Boot service inside isolated net/fs namespace + optional WireDiffProxy
par 12 Concurrent Workers
CLI->>APP: Connect & write HTTP/1.1 request prefix (N - 1 bytes, holding final byte)
CLI->>BAR: bar.wait() until all 12 TCP sockets are primed
end
BAR-->>CLI: Simultaneous release
CLI->>APP: Flush final 1 byte ('}') across all 12 sockets in microsecond window
APP->>ORA: Concurrent DB/Redis writes (UPDATE / INSERT / DECR)
APP-->>CLI: 12 HTTP responses (status codes + JSON ledger bodies)
CLI->>ORA: Evaluate 3 Oracles (Ledger Post-State + WireDiffProxy + DbStateSnapshot)
Note over CLI,ORA: Overdraft (<0) or Lost Update (12x amount=80 -> same balance=10) => Sandbox: PROVEN
Note over CLI,ORA: Distinct arithmetic steps (920..40, min >= 0) => SerializedSolvent (SuspectUnverified)
Note over CLI,ORA: 1x 200 OK + 11x 409/429 Lock Rejections => Sandbox: MITIGATED
Instead of enumerating all simple paths between routes and sinks (which degrades to
1. Initialization: Entry route nodes are initialized with their route-registration and router-level middleware guards; interior nodes start at top ($\top = \mathcal{U}$ ). 2. 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. 3. 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.
ShellMind 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:
| Field / Badge | Value | Engine Origin | Exact Meaning & Required Evidence | |---|---|---|---| | 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). | | 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). | | 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 onzephyr ),revm concrete EVM exploit execution, Trojan-SourceCVE-2021-42574 Bidi overrides, or malicious binary PickleREDUCE opcodes. | | 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. | | Static Confidence | Confidence::Heuristic | All static crates | Intra-procedural or pattern-level risk lacking full caller/environment certainty (filterable via --min-confidence confirmed ). |
Every rule ID below maps 1-to-1 to RULE_CATALOG (177 built-in rules, CI-enforced against drift via tests/readme_catalog_sync.rs; inspect any rule offline with smg explain <RULE_ID>):
| Layer / --layers Filter | Canonical RULE_CATALOG IDs | Severity | Category & Invariant Checked | Required Guard / Sanitizer Disproof | |---|---|---|---|---| | 1secrets | 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 viaNEXT_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. | | 1config | 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 HIGHMEDIUM | App Config, Cloud IaC (Terraform/HCL) & .sql Policies: Wildcard CORS + credentials, unverifiedjwt.decode /alg: "none" , disabled TLS, weak config crypto,DEBUG=True , insecure cookies,ALLOWED_HOSTS=['*'] , proxy header smuggling, privilegedDockerfile , 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. | | 2deps | SMG-DEP-001 ,SMG-DEP-PROVEN ,SMG-DEP-SAFEAPI | CRITICAL HIGHLOW | Offline Lockfile & Call-Graph Reachability Audit: Parsespackage.json ,package-lock.json ,Cargo.toml ,Cargo.lock ,go.mod ,requirements.txt ,pyproject.toml ,poetry.lock , anduv.lock against embedded advisories and local SQLite OSV cache (smg deps sync ), upgrading imported vulnerable symbols toSMG-DEP-PROVEN and downgrading unreferenced symbols toSMG-DEP-SAFEAPI (with--openvex export). | Pin semver ranges, upgrade vulnerable packages, and export reachability-backed VEX ( --openvex ). | | 3sqli ·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-arrayCommand without shell,yaml.safe_load ,filepath.Clean + prefix check, and CIDR/host allowlists. | | 4auth ·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: MissingAuth 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 /pinnedredirect_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-stateWHERE status = ... guards. | | 5race ·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-functionA->B / B->A lock inversions (SMG-ENG-DEADLOCK ), syncMutex /RwLock held across.await (SMG-CONC-DEADLOCK ), leaked file/socket/DB handles on early error returns (SMG-ENG-LEAK ), C/C++/Rustunsafe buffer/UAF/uninit UB (SMG-MEM-BOUNDS ), and allocationa * 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. | | 6frontend ·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 MEDIUMLOW | Frontend ↔ Backend Contracts, OpenAPI/GraphQL & HTTP Framing: Frontend calls to non-existent backend routes (SMG-FE-404 ), swallowed rejections (SMG-FE-ERR ), token storage inlocalStorage (SMG-FE-STORAGE ), unverifiedpostMessage (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, verifyevent.origin , disable prod GraphQL introspection, require bearer OAuth schemes, and strip CRLF/untrustedHost . | | Cloud & Runtimecicd ·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 Actionspull_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. | | Mobilemobile | SMG-MOB-STORAGE ,SMG-MOB-IPC ,SMG-MOB-TLS | CRITICAL HIGH | Auto-Routed Mobile Security (Android/ iOS/ Flutter): Activated when AndroidManifest.xml ,Info.plist , orpubspec.yaml exist: plaintextSharedPreferences /UserDefaults /Hive secrets (SMG-MOB-STORAGE ), exported permissionless Android components / mutablePendingIntent / WebView bridges (SMG-MOB-IPC ), and trust-all TLS / cleartext ATS bypasses (SMG-MOB-TLS ). | Use EncryptedSharedPreferences /Keychain/FlutterSecureStorage , setandroid:exported="false" , and enforce strict TLS validation. | | Deep & Live DASTdeep (--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 HIGHMEDIUM LOWINFO | 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 with400/422 , and harden CSP/HSTS/cookie/CORS headers. |
Built as isolated, feature-gated workspace crates (default = ["hw", "web3", "pqc", "enterprise"]) with zero latency overhead on standard Web/AppSec repositories:
| Crate / Flag | Canonical RULE_CATALOG IDs | Severity | Mathematical / Execution Engine | Required Guard / Proof Tier | |---|---|---|---|---| | 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 HIGHMEDIUM | Hardware, Firmware & Kernel Verification: Parsescompile_commands.json , CMSIS-SVD peripherals (derivedFrom ,<addressBlock> ), and GNU.ld linker memory regions (SMG-HW-LINKER W^Xrwx &SMG-HW-STACK overlap/WCSD); runs width-maskedTnum &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. | | 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. | | 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 HIGHMEDIUM 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 emitsCycloneDX 1.5 Static CBOM (runtimeUnobserved: true ). | Migrates KEX to X25519MLKEM768 /ML-KEM-768+ , signatures toML-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. | | 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 BLAKE3MerkleAuditLog ( | Fails closed on debug-enabled enclaves ( TD_ATTR_DEBUG /DEBUG ), unpinned PCR0/MRTD measurements, expired/unverified enclave tokens, or non-HTTPS remote endpoints. | | 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 Jinja2chat_template SSTI inspection. | Enforces data spotlighting/sanitizers, pinned MCP tool schemas, weights_only=True /safetensors , and sandboxed Jinja2 environments. |
Why does an Apache-2.0 open-source repository include smg enterprise verify-license?
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 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.
- 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 10024X25519MLKEM768 ), upgradedSMG-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. - 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, Railsnull_session /ActiveRecord/DB.exec , JS/TSRegExp.exec() /React nonce scripts/linear ReDoS, Go/Python/C#/Java SAST, Solidity/Solanatoken_interface /Sui Movehas key, store capabilities, Go/Rust/C++/Python/Dart concurrency & handle-leak isolation, C/C++ UAF/double-free & firmware full-memberfree(h->field) /kfree +continue typestate, Android mobile, and secrets/crypto/AI/deps docstring & fixture hygiene, while enforcing512 KB monolithic AST/HW caps. - 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 onvllm ,aptos-core ,open-webui ,smartbugs , andrailsgoat (seeCHANGELOG.md for per-release details).
New in v1.5.5 — 10-Repo Real-World Scalability (>100x Faster smg-hw), Precision & Security Hardening
- 72k-File Embedded & Monorepo Scalability (zephyr >24m47s → 2m21s, smg-hw 14.94s): Eliminated eager#define macro map cloning per function and per branch insmg-hw (typestate_irq.rs , lazylookup_const_define , deterministic sortedcompile_unit_suffix_index ,65,536 -entry define cap), replaced the$O(N^2)$ ABBA lock-pair loop with an$O(P)$ hash index, upgradedcompute_wcsd_for_target to depth-valid memoization (min_valid_depth +500k step budget) with file-scoped resolution and single-pass Tree-sitter reuse, wiredcfg.scan.max_threads intosmg-hw , filtered non-embedded.ld scripts and generic desktop tokens (compile_commands.json /read_volatile /mmio ), added$O(N)$ pre-gates inai_mcp_model.rs and$O(1)$ bounds tracking inmemory.rs , and introduced--profile-phases /SMG_PROFILE_PHASES=1 timing telemetry. - Web3, Secrets & AI Precision Without Recall Loss: Added canonical defect-family deduplication insmg-web3 (0 same-lineSMG-WEB3-SOLANA +SMG-SOL-ARBITRARY-CPI duplicates onwormhole , scan time55.55s →29.29s ), Anchor PDA/pinned-address & hardcoded CPI program-ID recognition, and Sui/Aptos Movepublic(package) /public(friend) + capability witness handling; calibrated test/dev/sampleSMG-SEC-KEY paths (devenv/ ,demos/ ,samples/ ,localhost*.key /.pem ) while preservingOWASP/crAPI 30/30 tracked baseline findings (SQLI=1 ,AUTH=16 ,JWT=7 ,SEC_KEY=6 ); scopedLanguage::Config away from Python deserialization checks (.pre-commit-config.yaml =0 ), required loader context fortrust_remote_code=True , and calibratedbenchmarks/ /examples/ AI findings while keeping runtimetorch.load (vllm/model_executor/.../weight_utils.py ) atCRITICAL / Confirmed . - Go Concurrency, Trojan-Source (CVE-2021-42574), Sandbox Ledger Proof & Catalog Sync: Qualified Go struct receiver locks viaenclosing_type , package-scoped cross-file Go deadlock cycles, ignoredRLock -> RLock pairs, and made early-returnUnlock() 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 insmg-sandbox ; and enforced CI drift parity acrossRULE_CATALOG (172 rules), CLI subcommands, andREADME.md .
- Static Engine, SMT & Memory Typestate Precision: Bounded all remaining recursive AST walkers across 8 languages +
ast.rs, upgradedfilter_dominating_body_guardsto structural Tree-sitter AST dominance (withif/elseintersection, negated-exit promotion, and brace-free Ruby support), fixedmem_typestate.rsfree(p); p = p->next;RHS-before-rebind UAF +#ifdefTree-sitter function isolation + single-line Rust mutex drops, wiredFieldSensitivePointsTo&KCfaContextTable, enforced pre-sinkOwnershipCheck/CsrfProtection, added monotonicSymbolArenaoverflow IDs, priority-ranked deduplication, sort-disambiguated SMT-LIB2 declarations, and&mut x/mutating-method SMT invalidation. - Secrets, OpenVEX, Large Pickle ZIP EOCD & Multi-File IaC: Wired working-tree
GitleaksConfigcustom rules +trust_repo_config-gated allowlists, wiredAutoVexSymbolIndexinto--openvexOpenVEX v0.2.0 export, added bounded 64 KiB file-tail ZIPEOCD/Central Directory inspection (inspect_pickle_file_path) + strict ML pickle allowlist, and added cross-fileWorkspaceHclVars(.tfvars/variables.tf/aws_s3_bucket_public_access_block). - Frontier Domains (
smg-web3&smg-hw), Live DNS Pinning & Containment: Replaced Solana CPI booleans with field-specificvalidated_program_fields, added two-pass Solidity struct slot sizing +IERC20/enumDiamond ABI canonicalization +revmattacker-gain solvency, zero-storage ETH drain, and view-reentrancy probes; wiredsmg-hwinter-procedural WCSD (cycle/depth-safe) +SMG-HW-LINKERRWX checks +arg0-onlymemcpybounds; wired DNS pinning across all live HTTP engines &smg-ai; masked/app/.git&/app/.env*in Linuxbwrapand scoped macOS Seatbelt writes to per-runTMPDIR; wiredaudit_upgraded_starttls_streamintosmg tls --starttls, staged-indexgit checkout-indexpre-commit scanning, LAN-to-loopback proxy SSRF403, remote CDP loopback/RFC1918 blocking,smg http-audit --passive-only, asyncproxy_tuireplay/intruder, and full multi-domain--apply-check/ TUI[r]rescan.
(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.)
- Trust-Loader & Bounded Sensitive-File Discovery: Enforced
load_trusted_from_dir(stripping untrustedignore_pathson untrusted repos), preserved.gitignoreon source walks with a separate bounded sensitive-file pass + optional--no-gitignore, and tightened distro-aware OSV & OCI image parsing. - Static Engine & Domain Scanner Soundness: Fixed CFG guard-union polarity &
budget_exhaustedpropagation, upgraded middleware guard propagation to a true convergence fixpoint worklist, blockedpublic_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 synchronizedRULE_CATALOG. - 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, TDX48+120offset fix), hardened MCP/TUI/Sandbox/Reports, and madehooks/hooks.json,install.sh,install.ps1, and CI/Release workflows fail-closed with tag-parity &SHA256SUMS.txtprovenance attestation.
- 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. - 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 ). - 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). - Formal Core, STARTTLS, Confidential Computing & OpenVEX:smg scan --openvex ,smg tls --starttls smtp|imap|ftp ,smg verify-attestation --platform tdx|sev-snp|nitro , pure-RustQF_BV /QF_LIA (i128 GCD + Fourier-Motzkin) /k-CFA ($k=2$ ), loopback RFC 9113 HTTP/2 Single-PacketEND_STREAM race + DB snapshot diff, and polyglot multi-hunk semantic AST patcher.
| Language / DSL | Parser / AST Grammar ( Crate ) | Frameworks, Schemas & Idioms Extracted Automatically | |---|---|---| | 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 ) | | 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 | | 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 | | 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 | | PHP (.php ,.phtml ) | tree-sitter-php (smg-graph ) | Laravel (Route::get/post/... ,middleware('auth') ,DB::transaction ,DB::select ),Symfony (#[Route] ,#[IsGranted] ), PDOprepare() , PSR-4use resolution | | Java (.java ) | tree-sitter-java (smg-graph ) | Spring Boot / MVC (@RestController ,@RequestMapping ,@GetMapping /@PostMapping ,@PreAuthorize ,@Transactional ),JAX-RS (@Path ,@GET /@POST ), JDBCPreparedStatement | | 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 vsFromSqlInterpolated ) | | 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 ) | | 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 vssqlite3_prepare ) | | Dart (.dart ) | tree-sitter-dart (smg-graph ) | Dart Frog (routes/** onRequest ), Shelf (shelf_router router.get/post ), FlutterHive /FlutterSecureStorage ,rawQuery /rawUpdate /Process.run | | 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 | | 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 | | 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, dynamiccurl /wget SSRF,rm -rf path taint (clean onmktemp /printf '%q' /regex guards) | | 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 ) | | 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 | | Move (.move ) | Structural Move parser ( smg-web3 ) | Sui & Aptos modules ( public entry vs internalpublic(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 ) | | SQL Migrations (.sql ) | Structural SQL DDL/PLpgSQL analyzer ( smg-graph ) | SECURITY DEFINER dynamicEXECUTE format('%s') (SMG-CFG-SQL-EXEC ), missingSET search_path (SMG-CFG-SQL-SEARCHPATH ), disabled multi-tenant RLS (SMG-CFG-SQL-RLS ), andSUPERUSER privilege grants (SMG-CFG-SQL-PRIV ) |
Measured 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):
| Workload | Scope | Cold Scan | Warm Cached Scan | Notes | |---|---|---|---|---| | Enterprise TypeScript Monorepo | 575 directories / 13,225 .ts files | 414 ms | 195 ms | Full walk + BLAKE3 +Tree-sitter +76 ms ) | | 2,000-Node Cyclic Sink Chain | Stress test ( test_b11_2000_node_all_sink_chain_is_linear ) | < 15 ms | < 5 ms | Proves linear | | 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 ) | | MCP shellmind_guard_scan Tool Call | JSON-RPC 2.0 stdio round-trip | 19 ms | 4 ms | Zero LLM token overhead |
Every precision and recall figure in ShellMind Guard is backed by an auditable, reproducible ground-truth harness rather than subjective manual sampling:
- Deterministic Adversarial Corpus (
crates/smg-graph/tests/adversarial_precision_bench.rs):125paired vulnerable (67positive) and adversarial safe-twin (58negative) multi-file cases spanning 25 rule families and 6 trap classes (BaselineVuln,BaselineSafe,ScopeCollisionTrap,DominatorGuardTrap,OneHopWrapperTrap,CheckedBoundsTrap), gated on every CI push via:
SMG_ENFORCE_PRECISION_GATE=1 cargo test -p smg-graph --test adversarial_precision_bench -- --nocapture
(Automated hands-off on every code push, PR, release tag, and weekly schedule via .github/workflows/benchmarks.yml and 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.)
- External Vulnerable & Production Reference Baselines: -
OWASP/crAPI(1,062files): Evaluated against30 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 = 6inservices/chatbot/certs/server.key), verifying30/30(100%tracked-flaw recall) on every tuning pass.
expressjs/express(lib/*.jsproduction core): Evaluated at--min-confidence confirmed(--cidefault gate:HIGH/CRITICALnon-test findings), verifying0false positives on clean framework routing/middleware internals.
| Ground-Truth Suite / Rule Family | Positive Flaws ( TP ) | False Negatives ( FN ) | Safe Adversarial Twins ( TN ) | False Positives ( FP ) | Measured Recall | Measured Precision | |---|---|---|---|---|---|---| | SQLI — Parameterized $1 / ? & Allowlist Traps | 10 | 0 | 11 | 0 | 100.0% | 100.0% | | CMDI / SSTI / DESER — Argv Array & safe_load Traps | 12 | 0 | 4 | 0 | 100.0% | 100.0% | | AUTH & IDOR — AST Dominator & Router-Mount Traps | 7 | 0 | 7 | 0 | 100.0% | 100.0% | | AI / MCP — weights_only=True & Balanced-RTL Traps | 4 | 0 | 3 | 0 | 100.0% | 100.0% | | CICD & K8S — 40-Char SHA Pin & Pod Security Traps | 7 | 0 | 5 | 0 | 100.0% | 100.0% | | MEM / ENG / RACE — SELECT FOR UPDATE & Bounds Traps | 6 | 0 | 7 | 0 | 100.0% | 100.0% | | PATH / XSS / SSRF — Clean+Prefix & DOMPurify Traps | 7 | 0 | 5 | 0 | 100.0% | 100.0% | | SEC / SEC_CFG / CFG / IAC — SOPS, KMS & Placeholder Traps | 7 | 0 | 7 | 0 | 100.0% | 100.0% | | CRYPTO / OAUTH / STATE / QUEUE / ZIP / DOS / API / SMUGGLE / FE | 7 | 0 | 9 | 0 | 100.0% | 100.0% | | Total CI Adversarial Corpus (125 Cases across 25 Families) | 67 | 0 | 58 | 0 | 100.0% | 100.0% | | OWASP/crAPI Tracked Multi-Service Baseline (1,062 files) | 30 / 30 | 0 | — | — | 100.0%(tracked set) | Audited per release | | expressjs/express Production lib/ (HIGH+ CRITICAL, Confirmed+) | — | — | Production lib/ | 0 | — | 0 Confirmed+ FPs |
Cold 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):
| Target Repository | Files | v1.5.0 Baseline | v1.5.5 Measured | Speedup / Precision Delta | Engineering Root-Cause Fix | |---|---|---|---|---|---| | 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 | | 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 | | 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, runtimetorch.load CRITICAL kept |
| Repository | Ecosystem / Engine Focus | Files | Cold Scan Time | Throughput | Peak RSS | Verified v1.5.5 Telemetry & Highlights | |---|---|---|---|---|---|---| | 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 ) | | 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 ) | | 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 ) | | 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) | | 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 | | 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.loadCRITICAL intact | | 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 | | 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 | | 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 | | zephyrproject-rtos/zephyr | Embedded C / RTOS ( smg-hw ) | 71,953 | 141.32 s | 509 files/s | 991.7 MB | smg-hw completed in14.94 s ( 2,104 findings,349 Static-Proven ) | | 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 |
Both 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:
Linux & macOS:
curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/qira-dev/ShellMind-Guard/v1.9.8/install.sh | bash -s -- --version v1.9.8
Windows (PowerShell):
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/qira-dev/ShellMind-Guard/v1.9.8/install.ps1))) -Version v1.9.8
Run ShellMind Guard automatically on every push or pull request using the official composite action.yml (verifies release SHA256SUMS.txt automatically):
name: ShellMind Guard Security Scan
on: [push, pull_request]
permissions:
contents: read
security-events: write
jobs:
smg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: qira-dev/ShellMind-Guard@v1.9.8
with:
path: .
ci: true
fail-on: high
sarif: smg-results.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: smg-results.sarif
Use Standalone CLI (smg or shellmind-guard) or Load as an AI Coding Plugin (Claude Code / MCP + Skills + Commit Hook):
# 0. Launch interactive TUI workspace directly (default when running `smg` in an interactive terminal)
smg
# 1. Verify binary, sandbox backend, cgroups v2, git, advisory cache & AI readiness (add --probe-ai to test Ollama/API)
smg doctor .
# 2. Install standalone Git pre-commit hook (scans staged git index locally with zero AI cost)
smg hook install .
# 3. Install shell auto-completions (bash, zsh, fish, powershell)
smg completions bash > ~/.local/share/bash-completion/completions/smg
# 4. Install as a Claude Code plugin from GitHub Marketplace (Claude Code 2.1.275+)
/plugin marketplace add qira-dev/ShellMind-Guard
/plugin install shellmind-guard@shellmind-guard
# Or load a local clone directly (provides MCP tools, /shellmind-guard:guard-scan, /shellmind-guard:guard-fix & PreToolUse hook)
claude --plugin-dir /path/to/ShellMind-Guard
git clone https://github.com/qira-dev/ShellMind-Guard.git
cd ShellMind-Guard
# Install both `smg` (default short binary) and `shellmind-guard` into ~/.cargo/bin (with all frontier crates)
cargo install --path . --locked
# Or build the lightweight core binary without optional frontier crates (`hw`, `web3`, `pqc`, `enterprise`)
cargo install --path . --no-default-features --locked
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.
# Auto-detect project stack, write .shellmind-guard.toml, and generate .github/workflows/shellmind-guard.yml
smg init /path/to/your/repo --ci
# Human-readable colored terminal report with rustc-style source snippets & summary bar
smg scan /path/to/your/repo
# Machine-readable or PR-ready reports (text | compact | table | markdown | json | sarif)
smg scan /path/to/your/repo --format table
smg scan /path/to/your/repo --format markdown --output security-report.md
smg scan /path/to/your/repo --format sarif --cyclonedx bom-vex.cdx.json --openvex out.vex.json
smg scan /path/to/your/repo --changed-since origin/main --ci
# Filter specific static, cloud-native, or frontier layers:
# (auth,race,concurrency,taint,sqli,cmdi,path,ssrf,xss,csrf,idor,secrets,config,deps,frontend,
# cicd,k8s,dos,zip,crypto,queue,api,ai,oauth,smuggle,state,engine,memory,mobile,hw,web3,pqc,deep)
smg scan /path/to/your/repo --layers secrets,sqli,xss,csrf,idor,race,ai,api,k8s --min-confidence confirmed
smg scan /path/to/firmware-repo --layers hw --ci
smg scan /path/to/defi-repo --layers web3 --ci
smg scan /path/to/your/repo --compliance pqc --cbom cbom.cdx.json --ci
smg scan /path/to/your/repo --write-baseline .smg-baseline.json
smg scan /path/to/your/repo --baseline .smg-baseline.json --exclude-rule SMG-CFG-CORS --ci
# Inspect all 177 built-in guard rules or explain vulnerable vs fixed code patterns
smg rules --layer race
smg explain SMG-RACE-001
# Opt-in sync of local offline SQLite OSV advisory DB (or import offline JSON bundle) & check status
smg deps sync /path/to/your/repo
smg deps sync --from-file /path/to/osv.json
smg deps status
Run ShellMind Guard against the included vulnerable Node/TypeScript payment fixture (fixtures/vuln-payment-node) to see static findings upgraded to Sandbox: PROVEN via live bwrap execution and 12-way barrier-synchronized race probing:
smg scan fixtures/vuln-payment-node \
--boot-cmd "node server.mjs" \
--sarif .shellmind-guard/report.sarif \
--html .shellmind-guard/report.html
(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).)
Verbatim 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):
ShellMind Guard Scan | 5 files (8 symbols, 6 edges, 2 routes) | 485ms (delta: +0 / 5 cached)
2 finding(s) detected | CRIT:1 HIGH:1 MED:0 LOW:0 PROVEN:2 | [AUTH/IDOR=1 RACE/LOCK=1]
[HIGH] [PROVEN] SMG-AUTH-001 (SMG-AUTH-001) -> Unauthenticated path to BalanceUpdate in `debitBalance`
Entry: POST /api/v1/checkout/withdraw
[1] src/routes/checkout.ts:8 POST /api/v1/checkout/withdraw
[2] src/services/ledger.ts:3 processWithdrawal
[3] src/db/queries.ts:1 debitBalance
[CRITICAL] [PROVEN] SMG-RACE-001 (SMG-RACE-001) -> Missing transaction/lock guard before `debitBalance` (Double-Spend Risk)
Entry: POST /api/v1/checkout/withdraw
[1] src/routes/checkout.ts:8 POST /api/v1/checkout/withdraw
[2] src/services/ledger.ts:3 processWithdrawal
[3] src/db/queries.ts:1 debitBalance
ShellMind Guard Sandbox Proof (bwrap=isolated):
[PROVEN] SMG-AUTH-001 (SMG-AUTH-001) -> Unauthenticated request executed with HTTP 200 (payload: {"ok":true,"balance":90})
[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])
Simply 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:
| Corroboration Layer | Module & Function | Invariant Checked | Verdict When Sufficient Balance Serializes Cleanly | |---|---|---|---| | 1. JSON Ledger Post-State Classifier | verifier.rs::classify_race_ledger_bodies | Inspects numeric ledger fields ( balance ,remaining ,credits ,available ,stock ) across all2xx responses against requestamount : 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 withmin >= 0 ) is classifiedSerializedSolvent →SuspectUnverified(never marked PROVEN) . | | 2. Wire-Level DB/Redis Mutation Oracle | wire_oracle.rs::WireDiffProxy +apply_wire_diff_corroboration | Counts non-idempotent TCP wire write frames ( UPDATE /INSERT / RedisDECRBY ) emitted during a single barrier burst ([WireDiffProxy: N non-idempotent write mutation frames] ). | 0..1 write frames or409 /429 lock rejection preservesMitigated /SuspectUnverified . | | 3. Pre/Post DB Conservation Snapshot Diff | h2_race_snapshot.rs::diff_db_snapshots | Compares before vsafter DbStateSnapshot (balances ,row_counts ) againstexpected_net_delta andmax_allowed_row_growth during RFC 9113 HTTP/2 single-packet bursts. | Atomic single withdrawal ( alice: 100 -> 0 ,rows: +1 ) yieldsviolated: false . |
# Replay live exploit proof for a specific finding instance ID and print minimal <= 2048 B witness context
smg replay SMG-RACE-002 fixtures/vuln-payment-node \
--boot-cmd "node server.mjs" \
--patch
# Apply a unified diff inside an isolated temporary workspace and verify mitigation across all domains
smg replay SMG-SQLI-001 /path/to/your/repo \
--patch-file fix.diff \
--apply-check
# Simply run bare `smg` in any repository, or pass explicit UI/sandbox filters:
smg ui fixtures/vuln-payment-node --deep --boot-cmd "node server.mjs"
- [j] / [k] / ↑ / ↓ / Mouse Click: Navigate and select findings in the sorted queue (PROVEN > SEVERITY > Confidence ) - [/] / [c] / [f/1-4]: Live fuzzy search (/ ), cycle Guard Category (c ), or filter Severity/Status (f /1-4 ) - [Enter] / [r]: Run non-blocking background bwrap exploit replay or delta-cached live rescan with animated spinner - [z] / [ / ] / \: Toggle full-pane Source Inspector zoom ( z ) and scroll source code lines ([ /] or mouse wheel) - [p] (then [a] / [y]): Generate & inspect colorized unified patch diff /<= 2 KB prompt, and run isolated--apply-check (a ) - [e] / [y]: Open exact witness hop file:line in$VISUAL /$EDITOR (e ), or copy finding/patch via OSC 52 (y ) - [g] / [s] / [L]: Export HTML/SVG graph ( g ), SARIF 2.1.0 (s ), or toggle Event Log drawer (L )
All 23 built-in subcommands exposed by smg / shellmind-guard (src/lib.rs):
| Domain | Subcommand | Purpose & Safety Posture | |---|---|---| | Core Static, Sandbox & TUI | smg /smg ui [PATH] | Launch panic-safe 60fps 4-workspace ratatui TUI (with live replay, diff preview &--apply-check ). | | | smg init [PATH] [--ci] [--hook] | Auto-detect project stack, scaffold .shellmind-guard.toml , CI workflow, and optional git hook. | | | smg index [PATH] [--json] | Run parallel ignore walker +BLAKE3 hashing + SQLite WAL delta index synchronization. | | | smg scan [PATH] [FLAGS] | Run full multi-layer static + frontier scan with optional --boot-cmd sandbox proof, SARIF, VEX & CBOM. | | | smg replay <ID> [PATH] | Re-execute an isolated sandbox PoC for a finding ID ( --patch ,--patch-file ,--apply-check ). | | | smg rules [--layer <L>] [--json] | Browse all 177 built-in rules inRULE_CATALOG filtered by layer. | | | smg explain <ID> [--path <P>] | Show vulnerable vs fixed code examples for a rule ID or exact source witness hops for a finding ID. | | Agent, Git & Environment | smg mcp | Start newline-delimited stdio JSON-RPC 2.0 MCP server for AI coding agents. | | | smg hook install\|uninstall\|status | Manage standalone staged-index Git pre-commit secret & config guard hook. | | | smg completions <SHELL> | Generate shell completion scripts ( bash ,zsh ,fish ,powershell ). | | | smg doctor [PATH] [--probe-ai] | Audit local sandbox backend ( bwrap /Seatbelt/WSL2),cgroups v2 , git, OSV DB, and AI readiness. | | 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. | | | smg dast <URL> [--spa] [--passive-only] | Proof-based active DAST crawler + headless Chrome CDP ( cdp_engine.rs ) DOM XSS flows. | | | smg sqli <URL> [FLAGS] | Non-destructive differential SQLi prover across query, form, JSON, GraphQL, multipart, headers & cookies. | | | smg idor --config <FILE> | 2-user ( User A vsUser B ) authorization / IDOR / BFLA regression verifier (--allow-mutations loopback-only). | | | smg templates <TARGET> [--oob-server] | Nuclei-compatible YAML engine ( http ,ssl ,websocket ,headless ,file ,flow multi-step). | | | smg oob serve [--listen <ADDR>] | Self-hosted loopback TCP HTTP + UDP callback listener for interactsh -style OOB verification. | | | smg proxy [--mitm-ca] [export-ca] | Localhost HTTP/HTTPS inspection proxy with TUI history, Repeater, Intruder & ECDSA P-256 CA. | | Supply Chain, Crypto & TEE | smg deps sync\|status | Sync OSV.dev advisories (or --from-file airgapped bundle) into offline SQLiteadvisories.db . | | | smg image <TAR_OR_ROOTFS> | OCI/Docker image .tar /.tar.gz & rootfs OS (dpkg /apk ) + app lockfile CVE scanner. | | | smg tls <HOST:PORT> [--starttls <P>] | Live TLS/STARTTLS protocol, cipher, HSTS, X.509 & hybrid PQC ( X25519MLKEM768 ) auditor. | | | smg verify-attestation --platform ... | Offline fail-closed cryptographic verifier for tdx ,sev-snp , andnitro binary attestation quotes. | | | 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. |
Runtime exploit verification (smg replay / --boot-cmd) adapts to the host operating system's native containment primitives; isolation strength varies by OS:
| Host OS | Sandbox Backend | Filesystem & Sensitive Path Masking | Network & Process Isolation | Notes / Trade-offs | |---|---|---|---|---| | Linux | bubblewrap (bwrap --unshare-all ) | Read-only bind mounts + masked /app/.git &/app/.env* , per-runtmpfs | Full kernel user, PID, mount & network namespace isolation (loopback-only) + optional RLIMIT_AS /cgroups v2 | Strongest isolation tier; requires bubblewrap installed on host. | | 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. | | 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. |
ShellMind 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.
Add the following to your .mcp.json, ~/.claude.json, or .cursor/mcp.json:
{
"mcpServers": {
"shellmind-guard": {
"command": "shellmind-guard",
"args": ["mcp"]
}
}
}
| Tool Name | Input Schema | Description | |---|---|---| | 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. | | shellmind_guard_explain_finding | { "path"?: string, "finding_id": string } | Resolves a finding instance id (e.g.SMG-RACE-002 ) or canonicalrule_id (e.g.SMG-SQLI-001 ,SMG-FUZZ-SCHEMA ) and returns exact source lines around every hop inwitness_path , a<= 2 KB patch prompt, and concrete remediation guidance. | | 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 . |
ShellMind Guard works out of the box with zero configuration, or can be customized via .shellmind-guard.toml in your repository root:
[guards]
# Functions, decorators, or middleware identifiers treated as authentication guards
auth_guards = [
"requireAuth", "authenticate", "verifyJwt", "withAuth", "requireAdmin",
"ensureAuthenticated", "AuthGuard", "UseGuards", "protectedProcedure",
"login_required", "AuthMiddleware"
]
# Wrappers or SQL clauses treated as concurrency / transaction lock guards
lock_guards = [
"withTransaction", "FOR UPDATE", "acquireLock", "idempotencyKey",
"BeginTx", "db.Transaction", "$transaction"
]
# Intentionally unauthenticated routes (suppresses SMG-AUTH-001 only; never suppresses SQLi/CMDi/Race)
public_routes = [
"/health", "/healthz", "/readyz", "/metrics",
"/login", "/register", "/signup", "/webhook"
]
# Custom router registration methods (if your framework wraps standard HTTP verbs)
custom_routes = []
[scan]
ignore_paths = ["node_modules", "target", "dist", "build", ".next", ".shellmind-guard"]
max_threads = 4
max_file_bytes = 2097152
[sandbox]
# Default boot command, loopback base_url (http:// or https://), IDOR/body overrides, and resource/mock hardening
# boot_cmd = "node server.mjs"
# base_url = "http://127.0.0.1:3000"
# user_a_header = "Authorization: Bearer token-user-a"
# user_b_header = "Authorization: Bearer token-user-b"
# probe_body = '{"amount": 100}'
# memory_limit_mb = 512
# use_cgroup_v2 = false
# mock_shims = false
[ai]
# Opt-in only (disabled by default = zero network calls; requires --trust-repo-config)
# provider = "disabled" # "disabled" | "ollama" | "openai_compatible"
# endpoint = "http://127.0.0.1:11434"
# model = "qwen2.5-coder:7b"
# api_key_env = "OPENAI_API_KEY"
ShellMind 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):
ShellMind-Guard/
├── Cargo.toml # Workspace root (Rust 2024 Edition, `unsafe_code = "forbid"`)
├── action.yml # Official SHA256-verified composite GitHub Action
├── .github/workflows/
│ ├── ci.yml # Cross-OS CI matrix (Ubuntu, macOS, Windows + Clippy + Dogfood gate)
│ ├── benchmarks.yml # Zero-maintenance precision, O(V+E) scaling & phase-latency CI scorecard
│ └── release.yml # Tag-parity check, 5-target release matrix & SLSA provenance attestation
├── scripts/
│ └── run_benchmarks.sh # Reproducible offline precision & phase-latency benchmark runner
├── .claude-plugin/
│ ├── plugin.json # Claude Code / agent plugin manifest & icon
│ └── marketplace.json # GitHub marketplace index (`qira-dev/ShellMind-Guard`)
├── .mcp.json # Standalone & plugin stdio MCP configuration (`shellmind-guard mcp`)
├── hooks/hooks.json # PreToolUse `Bash|PowerShell` secret/config commit guard hook
├── skills/
│ ├── guard-scan/SKILL.md # `/shellmind-guard:guard-scan` MCP + CLI workflow
│ └── guard-fix/SKILL.md # `/shellmind-guard:guard-fix` all-rule remediation + `--apply-check`
├── src/
│ ├── bin/smg.rs # Short primary CLI (`smg`; launches TUI directly on interactive TTY)
│ ├── main.rs # Compatibility alias binary (`shellmind-guard`)
│ ├── lib.rs # Unified 23-subcommand CLI entrypoint & module exports
│ ├── cli.rs # Clap CLI argument definitions across all 23 subcommands
│ ├── commands/ # Subcommand dispatch handlers (`scan`, `replay`, `ui`, `init`, live engines, etc.)
│ ├── pipeline.rs # Multi-phase static, frontier & sandbox scan orchestration
│ ├── render.rs # Terminal, table, compact, markdown, JSON & SARIF output formatting
│ ├── baseline.rs # Baseline diffing & suppression management
│ ├── hooks.rs # Staged-index Git pre-commit & Claude Code hook runner
│ ├── rules_catalog.rs # Re-export of `smg_graph::RULE_CATALOG` (177 rules) + shell completion generator
│ └── mcp.rs # Stdio JSON-RPC 2.0 Model Context Protocol server (`<= 32 KiB` bounded responses)
├── tests/
│ └── readme_catalog_sync.rs # CI drift gate verifying `RULE_CATALOG` <-> emitted rules <-> `README.md` parity
├── crates/
│ ├── smg-core/ # .shellmind-guard.toml config, ignore::WalkParallel + BLAKE3 scanner,
│ │ # 19-language/DSL enum, SQLite WAL + FTS5 store & local `advisories.db` index
│ ├── smg-graph/ # Parallel Tree-sitter AST across 16 core languages + `.sql` DDL analyzer,
│ │ # domain routing (`web`/` system_engine`/` mobile`/cloud/AI), `RULE_CATALOG` (177 rules),
│ │ # Phase 9/10 cross-file field/closure taint, SMT (`QF_BV`/` QF_LIA`) & O(V+E) Lattice
│ ├── smg-dynamic/ # Unified `SafeHttpClient`, live DAST/CDP (` dast_audit.rs`, `cdp_engine.rs`),
│ │ # SQLi (`sqli_audit.rs`), IDOR (` idor_audit.rs`), Nuclei (` templates_audit.rs`),
│ │ # OOB (`oob_server.rs`), MITM Proxy (` proxy.rs`, `proxy_mitm.rs`), TLS/X.509/PQC
│ │ # (`tls_audit.rs`), passive HTTP/OpenAPI/GraphQL (` http_audit.rs`), OCI (` oci_image.rs`),
│ │ # OSV sync (`deps_sync.rs`) & opt-in live verifier (` live_verify.rs`)
│ ├── smg-sandbox/ # Linux Bubblewrap (`--unshare-all`) + macOS Seatbelt + Windows WSL2/Job Object,
│ │ # Last-Byte Sync + ledger/wire/DB race oracles, rustls TLS loopback & `--deep` fuzzing
│ ├── smg-report/ # SARIF 2.1.0, CycloneDX 1.5 VEX, OpenVEX v0.2.0 & HTML/SVG witness graph exporter
│ ├── smg-tui/ # Panic-safe 60fps 4-workspace `ratatui` UI, proxy TUI & Side-by-Side Diff modal
│ ├── smg-ai/ # Deterministic polyglot AST codemods, 3-iter CEGIS loop & opt-in TLS patcher
│ ├── smg-hw/ # Isolated `--features hw` Firmware/MMIO/Tnum/Octagon/IRQ/Boot/Linker/DMA verifier
│ ├── smg-web3/ # Isolated `--features web3` `tree-sitter-solidity` (17th Tree-sitter grammar),
│ │ # structural Move parser, Solana Anchor AST & in-process `revm` v43.0.3 EVM oracle
│ ├── smg-pqc/ # Opt-in `--features pqc` Shor/Grover/Mosca HNDL, X.509/ELF audit & CycloneDX CBOM
│ └── smg-enterprise/ # Isolated `--features enterprise` Nitro/TDX/SEV-SNP TEE attestation, BLAKE3 Merkle
│ # audit log & remote enclave Ed25519 admission-token verifier
└── fixtures/
├── vuln-payment-node/ # Runnable multi-file Node/TS double-spend race, SQLi & auth fixture
└── vuln-auth-rust/ # Multi-file Rust Axum unauthenticated role-mutation fixture
Further engineering documentation:
docs/BLUEPRINT.md— Master System Architecture, Lattice Mathematics & Sandbox Isolation Specdocs/PLANNING.md— Module Specifications, Crate Stack & Engineering Risk Matrixdocs/ROADMAP.md— Phase-by-Phase Engineering Milestones & Verification Gatesdocs/ROADMAP_PHASES_21_26.md— Frontier & Formal Engine Phase Specs (Phases 21–26)SECURITY.md— Sandbox Isolation Model & Vulnerability Disclosure PolicyCONTRIBUTING.md— Architecture Invariants & Developer Contribution Guideaction.yml— Official Composite GitHub Action (SHA256-Verified CI Gate & SARIF Export)CHANGELOG.md— Release History
External 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:
- Read the Engineering Invariants & 4-Step Rule Protocol: Follow
CONTRIBUTING.md(O(V + E)lattice complexity, single-passTree-sitter+OnceLock<Regex>, fail-closed untrusted repo config, pairedTP+TNadversarial safe-twins, andRULE_CATALOGsync). - Run the Local Verification & Benchmark Gate:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
bash scripts/run_benchmarks.sh
Licensed under the Apache License, Version 2.0.
原文来源:github.com