@yagyeshvyas/vibeguard 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,63 +1,183 @@
1
- # Changelog
2
-
3
- All notable changes to VibeGuard are documented here.
4
- Format based on [Keep a Changelog](https://keepachangelog.com/).
5
-
6
- ## [Unreleased]
7
-
8
- ### Added
9
- - `vibeguard auto` — one-command full autonomous protection. Activates
10
- daemon (file watcher), pre-commit hook, post-edit hook, and shell guard.
11
- Idempotent. `--stop` reverses everything and restores backups. `--status`
12
- shows what's active. `--ci` for pipeline mode. `--fix` for safe auto-fixes.
13
- `--no-shell` to skip shell hook. `--strict` to block on HIGH too.
14
- - `src/auto.js` orchestrator composing existing modules (scanner, daemon,
15
- hook, shell-guard). All state under `.vibeguard/auto.json`.
16
- - Shell hook FP fix: default-allow policy. Unknown commands are allowed.
17
- Only block on known dangerous patterns. Fail-open on module load errors.
18
- Both `shell-hook.sh` and `shell-hook.ps1` now try multiple module paths
19
- and never block when VibeGuard can't load.
20
-
21
- ### Changed
22
- - Taint analysis upgraded from regex-only to scope-aware, AST-based dataflow
23
- (`taint-ast.js`). Sources/sinks matched on AST nodes (MemberExpression /
24
- CallExpression), not text. Respects block/function scope with shadowing,
25
- clears taint on clean reassignment, recognizes sanitizers (parseInt,
26
- path.basename, DOMPurify.sanitize, etc. — configurable array). Tracks
27
- cross-function taint within a file via intra-function fixpoint. All
28
- AST-confirmed findings carry `confidence: "high"` and `dataflow: true`.
29
- Regex taint retained as fallback for unparseable files. Finding object
30
- shape unchanged (ruleId/severity/title/message/fix preserved).
31
-
32
- ### Added
33
- - Cross-file taint analysis via import/export graph (`crosstaint.js`)
34
- - Optional AST mode with acorn + acorn-typescript (`ast.js`)
35
- - `vibeguard doctor` — AI host security audit (hook injection, base URL hijack, MCP config)
36
- - `vibeguard history` — git history secret scan
37
- - `vibeguard watch` — re-scan on file change
38
- - `vibeguard rules` / `vibeguard explain` — rule listing and documentation
39
- - Live key verification (`--verify-keys`) for OpenAI + Stripe
40
- - Inline suppressions (`vibeguard-ignore-line` / `vibeguard-ignore-next-line`)
41
- - Project config (`.vibeguardrc.json`) with ignoreRules, ignorePaths, severityOverrides
42
- - .gitignore-aware secret scanning
43
- - Stable finding fingerprints for SARIF + baseline diffing
44
- - External scanner support: semgrep, gitleaks, bandit
45
- - 15 secret types (GitHub, Slack, GitLab, Twilio, SendGrid, Mailgun, Telegram, npm, Resend, connection strings, public-LLM-key)
46
- - AI security rules (browser-api-key, disabled-sandbox, eval-llm-output, prompt-injection-marker)
47
- - Injection rules (prototype pollution, ReDoS, XXE, CRLF)
48
- - Framework rules (Prisma raw, React dangerous HTML, reflected XSS)
49
- - IaC rules (Dockerfile, GitHub Actions, Terraform)
50
- - Package hygiene (unpinned deps, dangerous scripts, no lockfile)
51
- - 63 tests, all passing
52
-
53
- ## [0.1.0] - Initial release
54
- - Core scanner with secrets, injection, auth, config, PII rules
55
- - Fix → verify loop with baseline + rollback
56
- - MCP server (5 tools)
57
- - Live URL scan
58
- - Badge generation
59
- - One-command multi-client installer
60
- - Pre-commit hook
61
- - GitHub Actions CI template
62
- - SARIF 2.1.0 output
63
- - Zero runtime dependencies (scanner)
1
+ # Changelog
2
+
3
+ All notable changes to VibeGuard are documented here.
4
+ Format based on [Keep a Changelog](https://keepachangelog.com/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ### Added
9
+ - Self-integrity verification. `vibeguard self-check` now cryptographically
10
+ verifies the CONTENT of its critical security modules (action-guard,
11
+ shell-guard, interceptor, firewall, rules, scanner, taint, mcp-audit, …)
12
+ against a shipped SHA-256 manifest (`src/integrity.json`), not just that they
13
+ load. Detects a patched/neutered guard — e.g. `inspectAction` rewritten to
14
+ always allow, or a rule file gutted — which a load-only check missed. Manifest
15
+ is regenerated on `prepublishOnly` (and via `npm run integrity`). Honest limit:
16
+ detects source tampering, not a full chain of trust; verify npm provenance for
17
+ the trust anchor. `src/integrity.js`, `scripts/gen-integrity.js`.
18
+ - Agent Action Firewall — `vibeguard guard-action` + `guard_action` MCP tool +
19
+ `src/action-guard.js` (`inspectAction`). Real-time "nothing leaks" guard:
20
+ inspect any agent action (shell / network / file-write / prompt / MCP call)
21
+ BEFORE it runs and block secret or personal-data exfiltration. Hard rule — an
22
+ API key or PII (email, SSN, credit card, phone) never leaves to an external
23
+ host: secrets blocked unconditionally, PII blocked (or warn), local/allowlisted
24
+ hosts permitted. Also blocks cloud-metadata credential theft, secrets written
25
+ to web-served paths, and secrets in LLM prompts. `sanitizeOutbound()` redacts
26
+ instead of dropping. 100% offline, fail-closed on the block path. A guard, not
27
+ a sandbox.
28
+ - `vibeguard agent-scan` — AI Agent Security Posture (new `agent_scan` MCP tool
29
+ too). One graded verdict — "is my AI-agent setup safe?" — aggregating every
30
+ agent-era check into threat categories: MCP-server trust, PII/secret leakage
31
+ to LLM providers, LLM output reaching exec/eval/SQL/DOM, prompt injection,
32
+ agent capability/loop safety, and hallucinated dependencies. Pure offline
33
+ orchestration of already-tested modules (mcp-audit + ai-guard + the `ai.*`
34
+ rule family). `--fail-on <level>` to gate CI.
35
+ - `vibeguard mcp-audit` — MCP server security audit (new `mcp_audit` MCP tool
36
+ too). Audits the MCP servers an agent is configured to trust
37
+ (`.mcp.json` / `.cursor/mcp.json` / `.vscode/mcp.json`) for tool poisoning
38
+ (prompt injection in server args/descriptions), unpinned auto-install
39
+ (`npx -y` rug-pull surface), remote-code / shell commands, hardcoded secrets
40
+ in `env`, over-broad filesystem grants, and **definition drift** — a server
41
+ whose config changed since you approved it (classic MCP rug-pull). 100%
42
+ offline: reads config only, never runs a server. Pins server-definition
43
+ hashes under `.vibeguard/mcp-pins.json`; `--pin` re-baselines after review.
44
+ - `vibeguard scan --staged` — scan only git-staged files. Ideal for a
45
+ pre-commit hook: fast and scoped to exactly what's being committed. Per-file
46
+ only (cross-file analysis skipped, and the CLI says so).
47
+ - `vibeguard scan --no-suppress` — CI trust mode. Ignores inline
48
+ `vibeguard-ignore` comments and the heuristic false-positive filter so a
49
+ careless or hostile inline comment in a PR cannot silence a gate. Deliberate
50
+ project config (ignoreRules/ignorePaths) is still honored.
51
+ - Fail-loud coverage tracking. Every analysis pass (taint, python-taint, AST,
52
+ file-rules) that errors is now recorded instead of silently swallowed. Scan
53
+ results carry `engine` (`ast` | `regex-only`) and `diagnostics`
54
+ (degraded passes, parse-failed files, degraded file count). The CLI prints a
55
+ loud banner when running `regex-only` (acorn missing) or when any file was
56
+ only partially analyzed — a degraded scan no longer masquerades as clean.
57
+ - `vibeguard scan --strict` — exit code 3 when any file scanned degraded, so CI
58
+ never trusts an incomplete result. **Note:** existing CI configs that add
59
+ `--strict` will now hard-fail on degraded scans (intended).
60
+ - Benchmark quality gate: `node test/benchmark/run.js --gate` fails (exit 2) if
61
+ overall precision/recall/F1 regress below a floor (P≥80% / R≥78% / F1≥80%;
62
+ override via `VIBEGUARD_BENCH_MIN_*`). Wired into CI so detection quality
63
+ regressions block merges.
64
+ - ReDoS / pathological-input regression tests + coverage-transparency tests.
65
+ - Engine mode + degraded-coverage now surfaced in JSON output and the MCP
66
+ `scan` tool (payload + summary) so agents don't treat a degraded scan as an
67
+ all-clear.
68
+ - `VIBEGUARD_NO_POSTINSTALL=1` (and CI auto-detect) to silence the install
69
+ message.
70
+ - README `Coverage & Limits` section: honest per-language detection-depth
71
+ matrix, engine-mode explainer, fail-loud explainer, and an explicit "the
72
+ shell guard is a mistake-catcher, not a sandbox" statement.
73
+ - `vibeguard auto` — one-command full autonomous protection. Activates
74
+ daemon (file watcher), pre-commit hook, post-edit hook, and shell guard.
75
+ Idempotent. `--stop` reverses everything and restores backups. `--status`
76
+ shows what's active. `--ci` for pipeline mode. `--fix` for safe auto-fixes.
77
+ `--no-shell` to skip shell hook. `--strict` to block on HIGH too.
78
+ - `src/auto.js` orchestrator composing existing modules (scanner, daemon,
79
+ hook, shell-guard). All state under `.vibeguard/auto.json`.
80
+ - Shell hook FP fix: default-allow policy. Unknown commands are allowed.
81
+ Only block on known dangerous patterns. Fail-open on module load errors.
82
+ Both `shell-hook.sh` and `shell-hook.ps1` now try multiple module paths
83
+ and never block when VibeGuard can't load.
84
+
85
+ ### Performance
86
+ - Incremental scanning: `vibeguard scan --changed` only rescans files whose
87
+ content changed since the last scan (SHA-256 hash cache under
88
+ `.vibeguard/cache`). Warm re-scan of an unchanged tree drops from ~600ms to
89
+ ~5ms in local testing (~100×+). Per-file only — cross-file taint/rules are
90
+ skipped in this mode and the CLI says so; run a full scan for those. Intended
91
+ for pre-commit and watch loops.
92
+ - Fixed: the scanner no longer walks its own `.vibeguard/` cache/baseline
93
+ artifacts (added to the skip-dirs list).
94
+ - Scanner ~50% faster (108ms → 54ms/file on the repo's own source). Three
95
+ behavior-preserving changes, verified identical findings + unchanged benchmark
96
+ (95 TP / 15 FP / 16 FN):
97
+ 1. Memoize the global-flag regex per rule — the hot path was recompiling a
98
+ fresh `RegExp` per rule *per line* (~64% of scan time).
99
+ 2. Hoist the `fileFilter` check out of the per-line loop (it depends only on
100
+ the path) and cache the compiled filter.
101
+ 3. Provably-safe literal prefilter: skip a rule when a mandatory literal from
102
+ its regex is absent from the line, avoiding the regex entirely. Never
103
+ introduces a false negative (bails on alternation, ignores optional/grouped
104
+ literals). Guarded by unit tests + a throughput regression test.
105
+
106
+ ### Fixed
107
+ - Interceptor: wrapped `fs.readFileSync` called itself instead of the saved
108
+ original, causing infinite recursion / stack overflow on any uncached file
109
+ read after activation. Now calls the original. Regression test added.
110
+
111
+ ### Changed
112
+ - Agent Action Firewall now blocks UNKNOWN-format secrets, not just known vendor
113
+ patterns. An outbound field named like a credential (`apiKey`, `secret`,
114
+ `password`, `client_secret`, `private_key`, `access_key`, …) carrying a
115
+ high-entropy value is blocked from leaving to an external host — so a custom
116
+ API key or session secret that matches no known regex can't exfiltrate either.
117
+ Precise by design: the credential NAME plus real entropy avoids false
118
+ positives on content hashes, UUIDs, ids, env-var references, and low-entropy
119
+ placeholders (all verified). Ambiguous names (token/bearer/session) are
120
+ intentionally excluded to avoid breaking legitimate auth traffic.
121
+ - Runtime interceptor now delegates to the unified Agent Action Firewall
122
+ (`action-guard.inspectAction`). Every wrapped `fetch` / `http` / `exec` /
123
+ `execSync` call is checked with the hardened, shared logic — so obfuscated
124
+ commands (base64, `$IFS`, variable indirection) and secrets embedded in a
125
+ request URL are now blocked at runtime, which the interceptor's old naive
126
+ `.includes()` check missed. `CONFIG.allowDomains` are honored as trusted
127
+ destinations. Protection is automatic once the interceptor is active — no
128
+ per-call `guard_action` needed.
129
+ - Python taint analysis rewritten as single-pass taint propagation (still pure
130
+ JS — no external parser, keeps VibeGuard zero-dependency and offline). Tracks
131
+ tainted variables through intermediate assignments (`q = "..." + data` →
132
+ `execute(q)`) and clears taint on clean reassignment. Fixes false positives
133
+ where a tainted name merely appeared near an unrelated sink. Parameterized SQL
134
+ (`execute("... %s ...", (params,))`) and inline-sanitized sinks
135
+ (`eval(int(x))`, `os.system(shlex.quote(x))`) are not flagged; unsafe
136
+ concatenation / f-string flows still fire.
137
+ - Shell guard normalizer hardened. Now substitutes ALL variable assignments
138
+ (previously only the first, a real bypass: `A=rm; B=-rf; $A $B /`), handles
139
+ `$IFS` word-splitting and `/usr/bin/rm`, and iterates to a fixpoint so layered
140
+ obfuscation unwinds. Still, by design, a mistake-catcher — not a sandbox.
141
+ - CI workflow renamed `test.yml` → `ci.yml` to match the README status badge.
142
+ - Taint analysis upgraded from regex-only to scope-aware, AST-based dataflow
143
+ (`taint-ast.js`). Sources/sinks matched on AST nodes (MemberExpression /
144
+ CallExpression), not text. Respects block/function scope with shadowing,
145
+ clears taint on clean reassignment, recognizes sanitizers (parseInt,
146
+ path.basename, DOMPurify.sanitize, etc. — configurable array). Tracks
147
+ cross-function taint within a file via intra-function fixpoint. All
148
+ AST-confirmed findings carry `confidence: "high"` and `dataflow: true`.
149
+ Regex taint retained as fallback for unparseable files. Finding object
150
+ shape unchanged (ruleId/severity/title/message/fix preserved).
151
+
152
+ ### Added
153
+ - Cross-file taint analysis via import/export graph (`crosstaint.js`)
154
+ - Optional AST mode with acorn + acorn-typescript (`ast.js`)
155
+ - `vibeguard doctor` — AI host security audit (hook injection, base URL hijack, MCP config)
156
+ - `vibeguard history` — git history secret scan
157
+ - `vibeguard watch` — re-scan on file change
158
+ - `vibeguard rules` / `vibeguard explain` — rule listing and documentation
159
+ - Live key verification (`--verify-keys`) for OpenAI + Stripe
160
+ - Inline suppressions (`vibeguard-ignore-line` / `vibeguard-ignore-next-line`)
161
+ - Project config (`.vibeguardrc.json`) with ignoreRules, ignorePaths, severityOverrides
162
+ - .gitignore-aware secret scanning
163
+ - Stable finding fingerprints for SARIF + baseline diffing
164
+ - External scanner support: semgrep, gitleaks, bandit
165
+ - 15 secret types (GitHub, Slack, GitLab, Twilio, SendGrid, Mailgun, Telegram, npm, Resend, connection strings, public-LLM-key)
166
+ - AI security rules (browser-api-key, disabled-sandbox, eval-llm-output, prompt-injection-marker)
167
+ - Injection rules (prototype pollution, ReDoS, XXE, CRLF)
168
+ - Framework rules (Prisma raw, React dangerous HTML, reflected XSS)
169
+ - IaC rules (Dockerfile, GitHub Actions, Terraform)
170
+ - Package hygiene (unpinned deps, dangerous scripts, no lockfile)
171
+ - 63 tests, all passing
172
+
173
+ ## [0.1.0] - Initial release
174
+ - Core scanner with secrets, injection, auth, config, PII rules
175
+ - Fix → verify loop with baseline + rollback
176
+ - MCP server (5 tools)
177
+ - Live URL scan
178
+ - Badge generation
179
+ - One-command multi-client installer
180
+ - Pre-commit hook
181
+ - GitHub Actions CI template
182
+ - SARIF 2.1.0 output
183
+ - Zero runtime dependencies (scanner)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yagyesh Vyas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.