Repository navigation
DevGuard v1.3.0 — AST Virtual Folding & Resilient Evasion Defense Engine
LatestWhat's Changed in DevGuard v1.3.0
DevGuard v1.3.0 introduces the Lexical Constant Folding Engine (Pass-V & SpanMap), Non-Scoring Dynamic Import Visibility (DG004-DYN-01/02), and hardened Anti-Evasion Detectors (DG008-EV-01 & DG005-EV-01), while maintaining a strict Zero-Runtime Dependency policy ("dependencies": {}).
🚀 Highlights
Lexical Constant Folding Engine & Virtual View (Pass-V & SpanMap)
-
Deterministic Virtual Folding (
FOLD-03→FOLD-01→FOLD-02→FOLD-04): Synthesizes virtual source codeVto defeat lexical evasion—including string concatenation ("ch" + "ild_process"), no-interpolation backtick templates, string array.join(), and safe bracket-to-dot member access (obj["member"]). -
Strict
$O(\log N)$ Coordinate Mapping (SpanMap): Binary-search interval mapping accurately projects folded virtual[line, endLine]spans back to original source positionsOfor GitHub PR inline review suggestions, inline suppressions, and SARIF reporting ([via-fold]). -
Multi-Tiered DoS Guards & Priority Budgeting: Enforces hard deterministic caps (
MAX_FOLD_DEPTH = 4,MAX_FOLD_OPERANDS = 64,MAX_FOLDED_LENGTH = 4096,MAX_FOLD_EDITS = 2000,MAX_BACKSCAN = 256) with priority scheduling for security-sensitive sinks and deduplicated SARIFfold_limit_exceeded(level: "note") notifications.
Non-Scoring Dynamic Import & Require Visibility (DG004-DYN-01 & DG004-DYN-02)
- Runtime Specifier Visibility: Detects non-literal
import(expr)andrequire(expr)calls (with localrequireshadow guard) to surface dynamic dependency loading without penalizing repository health scores (severity: "warning",properties.scoring: false). - Linear-Time Allowlist Matching: Evaluates base-branch
.devguard.jsonpath rules using linear-time glob matching (matchLinearGlob) immune to ReDoS backtracking.
Anti-Evasion Detectors (DG008-EV-01 & DG005-EV-01)
DG008-EV-01: Detects unbounded asynchronousdo { ... } while (true | 1)loops with scope-aware nestedbreak/returnstripping and retry-counter mutation validation.DG005-EV-01: Detects swallowed Promise.catch(() => {})rejections across critical transaction, authentication, and database receiver chains while respecting immediate cleanup calls (unlink,rmSync,close,JSON.parse).
Precision & Usability Enhancements
- False Positive Hardening: Eliminated false positives on benign
RegExp.prototype.exec(), DOM helpers (page.$eval()), and JS/TS method declarations (async exec() {}), and expandedDG004coverage for 2-argumentimport()and multi-line folded imports. - Expanded File Discovery & Coverage Telemetry: Added automatic support for
.mjs,.cjs,.mts, and.cts, explicitpartialcoverage reporting for.py, andN/Ascore semantics when0code files are analyzed. - CLI & CI Reliability: Added
--version/-vCLI flag support and deterministic in-process test execution across Linux (Node 22) and Windows.
📊 Benchmark & Validation Metrics
- Corpus Benchmark: Evaluated across 129 curated test cases (
48 TP,63 TNwith0corpus false positives,18 EVASIONvectors, and6newly solved evasions). - Pass-O vs Pass-O+V Performance Gate:
+8.21%median overhead across the full 129-case corpus (+1.44%on non-fold baseline cases), well within the<= +25%release gate. - External OSS Validation: Audited 10 public JS/TS repositories (
4,318analyzed files) offline with0crashes and0analysis failures. - Test Suite: 82/82 passing scenarios (
Corpus Benchmark+Tests 1–81integration suite). - Runtime Dependencies:
0("dependencies": {}).