@neuralaxis/vibedoctor 0.2.0 → 0.2.1
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/README.md +86 -0
- package/dist/adapters/biome.js +135 -21
- package/dist/adapters/osvScanner.js +136 -17
- package/dist/adapters/presidio.js +3 -1
- package/dist/cli/commands/init.js +105 -50
- package/dist/cli/commands/privacyReview.js +3 -4
- package/dist/cli/commands/setup.d.ts +13 -17
- package/dist/cli/commands/setup.js +138 -200
- package/dist/core/capability.d.ts +92 -0
- package/dist/core/capability.js +122 -0
- package/dist/core/config.d.ts +36 -0
- package/dist/core/config.js +105 -3
- package/dist/core/credentialHeuristics.d.ts +28 -0
- package/dist/core/credentialHeuristics.js +179 -0
- package/dist/core/engine.d.ts +21 -0
- package/dist/core/engine.js +466 -85
- package/dist/core/executable.d.ts +18 -0
- package/dist/core/executable.js +137 -0
- package/dist/core/fileRole.d.ts +24 -0
- package/dist/core/fileRole.js +125 -0
- package/dist/core/finding.d.ts +124 -0
- package/dist/core/finding.js +62 -5
- package/dist/core/findingNormalizer.d.ts +33 -0
- package/dist/core/findingNormalizer.js +171 -0
- package/dist/core/projectDetector.d.ts +13 -0
- package/dist/core/projectDetector.js +100 -15
- package/dist/core/relevance.d.ts +87 -0
- package/dist/core/relevance.js +367 -0
- package/dist/core/scanPlanner.d.ts +12 -0
- package/dist/core/scanPlanner.js +61 -37
- package/dist/core/semverLite.d.ts +27 -0
- package/dist/core/semverLite.js +163 -0
- package/dist/core/suppressions.d.ts +96 -0
- package/dist/core/suppressions.js +302 -0
- package/dist/core/toolRegistry.d.ts +58 -0
- package/dist/core/toolRegistry.js +247 -0
- package/dist/core/toolRunner.d.ts +23 -2
- package/dist/core/toolRunner.js +61 -93
- package/dist/core/toolVerification.d.ts +87 -0
- package/dist/core/toolVerification.js +370 -0
- package/dist/dpdp/collectors/optionalScanners.js +120 -30
- package/dist/dpdp/findings.d.ts +33 -3
- package/dist/dpdp/findings.js +191 -4
- package/dist/dpdp/scan.js +2 -2
- package/dist/dpdp/scoring.d.ts +14 -4
- package/dist/dpdp/scoring.js +34 -8
- package/dist/dpdp/types.d.ts +19 -1
- package/dist/reporters/html.js +57 -13
- package/dist/reporters/json.js +7 -1
- package/dist/reporters/markdown.js +46 -4
- package/dist/reporters/sarif.js +54 -5
- package/package.json +1 -1
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderMarkdownReport = renderMarkdownReport;
|
|
4
|
+
const capability_1 = require("../core/capability");
|
|
5
|
+
const relevance_1 = require("../core/relevance");
|
|
6
|
+
const suppressions_1 = require("../core/suppressions");
|
|
7
|
+
function formatDuration(durationMs) {
|
|
8
|
+
if (durationMs === undefined) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
return durationMs >= 1000 ? `${(durationMs / 1000).toFixed(1)}s` : `${durationMs}ms`;
|
|
12
|
+
}
|
|
13
|
+
/** Cell content has to be escaped or a `|` in a tool's reason breaks the table. */
|
|
14
|
+
function escapeTableCell(value) {
|
|
15
|
+
return value.replaceAll("|", "\\|").replaceAll("\n", " ");
|
|
16
|
+
}
|
|
17
|
+
function formatLocation(finding) {
|
|
18
|
+
if (!finding.file) {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
const line = finding.startLine ? `:${finding.startLine}` : "";
|
|
22
|
+
const column = finding.startLine && finding.startColumn ? `:${finding.startColumn}` : "";
|
|
23
|
+
return ` — \`${finding.file}${line}${column}\``;
|
|
24
|
+
}
|
|
4
25
|
function renderMarkdownReport(scan) {
|
|
5
26
|
const plan = scan.agentPlan;
|
|
6
27
|
const lines = [
|
|
@@ -23,24 +44,45 @@ function renderMarkdownReport(scan) {
|
|
|
23
44
|
lines.push("- None");
|
|
24
45
|
}
|
|
25
46
|
else {
|
|
26
|
-
scan.blockers.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
47
|
+
scan.blockers.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.message}`));
|
|
27
48
|
}
|
|
28
49
|
lines.push("", "## Fix next");
|
|
29
|
-
scan.fixNext.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
50
|
+
scan.fixNext.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}`));
|
|
30
51
|
if (scan.privacyFindings.length > 0) {
|
|
31
52
|
lines.push("", "## Privacy Review findings");
|
|
32
53
|
scan.privacyFindings
|
|
33
54
|
.slice(0, 10)
|
|
34
|
-
.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
55
|
+
.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.evidence?.maskedValue ?? finding.evidence?.entityType ?? finding.message}`));
|
|
35
56
|
}
|
|
36
57
|
if (scan.deadCodeCandidates.length > 0) {
|
|
37
58
|
lines.push("", "## Dead chains and dead code");
|
|
38
|
-
scan.deadCodeCandidates.slice(0, 5).forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
59
|
+
scan.deadCodeCandidates.slice(0, 5).forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.message}`));
|
|
39
60
|
}
|
|
40
61
|
if (scan.skippedTools.length > 0) {
|
|
41
62
|
lines.push("", "## Skipped tools");
|
|
42
63
|
scan.skippedTools.forEach((tool) => lines.push(`- ${tool.id}${tool.installHint ? ` — ${tool.installHint}` : ""}`));
|
|
43
64
|
}
|
|
65
|
+
if (scan.capabilityMatrix.tools.length > 0) {
|
|
66
|
+
lines.push("", "## Tool coverage");
|
|
67
|
+
lines.push("| Tool | State | Findings shown/reported | Time | Detail |");
|
|
68
|
+
lines.push("| --- | --- | --- | --- | --- |");
|
|
69
|
+
scan.capabilityMatrix.tools.forEach((tool) => lines.push(`| ${escapeTableCell(tool.id)} | ${(0, capability_1.capabilityStateLabel)(tool.state)} | ${tool.findingsSurfaced}/${tool.findingsReported} | ${formatDuration(tool.durationMs)} | ${escapeTableCell(tool.reason)} |`));
|
|
70
|
+
const remediations = scan.capabilityMatrix.tools.filter((tool) => tool.remediation && (0, capability_1.isCoverageGap)(tool));
|
|
71
|
+
if (remediations.length > 0) {
|
|
72
|
+
lines.push("", "### To restore coverage");
|
|
73
|
+
remediations.forEach((tool) => lines.push(`- ${tool.id}: ${tool.remediation}`));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const relevanceLines = (0, relevance_1.renderRelevanceLines)(scan.relevance);
|
|
77
|
+
if (relevanceLines.length > 0) {
|
|
78
|
+
lines.push("", "## Report filtering");
|
|
79
|
+
relevanceLines.forEach((line) => lines.push(line));
|
|
80
|
+
}
|
|
81
|
+
const suppressionLines = (0, suppressions_1.renderSuppressionLines)(scan.suppressions);
|
|
82
|
+
if (suppressionLines.length > 0) {
|
|
83
|
+
lines.push("", "## Acknowledged");
|
|
84
|
+
suppressionLines.forEach((line) => lines.push(line));
|
|
85
|
+
}
|
|
44
86
|
lines.push("", "## Agent tasks");
|
|
45
87
|
plan.tasks.forEach((task) => lines.push(`- ${task.title}`));
|
|
46
88
|
return `${lines.join("\n")}\n`;
|
package/dist/reporters/sarif.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderSarif = renderSarif;
|
|
4
|
+
const capability_1 = require("../core/capability");
|
|
5
|
+
// SARIF forbids a region that carries columns without a line, so positions are
|
|
6
|
+
// emitted together or not at all.
|
|
7
|
+
function buildRegion(finding) {
|
|
8
|
+
if (finding.startLine === undefined) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
startLine: finding.startLine,
|
|
13
|
+
endLine: finding.endLine,
|
|
14
|
+
startColumn: finding.startColumn,
|
|
15
|
+
endColumn: finding.endColumn
|
|
16
|
+
};
|
|
17
|
+
}
|
|
4
18
|
function renderSarif(scan) {
|
|
19
|
+
const gaps = scan.capabilityMatrix.tools.filter(capability_1.isCoverageGap);
|
|
5
20
|
return JSON.stringify({
|
|
6
21
|
version: "2.1.0",
|
|
22
|
+
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
7
23
|
runs: [
|
|
8
24
|
{
|
|
9
25
|
tool: {
|
|
@@ -11,6 +27,22 @@ function renderSarif(scan) {
|
|
|
11
27
|
name: "VibeDoctor"
|
|
12
28
|
}
|
|
13
29
|
},
|
|
30
|
+
invocations: [
|
|
31
|
+
{
|
|
32
|
+
executionSuccessful: scan.completeness.status !== "invalid",
|
|
33
|
+
// Every tool that did not fully cover the repository is reported
|
|
34
|
+
// here, so a consumer never reads an incomplete scan as a clean one.
|
|
35
|
+
toolExecutionNotifications: gaps.map((tool) => ({
|
|
36
|
+
level: tool.trust === "absent" ? "error" : "warning",
|
|
37
|
+
message: {
|
|
38
|
+
text: `${tool.id} (${(0, capability_1.capabilityStateLabel)(tool.state)}): ${tool.reason}${tool.remediation ? ` ${tool.remediation}` : ""}`
|
|
39
|
+
},
|
|
40
|
+
descriptor: {
|
|
41
|
+
id: `vibedoctor.coverage.${tool.id}`
|
|
42
|
+
}
|
|
43
|
+
}))
|
|
44
|
+
}
|
|
45
|
+
],
|
|
14
46
|
results: scan.findings.map((finding) => ({
|
|
15
47
|
ruleId: finding.id,
|
|
16
48
|
level: finding.severity === "critical" || finding.severity === "high" ? "error" : "warning",
|
|
@@ -21,8 +53,22 @@ function renderSarif(scan) {
|
|
|
21
53
|
category: finding.category,
|
|
22
54
|
confidence: finding.confidence,
|
|
23
55
|
entityType: finding.evidence?.entityType,
|
|
24
|
-
sensitivity: finding.evidence?.sensitivity
|
|
56
|
+
sensitivity: finding.evidence?.sensitivity,
|
|
57
|
+
evidenceGrade: finding.evidenceGrade,
|
|
58
|
+
fileRole: finding.fileRole,
|
|
59
|
+
baselineState: finding.baselineState,
|
|
60
|
+
priority: finding.priority,
|
|
61
|
+
package: finding.package
|
|
25
62
|
},
|
|
63
|
+
suppressions: finding.suppression
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
kind: "external",
|
|
67
|
+
status: finding.suppression.expired ? "rejected" : "accepted",
|
|
68
|
+
justification: `${finding.suppression.ruleId} (${finding.suppression.classification}): ${finding.suppression.reason}`
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
: undefined,
|
|
26
72
|
locations: finding.file
|
|
27
73
|
? [
|
|
28
74
|
{
|
|
@@ -30,14 +76,17 @@ function renderSarif(scan) {
|
|
|
30
76
|
artifactLocation: {
|
|
31
77
|
uri: finding.file
|
|
32
78
|
},
|
|
33
|
-
region:
|
|
34
|
-
startLine: finding.startLine
|
|
35
|
-
}
|
|
79
|
+
region: buildRegion(finding)
|
|
36
80
|
}
|
|
37
81
|
}
|
|
38
82
|
]
|
|
39
83
|
: undefined
|
|
40
|
-
}))
|
|
84
|
+
})),
|
|
85
|
+
properties: {
|
|
86
|
+
capabilityMatrix: scan.capabilityMatrix,
|
|
87
|
+
relevance: scan.relevance,
|
|
88
|
+
suppressions: scan.suppressions
|
|
89
|
+
}
|
|
41
90
|
}
|
|
42
91
|
]
|
|
43
92
|
}, null, 2);
|