vigilsutra 0.1.2 → 0.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,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 - 2026-11-04
4
+
5
+ - **Reports as files.** New `vigilsutra report` command, and `audit --report` / `--report-dir`, write `report.md`, `report.html`, `results.json` and `results.sarif` (plus a `.gitignore`) to `./vigilsutra-report/`. In an interactive terminal, `audit` without `--format` or `--out` now does this by default; piped or CI runs are unchanged. `--no-report` turns it off.
6
+ - **Clearer reports.** Markdown and HTML now open with a plain-language "what to do first" summary, severity counts, a how-to-read guide, a findings table, findings grouped by severity with Fix and Verify steps, next steps, and scope and limits. The HTML file is self-contained, supports light and dark mode and printing, and has no scripts or remote resources.
7
+ - The `vigilsutra-report/` folder is ignored by scans, so reports are never re-scanned.
8
+ - CI: macOS runs Node 22 and 26 only (macOS runners were queued for hours and showed as failed checks); Dependabot no longer proposes major `@types/node` bumps.
9
+
10
+ ## 0.1.3 - 2026-11-04
11
+
12
+ - Build with TypeScript 7.0.2 (`tsconfig.json` now lists `"types": ["node"]`); GitHub Actions updated to current majors (checkout 7, setup-node 7, codeql-action 4, upload-artifact 7), still pinned to commit SHAs.
13
+
3
14
  ## 0.1.2 - 2026-11-01
4
15
 
5
16
  - CI now tests Node 20, 22, 24 and 26 (current LTS) on Ubuntu, macOS and Windows; all 12 jobs pass. Docs updated. No code changes.
package/README.md CHANGED
@@ -69,6 +69,8 @@ node dist/cli.js audit examples/intentionally-insecure
69
69
 
70
70
  > Published on npm: <https://www.npmjs.com/package/vigilsutra>. You can also install from GitHub: `npm install -g github:shahvatsalofficial/vigilsutra`. Try the demo project after cloning: `vigilsutra audit examples/intentionally-insecure`.
71
71
 
72
+ **Reports as files (easy to read and share).** Run `vigilsutra report .` (or `vigilsutra audit .` in a terminal) and open `vigilsutra-report/report.html` in a browser. The folder also has `report.md`, `results.json` and `results.sarif`, and a `.gitignore` so reports are not committed by accident.
73
+
72
74
  Everyday use:
73
75
 
74
76
  ```bash
@@ -103,13 +105,14 @@ Summary: 0 critical, 8 high, 5 medium, 2 low, 1 info
103
105
 
104
106
  ![Terminal output of vigilsutra auditing the intentionally insecure demo (real output)](docs/assets/demo.svg)
105
107
 
106
- Full sample reports (labelled as samples, generated from the demo project): [Markdown](examples/sample-reports/insecure-demo.md) · [SARIF](examples/sample-reports/insecure-demo.sarif) · [JSON](examples/sample-reports/insecure-demo.json). The matching clean project is [examples/secure-config](examples/secure-config).
108
+ Full sample reports (labelled as samples, generated from the demo project): [HTML](examples/sample-reports/insecure-demo.html) · [Markdown](examples/sample-reports/insecure-demo.md) · [SARIF](examples/sample-reports/insecure-demo.sarif) · [JSON](examples/sample-reports/insecure-demo.json). The matching clean project is [examples/secure-config](examples/secure-config).
107
109
 
108
110
  ## Commands
109
111
 
110
112
  | Command | What it does |
111
113
  |---|---|
112
- | `vigilsutra audit [path]` | Read-only scan. Formats: `text`, `json`, `markdown`, `sarif`, `html`. Flags: `--out`, `--fail-on`, `--baseline`, `--no-color`. |
114
+ | `vigilsutra report [path]` | Scan and write `report.md`, `report.html`, `results.json`, `results.sarif` to `./vigilsutra-report/` (or `--report-dir`). |
115
+ | `vigilsutra audit [path]` | Read-only scan. Formats: `text`, `json`, `markdown`, `sarif`, `html`. Flags: `--out`, `--fail-on`, `--baseline`, `--policy`, `--no-policy`, `--report`, `--report-dir`, `--no-report`, `--no-color`. In a terminal, with no `--format` or `--out`, it also writes the report folder. |
113
116
  | `vigilsutra baseline --out f.json` | Record current findings as accepted, so CI fails only on new ones. |
114
117
  | `vigilsutra verify --previous results.json` | Re-scan and show what is no longer detected, remaining, or new. |
115
118
  | `vigilsutra rules list` / `explain <ID>` | Browse rules, fixes and false-positive notes. |
package/dist/cli.js CHANGED
@@ -19,7 +19,11 @@ Commands:
19
19
  --baseline <file> Suppress findings whose fingerprints are in this baseline
20
20
  --policy <file> Use this policy file instead of the project's .vigilsutra.yml
21
21
  --no-policy Ignore the project's .vigilsutra.yml (use when auditing code you do not own)
22
+ --report Also write report.md, report.html, results.json, results.sarif to ./vigilsutra-report/
23
+ --report-dir <dir> Same, into <dir>
24
+ --no-report Do not write report files (they are written by default when you run audit in a terminal without --format/--out)
22
25
  --no-color Plain output (also honours NO_COLOR)
26
+ report [path] Scan and write the report files (Markdown + HTML + JSON + SARIF), then print the summary
23
27
  baseline [path] --out <file> Record current findings as an accepted baseline
24
28
  verify [path] --previous <results.json> Re-scan and compare with an earlier JSON result
25
29
  rules list List implemented rules
@@ -33,7 +37,7 @@ Commands:
33
37
 
34
38
  Exit codes: 0 ok | 1 findings at/above --fail-on | 2 usage or runtime error
35
39
  `;
36
- const VALUE_FLAGS = new Set(["format", "out", "fail-on", "baseline", "previous", "project", "policy"]);
40
+ const VALUE_FLAGS = new Set(["format", "out", "fail-on", "baseline", "previous", "project", "policy", "report-dir"]);
37
41
  function parse(argv) {
38
42
  const pos = [];
39
43
  const flags = new Map();
@@ -69,6 +73,15 @@ function checkRoot(p) {
69
73
  fail(`not a directory: ${p}`);
70
74
  return realpathSync(abs);
71
75
  }
76
+ /** Writes report.md, report.html, results.json and results.sarif. The folder gets a .gitignore so reports are not committed by accident. */
77
+ function writeReportFolder(dir, result) {
78
+ mkdirSync(dir, { recursive: true });
79
+ writeFileSync(join(dir, "report.md"), render(result, "markdown"));
80
+ writeFileSync(join(dir, "report.html"), render(result, "html"));
81
+ writeFileSync(join(dir, "results.json"), render(result, "json"));
82
+ writeFileSync(join(dir, "results.sarif"), render(result, "sarif"));
83
+ writeFileSync(join(dir, ".gitignore"), "# Reports contain file paths and redacted excerpts; do not commit them.\n*\n");
84
+ }
72
85
  function writeOut(file, data) {
73
86
  const abs = resolve(file);
74
87
  mkdirSync(dirname(abs), { recursive: true });
@@ -95,7 +108,8 @@ function main() {
95
108
  const { pos, flags } = parse(argv.slice(1));
96
109
  const color = !flags.has("no-color") && !process.env.NO_COLOR && !!process.stdout.isTTY;
97
110
  switch (cmd) {
98
- case "audit": {
111
+ case "audit":
112
+ case "report": {
99
113
  const root = checkRoot(pos[0] ?? ".");
100
114
  const format = flags.get("format") ?? "text";
101
115
  if (!FORMATS.includes(format))
@@ -111,6 +125,20 @@ function main() {
111
125
  }
112
126
  else
113
127
  process.stdout.write(render(result, format, color));
128
+ // Reports as files: always for `report`, on request, and by default for an interactive `audit` with no explicit format or file.
129
+ const explicitOutput = flags.has("format") || typeof out === "string";
130
+ const dirFlag = flags.get("report-dir");
131
+ const wantReport = cmd === "report" || flags.has("report") || typeof dirFlag === "string" || (!flags.has("no-report") && !explicitOutput && !!process.stdout.isTTY);
132
+ if (wantReport) {
133
+ const dir = resolve(typeof dirFlag === "string" ? dirFlag : "vigilsutra-report");
134
+ writeReportFolder(dir, result);
135
+ process.stdout.write(`
136
+ Reports written to ${dir}
137
+ report.html open this in a browser
138
+ report.md Markdown version
139
+ results.json, results.sarif for tools and CI
140
+ `);
141
+ }
114
142
  if (failOn && exceeds(result, failOn))
115
143
  process.exit(1);
116
144
  return;
package/dist/engine.js CHANGED
@@ -7,7 +7,7 @@ import { inventory } from "./scope.js";
7
7
  import { DEFAULT_POLICY, loadPolicy } from "./policy.js";
8
8
  import { redactSpan, scrubTokens, tidy } from "./redact.js";
9
9
  import { SEVERITY_ORDER } from "./types.js";
10
- export const VERSION = "0.1.2";
10
+ export const VERSION = "0.2.0";
11
11
  /** Per rule, per file. Keeps one noisy file from producing an unbounded report. */
12
12
  export const MAX_PER_RULE_PER_FILE = 200;
13
13
  function sha(s) {
package/dist/policy.js CHANGED
@@ -13,6 +13,7 @@ export const DEFAULT_IGNORE = [
13
13
  "**/coverage/**",
14
14
  "**/.next/**",
15
15
  "**/target/**",
16
+ "**/vigilsutra-report/**",
16
17
  "*.min.js",
17
18
  "package-lock.json",
18
19
  "yarn.lock",
@@ -1,4 +1,6 @@
1
1
  import { ALL_RULES } from "../rules/index.js";
2
+ import { toHtml, toMarkdown, htmlEsc } from "./rich.js";
3
+ export { toHtml, toMarkdown, htmlEsc };
2
4
  export const FORMATS = ["text", "json", "markdown", "sarif", "html"];
3
5
  const SEV = ["critical", "high", "medium", "low", "info"];
4
6
  export function toJson(r) {
@@ -27,41 +29,6 @@ export function toText(r, color = false) {
27
29
  out.push("Limits: pattern-based, offline, no taint analysis. Run `vigilsutra explain <RULE-ID>` for fixes.");
28
30
  return out.join("\n") + "\n";
29
31
  }
30
- /** Text placed inside an inline code span must not contain backticks or line breaks (file names can). */
31
- const mdCode = (s) => s.replace(/[`\r\n]/g, "'");
32
- const mdEsc = (s) => s.replace(/[\\`*_{}[\]<>#|]/g, "\\$&");
33
- export function toMarkdown(r) {
34
- const o = [];
35
- o.push(`# VigilSutra AI audit report: ${mdEsc(r.project.name)}`, "");
36
- o.push(`- Generated: ${r.generatedAt}`, `- Tool: vigilsutra ${r.tool.version} (rules ${r.tool.rulesVersion})`, `- Mode: ${r.mode} (read-only, offline)`, `- Detected: ${r.project.detected.join(", ") || "none"}`, "");
37
- o.push("## Executive summary", "");
38
- o.push(`${r.summary.total} finding(s): ${SEV.map((s) => `${r.summary.bySeverity[s]} ${s}`).join(", ")}.`);
39
- const confirmed = r.summary.byStatus["confirmed"] ?? 0;
40
- const potential = r.summary.byStatus["potential"] ?? 0;
41
- o.push(`Confirmed by evidence: ${confirmed}. Potential (needs human verification): ${potential}.`, "");
42
- const top = r.findings.filter((f) => f.severity === "critical" || f.severity === "high").slice(0, 5);
43
- if (top.length) {
44
- o.push("### Top priorities", "");
45
- top.forEach((f, i) => o.push(`${i + 1}. **${f.ruleId}** ${mdEsc(f.title)} at \`${mdCode(f.path)}:${f.startLine}\``));
46
- o.push("");
47
- }
48
- o.push("### Scope and limits", "");
49
- o.push(`Scanned ${r.scope.filesScanned} files. Skipped: ${r.scope.skippedIgnored} ignored, ${r.scope.skippedSymlinks} symlinks (never followed), ${r.scope.skippedTooLarge} too large, ${r.scope.skippedBinary} binary.`, "");
50
- o.push("Assessed: " + r.categoriesAssessed.join(", ") + ".", "", "Not assessed: " + r.notAssessed.join("; ") + ".", "");
51
- r.limitations.forEach((l) => o.push(`- ${l}`));
52
- o.push("", "## Findings", "");
53
- if (!r.findings.length)
54
- o.push("No findings from the implemented rules. This is not proof of security.", "");
55
- for (const f of r.findings) {
56
- o.push(`### ${f.ruleId}: ${mdEsc(f.title)}`, "");
57
- o.push(`- Severity: **${f.severity}** | Confidence: **${f.confidence}** | Status: **${f.status}**`);
58
- o.push(`- Location: \`${mdCode(f.path)}:${f.startLine}\``, `- Fingerprint: \`${f.fingerprint}\`${f.cwe.length ? ` | ${f.cwe.join(", ")} (orientation only)` : ""}`);
59
- o.push("- Evidence" + (f.redacted ? " (redacted)" : "") + ":", "", " ```text", " " + f.excerpt.replace(/`/g, "'"), " ```", "");
60
- o.push(`**Why it matters.** ${f.description}`, "", `**Fix.** ${f.remediation}`, "", `**Verify.** ${f.verification}`, "", `**May be a false positive when.** ${f.falsePositives}`, "");
61
- }
62
- o.push("---", "Created by Vatsal Shah. VigilSutra reports engineering evidence, not certification or legal advice.", "");
63
- return o.join("\n");
64
- }
65
32
  const level = (s) => (s === "critical" || s === "high" ? "error" : s === "medium" ? "warning" : "note");
66
33
  export function toSarif(r) {
67
34
  const used = new Set(r.findings.map((f) => f.ruleId));
@@ -100,27 +67,6 @@ export function toSarif(r) {
100
67
  };
101
68
  return JSON.stringify(sarif, null, 2) + "\n";
102
69
  }
103
- export const htmlEsc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
104
- export function toHtml(r) {
105
- const rows = r.findings
106
- .map((f) => `<tr><td>${htmlEsc(f.severity)}</td><td>${htmlEsc(f.ruleId)}</td><td>${htmlEsc(f.title)}</td><td><code>${htmlEsc(f.path)}:${f.startLine}</code></td><td>${htmlEsc(f.status)} / ${htmlEsc(f.confidence)}</td><td><code>${htmlEsc(f.excerpt)}</code></td></tr>`)
107
- .join("\n");
108
- return `<!doctype html>
109
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
110
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'">
111
- <title>VigilSutra AI report - ${htmlEsc(r.project.name)}</title>
112
- <style>body{font:14px/1.5 system-ui,sans-serif;margin:2rem auto;max-width:72rem;padding:0 1rem}table{border-collapse:collapse;width:100%}td,th{border:1px solid #888;padding:.35rem;text-align:left;vertical-align:top}code{word-break:break-all}</style>
113
- </head><body>
114
- <h1>VigilSutra AI report: ${htmlEsc(r.project.name)}</h1>
115
- <p>${r.summary.total} finding(s). Generated ${htmlEsc(r.generatedAt)} by vigilsutra ${htmlEsc(r.tool.version)}. Offline, read-only, pattern-based; not a certification.</p>
116
- <table><thead><tr><th>Severity</th><th>Rule</th><th>Title</th><th>Location</th><th>Status / confidence</th><th>Evidence (redacted)</th></tr></thead><tbody>
117
- ${rows}
118
- </tbody></table>
119
- <h2>Limitations</h2><ul>${r.limitations.map((l) => `<li>${htmlEsc(l)}</li>`).join("")}</ul>
120
- <p>Created by Vatsal Shah.</p>
121
- </body></html>
122
- `;
123
- }
124
70
  export function render(r, f, color = false) {
125
71
  switch (f) {
126
72
  case "json":
@@ -0,0 +1,169 @@
1
+ const SEV = ["critical", "high", "medium", "low", "info"];
2
+ const SEV_LABEL = { critical: "Critical", high: "High", medium: "Medium", low: "Low", info: "Info" };
3
+ /** Text placed inside an inline code span must not contain backticks or line breaks (file names can). */
4
+ const mdCode = (s) => s.replace(/[`\r\n]/g, "'");
5
+ const mdEsc = (s) => s.replace(/[\\`*_{}[\]<>#|]/g, "\\$&");
6
+ export const htmlEsc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7
+ /** One plain-language sentence a non-specialist can act on. */
8
+ export function plainSummary(r) {
9
+ const b = r.summary.bySeverity;
10
+ if (r.summary.total === 0)
11
+ return "No problems were found by the 32 built-in checks. That is not proof the project is secure: some areas are not checked (see Scope and limits).";
12
+ const urgent = b.critical + b.high;
13
+ if (urgent > 0)
14
+ return `Start with the ${urgent} critical and high item${urgent === 1 ? "" : "s"}. They are the most likely to cause real harm. The rest can be scheduled afterwards.`;
15
+ if (b.medium > 0)
16
+ return `No critical or high items. Review the ${b.medium} medium item${b.medium === 1 ? "" : "s"} next; low and info items are hardening and housekeeping.`;
17
+ return "Only low-severity and informational items were found. Review them when convenient.";
18
+ }
19
+ const NEXT_STEPS = [
20
+ "Fix critical and high items first. Each finding below has a **Fix** and a **Verify** step.",
21
+ "Treat any exposed secret as compromised: rotate or revoke it at the provider before deleting it from the code.",
22
+ "Items marked *potential* need a person to confirm; read **May be a false positive when** before acting.",
23
+ "After fixing, re-run the audit, or run `vigilsutra verify --previous <results.json>` to see what is gone and what is new.",
24
+ "To accept existing findings and fail only on new ones, create a baseline: `vigilsutra baseline --out .vigilsutra-baseline.json`."
25
+ ];
26
+ const READING_GUIDE = [
27
+ ["Severity", "How bad it would be if the finding is real: critical, high, medium, low or info."],
28
+ ["Confidence", "How reliable the check is: high, medium or low. Findings in test, example or vendored folders are marked low."],
29
+ ["Status", "**confirmed**: the evidence alone is conclusive. **potential**: a pattern match that a person must confirm. **informational**: a note, not a defect."],
30
+ ["Evidence", "The line that triggered the finding. Secret values are always replaced with [REDACTED]."]
31
+ ];
32
+ function ordered(r) {
33
+ // Real project code first, then findings in test/example paths, within each severity group order is already stable.
34
+ return [...r.findings].sort((a, b) => Number(!!a.pathContext) - Number(!!b.pathContext));
35
+ }
36
+ export function toMarkdown(r) {
37
+ const o = [];
38
+ const sevCount = (s) => r.summary.bySeverity[s];
39
+ o.push(`# VigilSutra AI audit report: ${mdEsc(r.project.name)}`, "");
40
+ o.push(`> Generated ${r.generatedAt} by vigilsutra ${r.tool.version} (rules ${r.tool.rulesVersion}). Offline, read-only scan. Secrets are redacted. Detected: ${r.project.detected.join(", ") || "none"}.`, "");
41
+ o.push("## At a glance", "", `**${plainSummary(r)}**`, "");
42
+ o.push("| Severity | Findings |", "|---|---|");
43
+ for (const s of SEV)
44
+ o.push(`| ${SEV_LABEL[s]} | ${sevCount(s)} |`);
45
+ o.push(`| **Total** | **${r.summary.total}** |`, "");
46
+ const confirmed = r.summary.byStatus["confirmed"] ?? 0;
47
+ const potential = r.summary.byStatus["potential"] ?? 0;
48
+ const inTests = r.findings.filter((f) => f.pathContext).length;
49
+ o.push(`Confirmed by evidence: **${confirmed}**. Potential (needs a person to confirm): **${potential}**. In test, example or vendored paths: **${inTests}**.${r.summary.baselineSuppressed ? ` Hidden by baseline: ${r.summary.baselineSuppressed}.` : ""}`, "");
50
+ const top = ordered(r).filter((f) => f.severity === "critical" || f.severity === "high").slice(0, 5);
51
+ if (top.length) {
52
+ o.push("## Top priorities", "");
53
+ top.forEach((f, i) => o.push(`${i + 1}. **${f.ruleId}** ${mdEsc(f.title)}: \`${mdCode(f.path)}:${f.startLine}\` (${f.status}, ${f.severity})`));
54
+ o.push("");
55
+ }
56
+ o.push("## How to read this report", "");
57
+ for (const [k, v] of READING_GUIDE)
58
+ o.push(`- **${k}.** ${v}`);
59
+ o.push("");
60
+ o.push("## All findings", "");
61
+ if (!r.findings.length)
62
+ o.push("No findings from the implemented rules. This is not proof of security.", "");
63
+ else {
64
+ o.push("| # | Severity | Rule | What | Where | Status |", "|---|---|---|---|---|---|");
65
+ r.findings.forEach((f, i) => o.push(`| ${i + 1} | ${SEV_LABEL[f.severity]} | ${f.ruleId} | ${mdEsc(f.title)} | \`${mdCode(f.path)}:${f.startLine}\` | ${f.status}${f.pathContext ? ", test/example" : ""} |`));
66
+ o.push("");
67
+ }
68
+ o.push("## Details", "");
69
+ let n = 0;
70
+ for (const s of SEV) {
71
+ const group = r.findings.filter((f) => f.severity === s);
72
+ if (!group.length)
73
+ continue;
74
+ o.push(`### ${SEV_LABEL[s]} (${group.length})`, "");
75
+ for (const f of group) {
76
+ n++;
77
+ o.push(`#### ${n}. ${f.ruleId}: ${mdEsc(f.title)}`, "");
78
+ o.push(`- **Where:** \`${mdCode(f.path)}:${f.startLine}\``);
79
+ o.push(`- **Severity** ${f.severity} | **Confidence** ${f.confidence} | **Status** ${f.status}${f.pathContext ? " | test, example or vendored path" : ""}`);
80
+ o.push(`- **Evidence${f.redacted ? " (redacted)" : ""}:** \`${mdCode(f.excerpt)}\``);
81
+ o.push(`- **Fingerprint:** \`${f.fingerprint}\`${f.cwe.length ? ` | ${f.cwe.join(", ")} (orientation only)` : ""}`, "");
82
+ o.push(`**Why it matters.** ${f.description}`, "", `**Fix.** ${f.remediation}`, "", `**Verify.** ${f.verification}`, "", `**May be a false positive when.** ${f.falsePositives}`, "");
83
+ }
84
+ }
85
+ o.push("## Next steps", "");
86
+ NEXT_STEPS.forEach((t, i) => o.push(`${i + 1}. ${t}`));
87
+ o.push("");
88
+ o.push("## Scope and limits", "");
89
+ o.push(`Scanned ${r.scope.filesScanned} files. Skipped: ${r.scope.skippedIgnored} ignored, ${r.scope.skippedSymlinks} symlinks (never followed), ${r.scope.skippedTooLarge} too large, ${r.scope.skippedBinary} binary.`, "");
90
+ o.push("**Checked:** " + r.categoriesAssessed.join(", ") + ".", "", "**Not checked:** " + r.notAssessed.join("; ") + ".", "");
91
+ r.limitations.forEach((l) => o.push(`- ${l}`));
92
+ o.push("", "---", "Created by Vatsal Shah. VigilSutra reports engineering evidence, not certification or legal advice.", "");
93
+ return o.join("\n");
94
+ }
95
+ const md = (s) => htmlEsc(s)
96
+ .replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
97
+ .replace(/\*([^*]+)\*/g, "<em>$1</em>")
98
+ .replace(/`([^`]+)`/g, "<code>$1</code>");
99
+ const CSS = `
100
+ :root{--bg:#f6f7fb;--card:#fff;--text:#161a2b;--muted:#586079;--line:#dde1ee;--accent:#3b46d9;--crit:#7a0f1a;--high:#c0392b;--med:#b9770e;--low:#2563eb;--info:#6b7280;--ok:#0f7a4d}
101
+ @media (prefers-color-scheme:dark){:root{--bg:#0d111c;--card:#151b2e;--text:#e8ebf7;--muted:#9aa4c2;--line:#27304f;--accent:#8c96ff;--crit:#ff6b7d;--high:#ff8a80;--med:#f2c35b;--low:#7aa7ff;--info:#9aa4c2;--ok:#52d6a0}}
102
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:16px/1.65 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
103
+ main{max-width:62rem;margin:0 auto;padding:1.5rem 1rem 4rem}h1{font-size:1.9rem;margin:.2rem 0}h2{margin:2.2rem 0 .7rem;font-size:1.35rem}
104
+ .meta{color:var(--muted);font-size:.9rem}.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1rem 1.2rem;margin:.8rem 0}
105
+ .lead{font-size:1.15rem;font-weight:600}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(8.5rem,1fr));gap:.7rem}
106
+ .stat{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:.7rem 1rem}.stat b{display:block;font-size:1.7rem;line-height:1.1}.stat span{color:var(--muted);font-size:.85rem}
107
+ .bar{height:.5rem;border-radius:99px;background:var(--line);margin-top:.5rem;overflow:hidden}.bar i{display:block;height:100%}
108
+ .sev{display:inline-block;padding:.05rem .55rem;border-radius:6px;font-size:.75rem;font-weight:700;text-transform:uppercase;color:#fff}
109
+ .critical{background:var(--crit)}.high{background:var(--high)}.medium{background:var(--med)}.low{background:var(--low)}.info{background:var(--info)}
110
+ .chip{display:inline-block;padding:.05rem .55rem;border-radius:99px;border:1px solid var(--line);font-size:.78rem;color:var(--muted);margin-right:.3rem}
111
+ details{background:var(--card);border:1px solid var(--line);border-radius:10px;margin:.5rem 0;padding:.1rem 1rem}summary{cursor:pointer;padding:.7rem 0;font-weight:600}
112
+ summary:focus-visible{outline:3px solid var(--accent);border-radius:6px}.where{font-family:ui-monospace,Consolas,monospace;font-size:.88rem;color:var(--muted);word-break:break-all}
113
+ pre,code{font-family:ui-monospace,Consolas,monospace}pre{background:#0f1424;color:#e7ebfa;padding:.7rem .9rem;border-radius:8px;overflow:auto;font-size:.85rem;white-space:pre-wrap;word-break:break-word}
114
+ code{background:color-mix(in srgb,var(--line) 55%,transparent);padding:.1em .35em;border-radius:5px;font-size:.88em}table{border-collapse:collapse;width:100%;font-size:.9rem}
115
+ th,td{border-bottom:1px solid var(--line);padding:.45rem .5rem;text-align:left;vertical-align:top}th{color:var(--muted);font-size:.75rem;text-transform:uppercase}.tw{overflow-x:auto}
116
+ a{color:var(--accent)}dt{font-weight:700;margin-top:.5rem}dd{margin:0 0 .3rem 0;color:var(--muted)}footer{color:var(--muted);font-size:.85rem;margin-top:2.5rem}
117
+ @media print{details{break-inside:avoid}details>*{display:block}}`;
118
+ function findingHtml(f, i) {
119
+ return `<details id="f-${htmlEsc(f.fingerprint.slice(0, 12))}"${f.severity === "critical" || f.severity === "high" ? " open" : ""}>
120
+ <summary><span class="sev ${f.severity}">${f.severity}</span> ${htmlEsc(f.ruleId)}: ${htmlEsc(f.title)}</summary>
121
+ <p class="where">${htmlEsc(f.path)}:${f.startLine}</p>
122
+ <p><span class="chip">${htmlEsc(f.status)}</span><span class="chip">confidence ${htmlEsc(f.confidence)}</span>${f.pathContext ? '<span class="chip">test, example or vendored path</span>' : ""}${f.cwe.map((c) => `<span class="chip">${htmlEsc(c)}</span>`).join("")}</p>
123
+ <p><strong>Evidence${f.redacted ? " (redacted)" : ""}</strong></p><pre>${htmlEsc(f.excerpt)}</pre>
124
+ <dl><dt>Why it matters</dt><dd>${htmlEsc(f.description)}</dd><dt>Fix</dt><dd>${htmlEsc(f.remediation)}</dd><dt>Verify</dt><dd>${htmlEsc(f.verification)}</dd><dt>May be a false positive when</dt><dd>${htmlEsc(f.falsePositives)}</dd></dl>
125
+ <p class="meta">Finding ${i}. Fingerprint <code>${htmlEsc(f.fingerprint)}</code></p>
126
+ </details>`;
127
+ }
128
+ export function toHtml(r) {
129
+ const max = Math.max(1, ...SEV.map((s) => r.summary.bySeverity[s]));
130
+ const stats = SEV.map((s) => `<div class="stat"><b>${r.summary.bySeverity[s]}</b><span>${SEV_LABEL[s]}</span><div class="bar"><i class="${s}" style="width:${Math.round((r.summary.bySeverity[s] / max) * 100)}%"></i></div></div>`).join("");
131
+ const confirmed = r.summary.byStatus["confirmed"] ?? 0;
132
+ const potential = r.summary.byStatus["potential"] ?? 0;
133
+ const top = ordered(r).filter((f) => f.severity === "critical" || f.severity === "high").slice(0, 5);
134
+ let n = 0;
135
+ const groups = SEV.map((s) => {
136
+ const g = r.findings.filter((f) => f.severity === s);
137
+ if (!g.length)
138
+ return "";
139
+ return `<h3>${SEV_LABEL[s]} (${g.length})</h3>\n${g.map((f) => findingHtml(f, ++n)).join("\n")}`;
140
+ }).join("\n");
141
+ const rows = r.findings.map((f, i) => `<tr><td>${i + 1}</td><td><span class="sev ${f.severity}">${f.severity}</span></td><td>${htmlEsc(f.ruleId)}</td><td>${htmlEsc(f.title)}</td><td class="where"><a href="#f-${htmlEsc(f.fingerprint.slice(0, 12))}">${htmlEsc(f.path)}:${f.startLine}</a></td><td>${htmlEsc(f.status)}</td></tr>`).join("");
142
+ return `<!doctype html>
143
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
144
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'">
145
+ <meta name="color-scheme" content="light dark">
146
+ <title>VigilSutra AI audit report - ${htmlEsc(r.project.name)}</title>
147
+ <style>${CSS}</style></head><body><main>
148
+ <p class="meta">VigilSutra AI ${htmlEsc(r.tool.version)} &middot; rules ${htmlEsc(r.tool.rulesVersion)} &middot; ${htmlEsc(r.generatedAt)} &middot; offline, read-only</p>
149
+ <h1>Audit report: ${htmlEsc(r.project.name)}</h1>
150
+ <p class="meta">Detected: ${htmlEsc(r.project.detected.join(", ") || "none")}</p>
151
+ <div class="card"><p class="lead">${htmlEsc(plainSummary(r))}</p>
152
+ <p class="meta">Confirmed by evidence: <strong>${confirmed}</strong> &middot; Potential (needs a person to confirm): <strong>${potential}</strong> &middot; Total: <strong>${r.summary.total}</strong>${r.summary.baselineSuppressed ? ` &middot; Hidden by baseline: ${r.summary.baselineSuppressed}` : ""}</p></div>
153
+ <div class="grid">${stats}</div>
154
+ ${top.length ? `<h2>Top priorities</h2><ol>${top.map((f) => `<li><a href="#f-${htmlEsc(f.fingerprint.slice(0, 12))}"><strong>${htmlEsc(f.ruleId)}</strong> ${htmlEsc(f.title)}</a> <span class="where">${htmlEsc(f.path)}:${f.startLine}</span></li>`).join("")}</ol>` : ""}
155
+ <h2>How to read this report</h2>
156
+ <dl>${READING_GUIDE.map(([k, v]) => `<dt>${htmlEsc(k)}</dt><dd>${md(v)}</dd>`).join("")}</dl>
157
+ <h2>All findings</h2>
158
+ ${r.findings.length ? `<div class="tw card"><table><thead><tr><th>#</th><th>Severity</th><th>Rule</th><th>What</th><th>Where</th><th>Status</th></tr></thead><tbody>${rows}</tbody></table></div>` : "<p>No findings from the implemented rules. This is not proof of security.</p>"}
159
+ <h2>Details</h2>
160
+ ${groups || "<p>Nothing to show.</p>"}
161
+ <h2>Next steps</h2><ol>${NEXT_STEPS.map((t) => `<li>${md(t)}</li>`).join("")}</ol>
162
+ <h2>Scope and limits</h2>
163
+ <div class="card"><p>Scanned ${r.scope.filesScanned} files. Skipped: ${r.scope.skippedIgnored} ignored, ${r.scope.skippedSymlinks} symlinks (never followed), ${r.scope.skippedTooLarge} too large, ${r.scope.skippedBinary} binary.</p>
164
+ <p><strong>Checked:</strong> ${htmlEsc(r.categoriesAssessed.join(", "))}.</p><p><strong>Not checked:</strong> ${htmlEsc(r.notAssessed.join("; "))}.</p>
165
+ <ul>${r.limitations.map((l) => `<li>${htmlEsc(l)}</li>`).join("")}</ul></div>
166
+ <footer>Created by Vatsal Shah. VigilSutra reports engineering evidence, not certification or legal advice. This file is self-contained and loads nothing from the network.</footer>
167
+ </main></body></html>
168
+ `;
169
+ }
@@ -12,11 +12,11 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "prod": 1,
15
- "dev": 3,
16
- "optional": 0,
15
+ "dev": 23,
16
+ "optional": 20,
17
17
  "peer": 0,
18
18
  "peerOptional": 0,
19
- "total": 3
19
+ "total": 23
20
20
  }
21
21
  }
22
22
  }
@@ -2,10 +2,10 @@
2
2
  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.5",
5
- "serialNumber": "urn:uuid:7236448f-28eb-47b7-b03c-a078c675ee4a",
5
+ "serialNumber": "urn:uuid:a6af414a-eb9a-4cac-a6d7-06f1b624cd72",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-11-01T17:29:25.217Z",
8
+ "timestamp": "2026-11-02T19:30:12.772Z",
9
9
  "lifecycles": [
10
10
  {
11
11
  "phase": "build"
@@ -19,14 +19,14 @@
19
19
  }
20
20
  ],
21
21
  "component": {
22
- "bom-ref": "vigilsutra@0.1.0",
22
+ "bom-ref": "vigilsutra@0.1.2",
23
23
  "type": "library",
24
24
  "name": "VigilSutra-AI",
25
- "version": "0.1.0",
25
+ "version": "0.1.2",
26
26
  "scope": "required",
27
27
  "author": "Vatsal Shah",
28
28
  "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.",
29
- "purl": "pkg:npm/vigilsutra@0.1.0",
29
+ "purl": "pkg:npm/vigilsutra@0.1.2",
30
30
  "properties": [],
31
31
  "externalReferences": [
32
32
  {
@@ -95,14 +95,61 @@
95
95
  ]
96
96
  },
97
97
  {
98
- "bom-ref": "typescript@5.9.3",
98
+ "bom-ref": "@typescript/typescript-win32-x64@7.0.2",
99
+ "type": "library",
100
+ "name": "@typescript/typescript-win32-x64",
101
+ "version": "7.0.2",
102
+ "scope": "optional",
103
+ "author": "Microsoft Corp.",
104
+ "description": "TypeScript is a language for application scale JavaScript development",
105
+ "purl": "pkg:npm/%40typescript/typescript-win32-x64@7.0.2",
106
+ "properties": [
107
+ {
108
+ "name": "cdx:npm:package:development",
109
+ "value": "true"
110
+ }
111
+ ],
112
+ "externalReferences": [
113
+ {
114
+ "type": "distribution",
115
+ "url": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz"
116
+ },
117
+ {
118
+ "type": "vcs",
119
+ "url": "https://github.com/microsoft/TypeScript.git"
120
+ },
121
+ {
122
+ "type": "website",
123
+ "url": "https://www.typescriptlang.org/"
124
+ },
125
+ {
126
+ "type": "issue-tracker",
127
+ "url": "https://github.com/microsoft/TypeScript/issues"
128
+ }
129
+ ],
130
+ "hashes": [
131
+ {
132
+ "alg": "SHA-512",
133
+ "content": "d014371e40071e528b4a9d6a46f7f7494846a46b03ba107f8e0170ef982ecaa6f126a11a4b40b0fd514ef22da71e094953340246d30c47f20100a137113302e2"
134
+ }
135
+ ],
136
+ "licenses": [
137
+ {
138
+ "license": {
139
+ "id": "Apache-2.0"
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "bom-ref": "typescript@7.0.2",
99
146
  "type": "library",
100
147
  "name": "typescript",
101
- "version": "5.9.3",
148
+ "version": "7.0.2",
102
149
  "scope": "required",
103
150
  "author": "Microsoft Corp.",
104
151
  "description": "TypeScript is a language for application scale JavaScript development",
105
- "purl": "pkg:npm/typescript@5.9.3",
152
+ "purl": "pkg:npm/typescript@7.0.2",
106
153
  "properties": [
107
154
  {
108
155
  "name": "cdx:npm:package:development",
@@ -112,7 +159,7 @@
112
159
  "externalReferences": [
113
160
  {
114
161
  "type": "distribution",
115
- "url": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz"
162
+ "url": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz"
116
163
  },
117
164
  {
118
165
  "type": "vcs",
@@ -130,7 +177,7 @@
130
177
  "hashes": [
131
178
  {
132
179
  "alg": "SHA-512",
133
- "content": "8e5d6f6733c38a72ebf5e52ddc9feded5e8580d130f508ef04f772b33f4a7d00c3e357d0ac2d98e2f290762694a454f86d795bd511e12e9a7cc2d9ba3394e04b"
180
+ "content": "f0561abbdea8dcd28e85b8ca8bfa8dbc6fd6e63873c646dd9b9b23f406d9ff94f9b16aa7de12602df1b1dbbb11299593bf2cc23fc74b4414dfe6d05349155434"
134
181
  }
135
182
  ],
136
183
  "licenses": [
@@ -190,10 +237,10 @@
190
237
  ],
191
238
  "dependencies": [
192
239
  {
193
- "ref": "vigilsutra@0.1.0",
240
+ "ref": "vigilsutra@0.1.2",
194
241
  "dependsOn": [
195
242
  "@types/node@22.20.5",
196
- "typescript@5.9.3"
243
+ "typescript@7.0.2"
197
244
  ]
198
245
  },
199
246
  {
@@ -203,9 +250,15 @@
203
250
  ]
204
251
  },
205
252
  {
206
- "ref": "typescript@5.9.3",
253
+ "ref": "@typescript/typescript-win32-x64@7.0.2",
207
254
  "dependsOn": []
208
255
  },
256
+ {
257
+ "ref": "typescript@7.0.2",
258
+ "dependsOn": [
259
+ "@typescript/typescript-win32-x64@7.0.2"
260
+ ]
261
+ },
209
262
  {
210
263
  "ref": "undici-types@6.21.0",
211
264
  "dependsOn": []
@@ -10,8 +10,8 @@ Date 2026-11-01. Package `vigilsutra@0.1.0`.
10
10
 
11
11
  | Package | Version | License |
12
12
  |---|---|---|
13
- | typescript | 5.9.3 | Apache-2.0 |
14
- | @types/node | 22.20.5 | MIT |
13
+ | typescript | 7.0.2 (latest; native compiler, platform binary via `@typescript/typescript-<platform>`, Apache-2.0) | Apache-2.0 |
14
+ | @types/node | 22.20.5 (typed against Node 22 on purpose: Node 20 is end-of-life but still supported, so the types must not expose newer-only APIs) | MIT |
15
15
  | undici-types (via @types/node) | 6.21.0 | MIT |
16
16
 
17
17
  Full dev SBOM: [sbom-full-dev.cdx.json](sbom-full-dev.cdx.json). All licenses are compatible with Apache-2.0 distribution.
@@ -37,6 +37,12 @@ No official image is published yet (planned). To run in a container yourself, mo
37
37
  docker run --rm --network none -v "$PWD":/work:ro -v /path/to/vigilsutra:/vs:ro -w /work node:22 node /vs/dist/cli.js audit .
38
38
  ```
39
39
 
40
+ ## Get a readable report
41
+ ```bash
42
+ vigilsutra report . # writes ./vigilsutra-report/report.html, report.md, results.json, results.sarif
43
+ ```
44
+ Open `report.html` in a browser, or `report.md` in any Markdown viewer. The folder has its own `.gitignore`; reports contain file paths and redacted excerpts, so do not publish them for private projects.
45
+
40
46
  ## Next steps
41
47
  1. `vigilsutra init` to create `.vigilsutra.yml`.
42
48
  2. `vigilsutra audit . --format sarif --out vigilsutra.sarif` for code scanning.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigilsutra",
3
- "version": "0.1.2",
3
+ "version": "0.2.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",
@@ -66,6 +66,6 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/node": "^22.20.5",
69
- "typescript": "^5.9.3"
69
+ "typescript": "^7.0.2"
70
70
  }
71
71
  }