vigilsutra 0.4.2 → 0.5.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 +51 -0
- package/README.md +32 -2
- package/dist/cli.js +95 -20
- package/dist/clock.js +8 -0
- package/dist/components.js +127 -53
- package/dist/custom-rules.js +86 -0
- package/dist/decode.js +9 -0
- package/dist/engine.js +52 -15
- package/dist/fix.js +2 -3
- package/dist/git-objects.js +17 -7
- package/dist/policy.js +23 -10
- package/dist/redact.js +1 -1
- package/dist/reporters/annotations.js +13 -0
- package/dist/reporters/index.js +9 -2
- package/dist/reporters/rich.js +10 -7
- package/dist/rules/agents-privacy.js +28 -0
- package/dist/rules/code.js +74 -2
- package/dist/rules/index.js +1 -1
- package/dist/rules/infra.js +184 -15
- package/dist/rules/secrets.js +17 -7
- package/dist/rules/util.js +54 -14
- package/dist/scope.js +2 -5
- package/dist/suggest.js +18 -0
- package/docs/rules.md +132 -6
- package/llms.txt +2 -2
- package/package.json +1 -2
- package/policies/safe-default.yaml +3 -2
package/docs/rules.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Rules (version 1.
|
|
1
|
+
# Rules (version 1.6.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
|
|
|
@@ -16,10 +16,18 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
|
|
|
16
16
|
| VS-SECRET-010 | Google API key in source | high | medium | potential | SecretWatch | CWE-798 |
|
|
17
17
|
| VS-SECRET-011 | Azure storage account key in source | high | high | confirmed | SecretWatch | CWE-798 |
|
|
18
18
|
| VS-SECRET-012 | GitLab personal access token in source | high | high | confirmed | SecretWatch | CWE-798 |
|
|
19
|
+
| VS-DB-001 | Database accepts connections without a password | high | high | potential | InfraGuard | CWE-306 |
|
|
20
|
+
| VS-DB-002 | Database or search engine security switched off | high | medium | potential | InfraGuard | CWE-306 |
|
|
21
|
+
| VS-IAC-004 | Database or storage exposed publicly | high | high | potential | InfraGuard | CWE-284 |
|
|
22
|
+
| VS-IAC-005 | Access granted to everyone | high | medium | potential | InfraGuard | CWE-732 |
|
|
23
|
+
| VS-K8S-004 | Pod mounts a host path | medium | high | potential | ContainerGuard | CWE-668 |
|
|
24
|
+
| VS-K8S-005 | Container adds a dangerous Linux capability | high | medium | potential | ContainerGuard | CWE-250 |
|
|
25
|
+
| VS-K8S-006 | RBAC role grants a wildcard | high | high | potential | ContainerGuard | CWE-269 |
|
|
26
|
+
| VS-COMPOSE-001 | Compose service has host-level access | high | high | confirmed | ContainerGuard | CWE-250 |
|
|
19
27
|
| VS-CICD-001 | GitHub Action not pinned to a commit SHA | low | high | potential | PipelineGuard | CWE-829 |
|
|
20
28
|
| VS-CICD-002 | pull_request_target workflow checks out pull-request code | high | medium | potential | PipelineGuard | CWE-829, CWE-94 |
|
|
21
29
|
| VS-CICD-003 | Workflow grants write-all permissions | medium | high | confirmed | PipelineGuard | CWE-250, CWE-732 |
|
|
22
|
-
| VS-CICD-004 | Untrusted GitHub context interpolated into a
|
|
30
|
+
| VS-CICD-004 | Untrusted GitHub context interpolated into a script step | high | medium | potential | PipelineGuard | CWE-78, CWE-77 |
|
|
23
31
|
| VS-DOCKER-001 | Container runs as root (no USER instruction) | medium | high | confirmed | ContainerGuard | CWE-250 |
|
|
24
32
|
| VS-DOCKER-002 | Base image uses :latest or no tag | low | high | confirmed | ContainerGuard | CWE-829 |
|
|
25
33
|
| VS-DOCKER-003 | Remote script piped into a shell during build | medium | medium | potential | ContainerGuard | CWE-494 |
|
|
@@ -36,6 +44,12 @@ Generated from the rule definitions by `node docs/gen-rules.mjs > docs/rules.md`
|
|
|
36
44
|
| VS-CODE-005 | TLS certificate verification disabled | high | high | confirmed | CodeGuard | CWE-295 |
|
|
37
45
|
| VS-CODE-006 | Weak hash algorithm (MD5 / SHA-1) | low | low | potential | CodeGuard | CWE-327 |
|
|
38
46
|
| VS-CODE-007 | Raw HTML sink (innerHTML / dangerouslySetInnerHTML) | medium | low | potential | CodeGuard | CWE-79 |
|
|
47
|
+
| VS-CODE-008 | Request data used as a database query (NoSQL injection) | high | medium | potential | CodeGuard | CWE-943 |
|
|
48
|
+
| VS-CODE-009 | Request data used as a file path (path traversal) | high | medium | potential | CodeGuard | CWE-22 |
|
|
49
|
+
| VS-CODE-010 | Request data used as an outbound URL (SSRF) | high | medium | potential | CodeGuard | CWE-918 |
|
|
50
|
+
| VS-CODE-011 | Redirect target taken from the request (open redirect) | medium | medium | potential | CodeGuard | CWE-601 |
|
|
51
|
+
| VS-CODE-012 | Session cookie protection switched off | medium | medium | potential | CodeGuard | CWE-1004, CWE-614 |
|
|
52
|
+
| VS-AGENT-004 | Hidden Unicode characters in code or agent instructions | medium | high | potential | AgentShield | CWE-1007 |
|
|
39
53
|
| VS-AGENT-001 | Instruction file tries to override agent safety or scope | medium | low | potential | AgentShield | CWE-1427 |
|
|
40
54
|
| VS-AGENT-002 | Agent configuration disables permission prompts | high | medium | potential | AgentShield | CWE-250 |
|
|
41
55
|
| VS-AGENT-003 | MCP server launched via unpinned remote package | low | medium | potential | AgentShield | CWE-829 |
|
|
@@ -95,7 +109,7 @@ A `.env` file (not an example, sample, or template) contains a secret-named vari
|
|
|
95
109
|
|
|
96
110
|
- **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.
|
|
97
111
|
- **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.
|
|
98
|
-
- **False positives:** Placeholder values and non-secret settings. `.env.example`, `.env.sample`, and `.env.template` are
|
|
112
|
+
- **False positives:** Placeholder values and non-secret settings. `.env.example`, `.env.sample`, and `.env.template` are left to VS-SECRET-004, which reports values that look real. A local `.env` that git does not track is not a finding.
|
|
99
113
|
|
|
100
114
|
### VS-SECRET-007: JSON Web Token in source
|
|
101
115
|
|
|
@@ -145,6 +159,70 @@ A string matching a GitLab personal access token (glpat-) is committed.
|
|
|
145
159
|
- **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
160
|
- **False positives:** Revoked tokens.
|
|
147
161
|
|
|
162
|
+
### VS-DB-001: Database accepts connections without a password
|
|
163
|
+
|
|
164
|
+
A setting lets a database accept logins with no password (PostgreSQL `trust`, or an allowed empty MySQL or MariaDB password).
|
|
165
|
+
|
|
166
|
+
- **Fix:** Require a password from a secret store and use `scram-sha-256` for PostgreSQL.
|
|
167
|
+
- **Verify:** A connection without a password is refused.
|
|
168
|
+
- **False positives:** Throw-away databases in local development or CI that no other host can reach.
|
|
169
|
+
|
|
170
|
+
### VS-DB-002: Database or search engine security switched off
|
|
171
|
+
|
|
172
|
+
Redis protected mode, Elasticsearch or OpenSearch security, or MongoDB authorization is disabled.
|
|
173
|
+
|
|
174
|
+
- **Fix:** Enable authentication and bind the service to a private network.
|
|
175
|
+
- **Verify:** An unauthenticated request is refused.
|
|
176
|
+
- **False positives:** Local development setups that no other host can reach.
|
|
177
|
+
|
|
178
|
+
### VS-IAC-004: Database or storage exposed publicly
|
|
179
|
+
|
|
180
|
+
A Terraform setting makes a database publicly accessible, or turns off a block on public storage access.
|
|
181
|
+
|
|
182
|
+
- **Fix:** Keep databases in private networks and leave public access blocks enabled.
|
|
183
|
+
- **Verify:** The plan shows public access disabled.
|
|
184
|
+
- **False positives:** Buckets or databases that are public by documented design.
|
|
185
|
+
|
|
186
|
+
### VS-IAC-005: Access granted to everyone
|
|
187
|
+
|
|
188
|
+
A policy grants access to `*`, `allUsers` or `allAuthenticatedUsers`.
|
|
189
|
+
|
|
190
|
+
- **Fix:** Name the accounts, roles or service principals that need access, or add a restricting condition.
|
|
191
|
+
- **Verify:** The grant names specific principals.
|
|
192
|
+
- **False positives:** Public website objects, and statements narrowed by a condition. Check the condition.
|
|
193
|
+
|
|
194
|
+
### VS-K8S-004: Pod mounts a host path
|
|
195
|
+
|
|
196
|
+
A `hostPath` volume exposes files of the node to the pod. A writable or sensitive path lets a compromised container take over the node.
|
|
197
|
+
|
|
198
|
+
- **Fix:** Use a persistent volume, ConfigMap or emptyDir. If a node agent needs the path, mount it read-only and as narrowly as possible.
|
|
199
|
+
- **Verify:** No `hostPath` volume remains, or the exception is documented and read-only.
|
|
200
|
+
- **False positives:** Node agents such as log collectors that must read one specific path.
|
|
201
|
+
|
|
202
|
+
### VS-K8S-005: Container adds a dangerous Linux capability
|
|
203
|
+
|
|
204
|
+
Adding `ALL`, `SYS_ADMIN`, `SYS_MODULE`, `SYS_PTRACE` or `NET_ADMIN` gives the container powers close to root on the host.
|
|
205
|
+
|
|
206
|
+
- **Fix:** Drop all capabilities and add only a narrow one the workload is shown to need.
|
|
207
|
+
- **Verify:** The capability is gone from `add` or `cap_add` and the workload still runs.
|
|
208
|
+
- **False positives:** Network and storage agents that need the capability.
|
|
209
|
+
|
|
210
|
+
### VS-K8S-006: RBAC role grants a wildcard
|
|
211
|
+
|
|
212
|
+
A Role or ClusterRole lists `*` as a verb or resource, which grants far more than a workload needs.
|
|
213
|
+
|
|
214
|
+
- **Fix:** List the exact verbs and resources, and prefer a namespaced Role.
|
|
215
|
+
- **Verify:** No `*` remains in `verbs` or `resources`.
|
|
216
|
+
- **False positives:** Cluster administration roles that are bound only to operators.
|
|
217
|
+
|
|
218
|
+
### VS-COMPOSE-001: Compose service has host-level access
|
|
219
|
+
|
|
220
|
+
`privileged: true`, host network or PID mode, or a mounted Docker socket lets the service control the host.
|
|
221
|
+
|
|
222
|
+
- **Fix:** Remove the setting. If a tool needs the Docker API, put a filtering proxy in front of the socket.
|
|
223
|
+
- **Verify:** The setting is gone and the service still starts.
|
|
224
|
+
- **False positives:** Local development tools that manage containers by design.
|
|
225
|
+
|
|
148
226
|
### VS-CICD-001: GitHub Action not pinned to a commit SHA
|
|
149
227
|
|
|
150
228
|
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.
|
|
@@ -169,9 +247,9 @@ A workflow triggered by `pull_request_target` runs with repository secrets and a
|
|
|
169
247
|
- **Verify:** No `write-all` remains and the workflow still passes.
|
|
170
248
|
- **False positives:** None expected; the setting is explicit.
|
|
171
249
|
|
|
172
|
-
### VS-CICD-004: Untrusted GitHub context interpolated into a
|
|
250
|
+
### VS-CICD-004: Untrusted GitHub context interpolated into a script step
|
|
173
251
|
|
|
174
|
-
Attacker-controlled fields (PR title/body, branch name, issue or comment text) are expanded directly inside a `run:` script. A crafted value can inject
|
|
252
|
+
Attacker-controlled fields (PR title/body, branch name, issue or comment text) are expanded directly inside a `run:` or `actions/github-script` script. A crafted value can inject commands.
|
|
175
253
|
|
|
176
254
|
- **Fix:** Pass the value through an environment variable (`env: TITLE: ${{ github.event.pull_request.title }}`) and reference it as `"$TITLE"` in the script.
|
|
177
255
|
- **Verify:** The expression no longer appears inside a `run:` body.
|
|
@@ -227,7 +305,7 @@ hostNetwork, hostPID or hostIPC removes namespace isolation between the pod and
|
|
|
227
305
|
|
|
228
306
|
### VS-IAC-001: Security group or firewall open to the whole internet
|
|
229
307
|
|
|
230
|
-
A Terraform rule allows 0.0.0.0/0
|
|
308
|
+
A Terraform rule allows 0.0.0.0/0, ::/0 or an Azure `*`/`Internet` source. Open ingress to administrative or database ports exposes them to internet scanning and attack.
|
|
231
309
|
|
|
232
310
|
- **Fix:** Restrict CIDR ranges to known addresses or place the service behind a load balancer, VPN or bastion.
|
|
233
311
|
- **Verify:** Ingress CIDRs are restricted or documented as intentionally public.
|
|
@@ -305,6 +383,54 @@ Assigning strings to HTML sinks can cause cross-site scripting if the content in
|
|
|
305
383
|
- **Verify:** Sink removed or input proven sanitised; test with a `<script>` payload.
|
|
306
384
|
- **False positives:** Constant markup or content already sanitised.
|
|
307
385
|
|
|
386
|
+
### VS-CODE-008: Request data used as a database query (NoSQL injection)
|
|
387
|
+
|
|
388
|
+
A request object is passed straight into a query, or text is built into a `$where` clause. An attacker can send operators such as `$ne` or script and change what the query matches.
|
|
389
|
+
|
|
390
|
+
- **Fix:** Pick the expected fields, check their type, and avoid `$where`.
|
|
391
|
+
- **Verify:** Send an object where a string is expected and confirm it is rejected.
|
|
392
|
+
- **False positives:** Input already validated against a schema before this line.
|
|
393
|
+
|
|
394
|
+
### VS-CODE-009: Request data used as a file path (path traversal)
|
|
395
|
+
|
|
396
|
+
A file is opened, sent or deleted using a request value, so `../` sequences can reach files outside the intended folder.
|
|
397
|
+
|
|
398
|
+
- **Fix:** Resolve the path and require it to stay inside an allowed folder, or map an id to a known file name.
|
|
399
|
+
- **Verify:** Request `../` and an absolute path and confirm both are refused.
|
|
400
|
+
- **False positives:** Values already reduced to a base name or checked against an allow list.
|
|
401
|
+
|
|
402
|
+
### VS-CODE-010: Request data used as an outbound URL (SSRF)
|
|
403
|
+
|
|
404
|
+
The server fetches a URL taken from the request, which can reach internal services and cloud metadata endpoints.
|
|
405
|
+
|
|
406
|
+
- **Fix:** Allow only known hosts, resolve and block private address ranges, and do not follow redirects to them.
|
|
407
|
+
- **Verify:** Request a loopback or link-local address and confirm it is refused.
|
|
408
|
+
- **False positives:** A value checked against an allow list before this line.
|
|
409
|
+
|
|
410
|
+
### VS-CODE-011: Redirect target taken from the request (open redirect)
|
|
411
|
+
|
|
412
|
+
The redirect destination comes from the request, so a link to this site can send people to an attacker's site.
|
|
413
|
+
|
|
414
|
+
- **Fix:** Redirect to relative paths or to an allow list of destinations.
|
|
415
|
+
- **Verify:** Request an external destination and confirm it is refused.
|
|
416
|
+
- **False positives:** A value validated as a local path before this line.
|
|
417
|
+
|
|
418
|
+
### VS-CODE-012: Session cookie protection switched off
|
|
419
|
+
|
|
420
|
+
`httpOnly` or `secure` is disabled for a cookie, which exposes it to scripts or to unencrypted connections.
|
|
421
|
+
|
|
422
|
+
- **Fix:** Set `httpOnly` and `secure` to true and choose a `sameSite` value.
|
|
423
|
+
- **Verify:** The Set-Cookie response header carries HttpOnly and Secure.
|
|
424
|
+
- **False positives:** Cookies that scripts must read, or settings used only for local development.
|
|
425
|
+
|
|
426
|
+
### VS-AGENT-004: Hidden Unicode characters in code or agent instructions
|
|
427
|
+
|
|
428
|
+
Invisible or direction-changing characters make a file read differently to a person than to a compiler or AI assistant (Trojan Source, rules-file backdoor).
|
|
429
|
+
|
|
430
|
+
- **Fix:** Delete the characters, then read the line again. Treat hidden text in an instruction file as hostile until its author explains it.
|
|
431
|
+
- **Verify:** Re-run `vigilsutra audit`; an editor that shows invisible characters displays none on the line.
|
|
432
|
+
- **False positives:** Right-to-left text that needs direction controls in a string, and test data about Unicode.
|
|
433
|
+
|
|
308
434
|
### VS-AGENT-001: Instruction file tries to override agent safety or scope
|
|
309
435
|
|
|
310
436
|
An agent instruction file contains phrases typical of prompt injection (ignore previous instructions, disable safety, exfiltrate). Repositories are untrusted input to any AI agent that reads them.
|
package/llms.txt
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# VigilSutra AI
|
|
2
2
|
|
|
3
|
-
> VigilSutra AI (CLI: `vigilsutra`, v0.
|
|
3
|
+
> VigilSutra AI (CLI: `vigilsutra`, v0.5.0) is an open-source, offline-first security and privacy auditor for codebases, created by [Vatsal Shah](https://shahvatsal.com). 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. 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
|
|
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 has not been re-run for 0.4.0 or later. 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.
|
|
3
|
+
"version": "0.5.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",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"files": [
|
|
46
46
|
"dist",
|
|
47
47
|
"agents",
|
|
48
|
-
"adapters",
|
|
49
48
|
"policies",
|
|
50
49
|
"schemas",
|
|
51
50
|
"docs",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# VigilSutra AI policy. Defaults already ignore .git, node_modules,
|
|
2
|
-
# and lockfiles. Entries below ADD to those defaults; they never remove them.
|
|
1
|
+
# VigilSutra AI policy. Defaults already ignore .git, node_modules, caches
|
|
2
|
+
# and lockfiles; dist, build, out and vendor are read for secrets only. Entries below ADD to those defaults; they never remove them.
|
|
3
3
|
# Do not ignore .env files: the scanner reports them without echoing contents.
|
|
4
4
|
version: 1
|
|
5
5
|
ignore:
|
|
@@ -10,5 +10,6 @@ timeLimitMs: 60000
|
|
|
10
10
|
# failOn: high
|
|
11
11
|
disableRules: []
|
|
12
12
|
# A waiver hides one rule on one path until the UTC date (inclusive). Expired waivers do not hide findings.
|
|
13
|
+
# A waiver is ruleId|path[:line]|owner|YYYY-MM-DD[|reason]. The path may contain * or **.
|
|
13
14
|
# waivers:
|
|
14
15
|
# - VS-CODE-001|src/legacy.js|your-name|2026-12-31
|