vigilsutra 0.2.2 → 0.4.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +34 -28
  3. package/advisories/db.json.gz +0 -0
  4. package/agents/agents-registry.json +14 -2
  5. package/agents/agentshield/SKILL.md +12 -0
  6. package/agents/apishield/SKILL.md +12 -0
  7. package/agents/codeguard/SKILL.md +1 -1
  8. package/agents/compliancemap/SKILL.md +12 -0
  9. package/agents/datashield/SKILL.md +12 -0
  10. package/agents/identityguard/SKILL.md +12 -0
  11. package/agents/mobileshield/SKILL.md +12 -0
  12. package/agents/pipelineguard/SKILL.md +12 -0
  13. package/agents/remedy/SKILL.md +12 -0
  14. package/agents/riskrank/SKILL.md +12 -0
  15. package/agents/secretwatch/SKILL.md +1 -1
  16. package/agents/supplywatch/SKILL.md +12 -0
  17. package/agents/threatmap/SKILL.md +12 -0
  18. package/agents/webshield/SKILL.md +12 -0
  19. package/dist/adapters.js +35 -19
  20. package/dist/advisories.js +83 -0
  21. package/dist/cli.js +101 -30
  22. package/dist/components.js +116 -0
  23. package/dist/engine.js +99 -13
  24. package/dist/fix.js +85 -0
  25. package/dist/git-index.js +17 -6
  26. package/dist/git-objects.js +558 -0
  27. package/dist/policy.js +21 -2
  28. package/dist/redact.js +7 -1
  29. package/dist/rules/code.js +23 -6
  30. package/dist/rules/index.js +3 -2
  31. package/dist/rules/secrets.js +72 -0
  32. package/dist/rules/supply.js +103 -0
  33. package/dist/rules/util.js +29 -16
  34. package/dist/scope.js +3 -4
  35. package/dist/taint.js +83 -0
  36. package/docs/agent-contract.md +1 -1
  37. package/docs/assurance/benchmark.md +2 -0
  38. package/docs/assurance/coverage-raw.txt +151 -111
  39. package/docs/assurance/coverage.md +26 -18
  40. package/docs/assurance/fuzzing.md +1 -1
  41. package/docs/assurance/internal-review.md +3 -1
  42. package/docs/ci-cd.md +13 -4
  43. package/docs/compatibility.md +4 -4
  44. package/docs/index.html +75 -0
  45. package/docs/quickstart.md +5 -3
  46. package/docs/rules.md +92 -2
  47. package/docs/security-model.md +1 -1
  48. package/llms.txt +2 -2
  49. package/package.json +3 -2
  50. package/policies/safe-default.yaml +3 -0
  51. package/templates/pre-commit +7 -0
package/docs/rules.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rules (version 1.0.0)
1
+ # Rules (version 1.2.0)
2
2
 
3
3
  Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`. CWE ids are orientation only; no standards control mapping is asserted (mapping unverified).
4
4
 
@@ -10,6 +10,12 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
10
10
  | VS-SECRET-004 | Hardcoded credential assigned to a secret-named variable | medium | medium | potential | SecretWatch | CWE-798 |
11
11
  | VS-SECRET-005 | Slack token in source | high | high | confirmed | SecretWatch | CWE-798 |
12
12
  | VS-SECRET-006 | Tracked environment file with a secret value | medium | medium | potential | SecretWatch | CWE-312, CWE-798 |
13
+ | VS-SECRET-007 | JSON Web Token in source | medium | medium | potential | SecretWatch | CWE-798 |
14
+ | VS-SECRET-008 | npm access token in source | high | high | confirmed | SecretWatch | CWE-798 |
15
+ | VS-SECRET-009 | Stripe secret key in source | high | high | confirmed | SecretWatch | CWE-798 |
16
+ | VS-SECRET-010 | Google API key in source | high | medium | potential | SecretWatch | CWE-798 |
17
+ | VS-SECRET-011 | Azure storage account key in source | high | high | confirmed | SecretWatch | CWE-798 |
18
+ | VS-SECRET-012 | GitLab personal access token in source | high | high | confirmed | SecretWatch | CWE-798 |
13
19
  | VS-CICD-001 | GitHub Action not pinned to a commit SHA | low | high | potential | PipelineGuard | CWE-829 |
14
20
  | VS-CICD-002 | pull_request_target workflow checks out pull-request code | high | medium | potential | PipelineGuard | CWE-829, CWE-94 |
15
21
  | VS-CICD-003 | Workflow grants write-all permissions | medium | high | confirmed | PipelineGuard | CWE-250, CWE-732 |
@@ -36,6 +42,10 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
36
42
  | VS-PRIV-001 | Possible personal data or credential written to logs | medium | low | potential | PrivacyLens | CWE-532 |
37
43
  | VS-PRIV-002 | Third-party analytics or tracking SDK referenced | info | medium | informational | PrivacyLens | |
38
44
  | VS-PROC-001 | No security policy file found | info | high | informational | Prime | |
45
+ | VS-SUPPLY-001 | Dependency fetched over an unauthenticated URL | high | high | confirmed | SupplyWatch | CWE-829 |
46
+ | VS-SUPPLY-002 | Dependency version is a wildcard | medium | medium | potential | SupplyWatch | CWE-829 |
47
+ | VS-SUPPLY-003 | Install script downloads code | medium | medium | potential | SupplyWatch | CWE-829 |
48
+ | VS-SUPPLY-004 | Dependency version matches a recorded advisory | high | high | confirmed | SupplyWatch | CWE-1395 |
39
49
 
40
50
  ## Details
41
51
 
@@ -87,6 +97,54 @@ A `.env` file (not an example, sample, or template) contains a secret-named vari
87
97
  - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
88
98
  - **False positives:** Placeholder values and non-secret settings. `.env.example`, `.env.sample`, and `.env.template` are not reported. A local `.env` that git does not track is not a finding.
89
99
 
100
+ ### VS-SECRET-007: JSON Web Token in source
101
+
102
+ A string with the three-part JWT compact shape (header.payload.signature) is committed. The match proves the shape, not that the token is still accepted.
103
+
104
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
105
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
106
+ - **False positives:** Documentation samples and tokens that were already revoked. Public, non-sensitive sample tokens still look the same.
107
+
108
+ ### VS-SECRET-008: npm access token in source
109
+
110
+ A string matching an npm access token (npm_ plus 36 or more token characters) is committed.
111
+
112
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
113
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
114
+ - **False positives:** Revoked tokens and values that only share the npm_ prefix.
115
+
116
+ ### VS-SECRET-009: Stripe secret key in source
117
+
118
+ A string matching a Stripe secret or restricted key (sk_live_, sk_test_, rk_live_, rk_test_) is committed.
119
+
120
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
121
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
122
+ - **False positives:** Revoked keys. Publishable keys (pk_) are not matched.
123
+
124
+ ### VS-SECRET-010: Google API key in source
125
+
126
+ A string matching a Google API key (AIza plus 35 characters) is committed. The match proves the shape, not which API it can call.
127
+
128
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
129
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
130
+ - **False positives:** Keys restricted to a public client and already-rotated keys. Restrict or rotate if the repository was shared.
131
+
132
+ ### VS-SECRET-011: Azure storage account key in source
133
+
134
+ An Azure Storage connection string contains an AccountKey value.
135
+
136
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
137
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
138
+ - **False positives:** Documentation that shows the AccountKey name with a placeholder shorter than 40 characters.
139
+
140
+ ### VS-SECRET-012: GitLab personal access token in source
141
+
142
+ A string matching a GitLab personal access token (glpat-) is committed.
143
+
144
+ - **Fix:** Treat the credential as compromised: revoke or rotate it at the issuer first, then remove it from the repository and load it from an environment variable or secret manager. Deleting it from the latest commit does not remove it from git history.
145
+ - **Verify:** Re-run `vigilsutra audit` after removing the value; then confirm the credential was rotated at the issuer and review git history for earlier exposure.
146
+ - **False positives:** Revoked tokens.
147
+
90
148
  ### VS-CICD-001: GitHub Action not pinned to a commit SHA
91
149
 
92
150
  A third-party action is referenced by a mutable tag or branch. If the tag is moved or the publisher is compromised, the workflow runs attacker-controlled code.
@@ -193,7 +251,7 @@ An IAM statement allows `*` actions, which grants administrator-level power to w
193
251
 
194
252
  ### VS-CODE-001: Dynamic code execution (eval / new Function / exec)
195
253
 
196
- Strings are compiled and executed as code. If any part is attacker-influenced this is remote code execution. This rule matches the call, not the data flow.
254
+ Strings are compiled and executed as code. If any part is attacker-influenced this is remote code execution. Confidence is raised when the argument name traces to a request-like assignment in this project, including through a relative import. Object fields, dynamic imports, and function calls are not tracked.
197
255
 
198
256
  - **Fix:** Replace with a data-driven approach (lookup table, JSON.parse, ast.literal_eval). Never pass user input to an evaluator.
199
257
  - **Verify:** The call is removed or its argument is proven constant; add a test with a malicious input.
@@ -294,3 +352,35 @@ No SECURITY.md was found, so reporters have no documented way to disclose vulner
294
352
  - **Fix:** Add SECURITY.md with a private contact or GitHub private vulnerability reporting link and a response expectation.
295
353
  - **Verify:** SECURITY.md exists at the repository root, `.github/` or `docs/`.
296
354
  - **False positives:** Policy kept in an org-level `.github` repository.
355
+
356
+ ### VS-SUPPLY-001: Dependency fetched over an unauthenticated URL
357
+
358
+ A package manifest downloads a dependency with http:// or git://. Those URLs can be changed in transit. No advisory database is consulted.
359
+
360
+ - **Fix:** Pin a trusted version from the official registry over HTTPS. Review install scripts before they run.
361
+ - **Verify:** Re-run `vigilsutra audit` after the manifest change.
362
+ - **False positives:** An internal registry that is only reachable over plain HTTP on a network you trust. Prefer HTTPS anyway.
363
+
364
+ ### VS-SUPPLY-002: Dependency version is a wildcard
365
+
366
+ A package.json dependency is `*`, `latest`, or empty, so a later install can resolve to a different version. This is not a vulnerability match.
367
+
368
+ - **Fix:** Pin a trusted version from the official registry over HTTPS. Review install scripts before they run.
369
+ - **Verify:** Re-run `vigilsutra audit` after the manifest change.
370
+ - **False positives:** A private tool that regenerates the lockfile in the same change. The lockfile, when present, is what the install actually uses.
371
+
372
+ ### VS-SUPPLY-003: Install script downloads code
373
+
374
+ A package.json lifecycle script (preinstall, install, or postinstall) downloads or pipes remote content. The script runs on install. The remote body was not fetched.
375
+
376
+ - **Fix:** Pin a trusted version from the official registry over HTTPS. Review install scripts before they run.
377
+ - **Verify:** Re-run `vigilsutra audit` after the manifest change.
378
+ - **False positives:** A script that downloads a checksum-pinned artifact inside a build you already review.
379
+
380
+ ### VS-SUPPLY-004: Dependency version matches a recorded advisory
381
+
382
+ A resolved package version falls inside a range recorded in the advisory database shipped with VigilSutra. The database is a snapshot, not a live feed, and the scan does not call the network.
383
+
384
+ - **Fix:** Upgrade to the fixed version named in the finding, then re-run the audit. If the database has no fix, remove the package or replace it.
385
+ - **Verify:** The lockfile resolves to a version outside the recorded range. Re-run `vigilsutra audit`.
386
+ - **False positives:** An advisory withdrawn after this database was built, or a version the range comparison mis-orders because it is not numeric semver.
@@ -14,4 +14,4 @@ Guarantees by design (tested unless noted):
14
14
  | Untrusted repo content | Instruction-like text in scanned files is a finding, never a command. |
15
15
  | Non-destructive installs | Adapters preview, never overwrite without `--force`, uninstall only manifest-listed files. |
16
16
 
17
- Known gaps: obfuscation can evade patterns; lines over 2000 characters are skipped by line rules; ReDoS resistance of every regex is not formally proven; the tool does not sandbox itself at OS level.
17
+ Known gaps: obfuscation can evade patterns; long lines are scanned in 2,000-character windows, so a match split across a window boundary can be missed; ReDoS resistance of every regex is not formally proven; the tool does not sandbox itself at OS level. When inode is 0, a swap that keeps the same size and mtime is not detected. Git history stops at the time limit, and a blob over 1 MiB is skipped. SHA-1 and SHA-256 object ids are both read. The advisory file is a snapshot from 2026-11-07, not a live feed, and a match does not prove the vulnerable function runs. Name tracking does not follow object fields, dynamic imports, or function returns. `vigilsutra fix --apply` writes only the deterministic edits it printed; it does not delete a secret.
package/llms.txt CHANGED
@@ -1,11 +1,11 @@
1
1
  # VigilSutra AI
2
2
 
3
- > VigilSutra AI (CLI: `vigilsutra`) is an open-source, offline-first security and privacy auditor for codebases, created by Vatsal Shah. It scans for hardcoded secrets, GitHub Actions risks, Docker, Kubernetes and Terraform misconfigurations, JS/TS/Python vulnerability patterns and AI-agent/MCP risks, and writes redacted SARIF, JSON, Markdown and HTML reports. It needs no API key and sends no data anywhere. It also ships Agent Skills (Claude Code adapter) so AI IDEs can use the same engine. License: Apache-2.0. Repository: https://github.com/shahvatsalofficial/vigilsutra
3
+ > VigilSutra AI (CLI: `vigilsutra`, v0.4.0) is an open-source, offline-first security and privacy auditor for codebases, created by Vatsal Shah. It scans for hardcoded secrets (including git history for SHA-1 and SHA-256 repos), GitHub Actions risks, Docker, Kubernetes and Terraform misconfigurations, JS/TS/Python patterns, a shipped advisory snapshot, and AI-agent/MCP risks, and writes redacted SARIF, JSON, Markdown and HTML reports plus a CycloneDX SBOM. It needs no API key and sends no data anywhere. It ships Agent Skills and file-copy adapters for Claude Code, Cursor, Codex, Gemini CLI, and Copilot. License: Apache-2.0. Repository: https://github.com/shahvatsalofficial/vigilsutra
4
4
 
5
5
  Key facts for assistants:
6
6
  - Runs locally on Node.js 20+; no telemetry, no network access, never executes scanned code.
7
7
  - Findings separate severity from confidence and mark each as confirmed or potential.
8
- - Not a pentest tool and not a compliance certification. Pattern-based; no taint analysis. Does not scan dependencies or git history in v0.1.
8
+ - Not a pentest tool and not a compliance certification. Pattern-based. A request-like name is tracked through a relative import; object fields, dynamic import, and function returns are not. Git history runs until the time limit (1 MiB blob cap) for SHA-1 and SHA-256. Advisory matches use the shipped 2026-11-07 snapshot, not a live feed. `vigilsutra fix` is a dry run unless `--apply`. Recall on the 18-repo study was not measured, and that study was not re-run for 0.4.0. There is no independent human review.
9
9
 
10
10
  ## Docs
11
11
  - [README](https://github.com/shahvatsalofficial/vigilsutra/blob/main/README.md): overview, commands, feature matrix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigilsutra",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "VigilSutra AI: open-source, offline-first security and privacy auditor CLI plus AI agent skills. Finds secrets, CI/CD, Docker, Kubernetes, IaC, code and AI-agent risks with redacted, evidence-based SARIF/JSON/Markdown reports. No API key, no telemetry.",
5
5
  "keywords": [
6
6
  "security",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "Apache-2.0",
29
29
  "author": "Vatsal Shah",
30
- "homepage": "https://github.com/shahvatsalofficial/vigilsutra#readme",
30
+ "homepage": "https://shahvatsalofficial.github.io/vigilsutra/",
31
31
  "repository": {
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/shahvatsalofficial/vigilsutra.git"
@@ -47,6 +47,7 @@
47
47
  "schemas",
48
48
  "docs",
49
49
  "templates",
50
+ "advisories",
50
51
  "README.md",
51
52
  "LICENSE",
52
53
  "NOTICE",
@@ -9,3 +9,6 @@ maxFiles: 20000
9
9
  timeLimitMs: 60000
10
10
  # failOn: high
11
11
  disableRules: []
12
+ # A waiver hides one rule on one path until the UTC date (inclusive). Expired waivers do not hide findings.
13
+ # waivers:
14
+ # - VS-CODE-001|src/legacy.js|your-name|2026-12-31
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ # Installed by `vigilsutra init --hook`. Scans the git index. Does not scan unstaged files.
3
+ if ! command -v vigilsutra >/dev/null 2>&1; then
4
+ echo "vigilsutra: not on PATH. Install it, or remove .git/hooks/pre-commit." >&2
5
+ exit 1
6
+ fi
7
+ exec vigilsutra audit . --staged --fail-on high --no-report --no-history