@neuralaxis/vibedoctor 0.2.0 → 0.2.2
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 +135 -23
- package/dist/adapters/biome.js +136 -21
- package/dist/adapters/flowDoctor.d.ts +7 -0
- package/dist/adapters/flowDoctor.js +195 -0
- package/dist/adapters/gitleaks.js +4 -2
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +3 -1
- package/dist/adapters/osvScanner.js +140 -19
- package/dist/adapters/presidio.js +3 -1
- package/dist/adapters/ruff.js +7 -3
- package/dist/adapters/shared.d.ts +4 -0
- package/dist/cli/commands/init.js +112 -50
- package/dist/cli/commands/privacyReview.js +3 -4
- package/dist/cli/commands/scan.d.ts +6 -0
- package/dist/cli/commands/scan.js +16 -2
- package/dist/cli/commands/setup.d.ts +13 -17
- package/dist/cli/commands/setup.js +138 -200
- package/dist/cli/index.js +4 -4
- package/dist/core/agentDiagnosis.d.ts +39 -0
- package/dist/core/agentDiagnosis.js +96 -0
- package/dist/core/capability.d.ts +92 -0
- package/dist/core/capability.js +122 -0
- package/dist/core/config.d.ts +47 -0
- package/dist/core/config.js +134 -3
- package/dist/core/credentialHeuristics.d.ts +28 -0
- package/dist/core/credentialHeuristics.js +179 -0
- package/dist/core/engine.d.ts +29 -1
- package/dist/core/engine.js +510 -126
- 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 +125 -1
- package/dist/core/finding.js +70 -8
- package/dist/core/findingCorrelator.d.ts +19 -0
- package/dist/core/findingCorrelator.js +112 -0
- package/dist/core/findingNormalizer.d.ts +33 -0
- package/dist/core/findingNormalizer.js +172 -0
- package/dist/core/managedTools.d.ts +25 -0
- package/dist/core/managedTools.js +186 -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/repoGraph.d.ts +62 -0
- package/dist/core/repoGraph.js +408 -0
- package/dist/core/riskRanker.d.ts +6 -0
- package/dist/core/riskRanker.js +127 -0
- package/dist/core/scanContext.d.ts +26 -0
- package/dist/core/scanContext.js +44 -0
- package/dist/core/scanPlanner.d.ts +13 -0
- package/dist/core/scanPlanner.js +66 -38
- 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 +254 -0
- package/dist/core/toolRunner.d.ts +27 -2
- package/dist/core/toolRunner.js +79 -93
- package/dist/core/toolRuntime.d.ts +40 -0
- package/dist/core/toolRuntime.js +417 -0
- package/dist/core/toolVerification.d.ts +89 -0
- package/dist/core/toolVerification.js +425 -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/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/reporters/agent.d.ts +1 -1
- package/dist/reporters/agent.js +7 -0
- 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 +80 -80
|
@@ -13,13 +13,72 @@ function parseOsv(stdout) {
|
|
|
13
13
|
for (const vulnerability of pkg.vulnerabilities ?? []) {
|
|
14
14
|
findings.push({
|
|
15
15
|
...vulnerability,
|
|
16
|
-
package: vulnerability.package ?? pkg.package
|
|
16
|
+
package: vulnerability.package ?? pkg.package,
|
|
17
|
+
sourcePath: result.source?.path,
|
|
18
|
+
dependencyGroups: pkg.dependency_groups
|
|
17
19
|
});
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
return findings;
|
|
22
24
|
}
|
|
25
|
+
/** First version that fixes the advisory, read from the affected-range events. */
|
|
26
|
+
function firstFixedVersion(item) {
|
|
27
|
+
for (const affected of item.affected ?? []) {
|
|
28
|
+
for (const range of affected.ranges ?? []) {
|
|
29
|
+
const fixed = range.events?.find((event) => event.fixed)?.fixed;
|
|
30
|
+
if (fixed) {
|
|
31
|
+
return fixed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Determines whether the vulnerable package ships to production.
|
|
39
|
+
*
|
|
40
|
+
* A remote-code-execution advisory in a dev server and one in a PDF renderer that
|
|
41
|
+
* runs on user input are not comparable risks, and a report that lists both as
|
|
42
|
+
* "critical dependency vulnerability" makes them look identical. OSV reports
|
|
43
|
+
* dependency groups where the ecosystem supports it; otherwise the project's own
|
|
44
|
+
* manifest is the authority.
|
|
45
|
+
*/
|
|
46
|
+
function resolveScope(item, ctx) {
|
|
47
|
+
const groups = item.dependencyGroups?.map((group) => group.toLowerCase()) ?? [];
|
|
48
|
+
if (groups.includes("dev") || groups.includes("development")) {
|
|
49
|
+
return "dev";
|
|
50
|
+
}
|
|
51
|
+
if (groups.includes("optional")) {
|
|
52
|
+
return "optional";
|
|
53
|
+
}
|
|
54
|
+
if (groups.length > 0) {
|
|
55
|
+
return "runtime";
|
|
56
|
+
}
|
|
57
|
+
const name = item.package?.name;
|
|
58
|
+
if (!name) {
|
|
59
|
+
return "unknown";
|
|
60
|
+
}
|
|
61
|
+
const manifest = ctx.project.declaredDependencies;
|
|
62
|
+
if (!manifest) {
|
|
63
|
+
return "unknown";
|
|
64
|
+
}
|
|
65
|
+
// Ecosystems disagree on case normalization (PyPI names are case-insensitive),
|
|
66
|
+
// so compare case-insensitively rather than missing a match on capitalization.
|
|
67
|
+
const needle = name.toLowerCase();
|
|
68
|
+
const has = (names) => names.some((candidate) => candidate.toLowerCase() === needle);
|
|
69
|
+
if (has(manifest.runtime)) {
|
|
70
|
+
return "runtime";
|
|
71
|
+
}
|
|
72
|
+
if (has(manifest.dev)) {
|
|
73
|
+
return "dev";
|
|
74
|
+
}
|
|
75
|
+
if (has(manifest.optional)) {
|
|
76
|
+
return "optional";
|
|
77
|
+
}
|
|
78
|
+
// Present in the lockfile but in no manifest section: it arrived through
|
|
79
|
+
// another package.
|
|
80
|
+
return "transitive";
|
|
81
|
+
}
|
|
23
82
|
function severityFromCvss(item) {
|
|
24
83
|
const namedSeverity = item.database_specific?.severity?.toLowerCase();
|
|
25
84
|
if (namedSeverity === "critical" || namedSeverity === "high" || namedSeverity === "medium" || namedSeverity === "low") {
|
|
@@ -45,6 +104,7 @@ exports.osvScannerAdapter = {
|
|
|
45
104
|
},
|
|
46
105
|
buildScanCommand(ctx) {
|
|
47
106
|
return {
|
|
107
|
+
tool: "osv-scanner",
|
|
48
108
|
cmd: "osv-scanner",
|
|
49
109
|
args: [
|
|
50
110
|
"scan",
|
|
@@ -56,25 +116,86 @@ exports.osvScannerAdapter = {
|
|
|
56
116
|
"error"
|
|
57
117
|
],
|
|
58
118
|
cwd: ctx.root,
|
|
59
|
-
timeoutMs: 60_000
|
|
119
|
+
timeoutMs: 60_000,
|
|
120
|
+
runtime: ctx.toolRuntime
|
|
60
121
|
};
|
|
61
122
|
},
|
|
62
|
-
parseResult(result) {
|
|
63
|
-
return parseOsv(result.stdout).map((item, index) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
123
|
+
parseResult(result, ctx) {
|
|
124
|
+
return parseOsv(result.stdout).map((item, index) => {
|
|
125
|
+
const name = item.package?.name ?? "unknown";
|
|
126
|
+
const version = item.package?.version;
|
|
127
|
+
const scope = resolveScope(item, ctx);
|
|
128
|
+
const fixedIn = firstFixedVersion(item);
|
|
129
|
+
const baseSeverity = severityFromCvss(item);
|
|
130
|
+
// A dev-only advisory is real but not shipped. Keeping it at the advisory's
|
|
131
|
+
// raw severity is what made a build-tool notice indistinguishable from a
|
|
132
|
+
// vulnerability in code that touches user input.
|
|
133
|
+
const severity = scope === "dev" || scope === "optional"
|
|
134
|
+
? baseSeverity === "critical"
|
|
135
|
+
? "medium"
|
|
136
|
+
: baseSeverity === "high"
|
|
137
|
+
? "medium"
|
|
138
|
+
: "low"
|
|
139
|
+
: baseSeverity;
|
|
140
|
+
const scopeLabel = scope === "dev"
|
|
141
|
+
? "development-only dependency"
|
|
142
|
+
: scope === "optional"
|
|
143
|
+
? "optional dependency"
|
|
144
|
+
: scope === "transitive"
|
|
145
|
+
? "transitive dependency"
|
|
146
|
+
: scope === "runtime"
|
|
147
|
+
? "runtime dependency"
|
|
148
|
+
: "dependency (scope undetermined)";
|
|
149
|
+
return {
|
|
150
|
+
id: `osv:${name}:${version ?? "unknown"}:${item.id ?? index}`,
|
|
151
|
+
source: "osv-scanner",
|
|
152
|
+
category: "dependencies",
|
|
153
|
+
severity,
|
|
154
|
+
confidence: "high",
|
|
155
|
+
title: item.id ?? "Dependency vulnerability",
|
|
156
|
+
message: [
|
|
157
|
+
`${name}${version ? `@${version}` : ""} (${scopeLabel}):`,
|
|
158
|
+
item.summary ?? "Known vulnerability detected.",
|
|
159
|
+
fixedIn ? `Fixed in ${fixedIn}.` : "No fixed version is published yet."
|
|
160
|
+
].join(" "),
|
|
161
|
+
isNew: true,
|
|
162
|
+
isAutofixable: false,
|
|
163
|
+
safeToAutofix: false,
|
|
164
|
+
agentInstruction: fixedIn
|
|
165
|
+
? `Upgrade ${name} to ${fixedIn} or later, then rerun tests.`
|
|
166
|
+
: `No fix is available for ${name}; assess whether the vulnerable code path is reachable, or replace the dependency.`,
|
|
167
|
+
tags: ["dependencies", "security", `scope:${scope}`],
|
|
168
|
+
package: {
|
|
169
|
+
name,
|
|
170
|
+
version,
|
|
171
|
+
ecosystem: item.package?.ecosystem,
|
|
172
|
+
scope,
|
|
173
|
+
fixedIn,
|
|
174
|
+
manifest: item.sourcePath
|
|
175
|
+
},
|
|
176
|
+
remediation: {
|
|
177
|
+
kind: "dependency",
|
|
178
|
+
component: name,
|
|
179
|
+
steps: fixedIn
|
|
180
|
+
? [`Upgrade ${name} from ${version ?? "the installed version"} to ${fixedIn} or later.`, "Run the test suite."]
|
|
181
|
+
: [
|
|
182
|
+
`Check whether the vulnerable code path in ${name} is reachable from this project.`,
|
|
183
|
+
"If it is, pin to a safe version, patch, or replace the dependency."
|
|
184
|
+
],
|
|
185
|
+
requiredEvidence: fixedIn ? `Lockfile showing ${name} at ${fixedIn} or later.` : "Reachability assessment for the advisory."
|
|
186
|
+
},
|
|
187
|
+
evidence: {
|
|
188
|
+
toolRawId: item.id,
|
|
189
|
+
reasons: [
|
|
190
|
+
`Advisory severity: ${baseSeverity}.`,
|
|
191
|
+
severity === baseSeverity
|
|
192
|
+
? `Reported at advisory severity because ${name} is a ${scopeLabel}.`
|
|
193
|
+
: `Reduced from ${baseSeverity} to ${severity} because ${name} is a ${scopeLabel} and does not ship to production.`
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
scoreImpact: 0
|
|
197
|
+
};
|
|
198
|
+
});
|
|
78
199
|
},
|
|
79
|
-
installHint: "
|
|
200
|
+
installHint: "VibeDoctor provisions a pinned OSV-Scanner into ~/.cache/vibedoctor when needed. To use a project-local copy, put osv-scanner on PATH."
|
|
80
201
|
};
|
|
@@ -126,7 +126,9 @@ exports.presidioAdapter = {
|
|
|
126
126
|
cmd: "python",
|
|
127
127
|
args: ["-c", PRESIDIO_SCRIPT, ctx.root],
|
|
128
128
|
cwd: ctx.root,
|
|
129
|
-
|
|
129
|
+
// Respect the configured budget rather than a fixed ceiling, so
|
|
130
|
+
// runtime.tool_timeouts governs every tool uniformly.
|
|
131
|
+
timeoutMs: Math.max(1, ctx.config.runtime.toolTimeouts.presidio ?? ctx.config.runtime.defaultTimeoutSeconds) * 1000,
|
|
130
132
|
env: {
|
|
131
133
|
VIBEDOCTOR_PRESIDIO_FILES: JSON.stringify(files),
|
|
132
134
|
VIBEDOCTOR_PRESIDIO_MAX_FILE_BYTES: String(ctx.config.checks.privacy.maxFileBytes)
|
package/dist/adapters/ruff.js
CHANGED
|
@@ -29,10 +29,12 @@ exports.ruffAdapter = {
|
|
|
29
29
|
const targets = (0, shared_1.adapterTargets)(ctx, /\.py$/i);
|
|
30
30
|
const excludePatterns = ctx.config.paths.exclude.length > 0 ? ["--exclude", ctx.config.paths.exclude.join(",")] : [];
|
|
31
31
|
return {
|
|
32
|
+
tool: "ruff",
|
|
32
33
|
cmd: "ruff",
|
|
33
34
|
args: ["check", ...targets, "--output-format", "json", ...excludePatterns],
|
|
34
35
|
cwd: ctx.root,
|
|
35
|
-
timeoutMs: 60_000
|
|
36
|
+
timeoutMs: 60_000,
|
|
37
|
+
runtime: ctx.toolRuntime
|
|
36
38
|
};
|
|
37
39
|
},
|
|
38
40
|
parseResult(result, ctx) {
|
|
@@ -64,11 +66,13 @@ exports.ruffAdapter = {
|
|
|
64
66
|
},
|
|
65
67
|
buildFixCommand(ctx) {
|
|
66
68
|
return {
|
|
69
|
+
tool: "ruff",
|
|
67
70
|
cmd: "ruff",
|
|
68
71
|
args: ["check", ".", "--fix"],
|
|
69
72
|
cwd: ctx.root,
|
|
70
|
-
timeoutMs: 60_000
|
|
73
|
+
timeoutMs: 60_000,
|
|
74
|
+
runtime: ctx.toolRuntime
|
|
71
75
|
};
|
|
72
76
|
},
|
|
73
|
-
installHint: "
|
|
77
|
+
installHint: "VibeDoctor provisions a pinned Ruff into ~/.cache/vibedoctor when needed. To use a project-local copy, install it in the environment."
|
|
74
78
|
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { VibeDoctorConfig } from "../core/config";
|
|
2
2
|
import type { Finding, FindingCategory } from "../core/finding";
|
|
3
3
|
import type { ProjectContext } from "../core/projectDetector";
|
|
4
|
+
import type { ScanContext } from "../core/scanContext";
|
|
5
|
+
import type { ToolRuntime } from "../core/toolRuntime";
|
|
4
6
|
import type { CommandSpec, ToolResult } from "../core/toolRunner";
|
|
5
7
|
export type ToolAdapterContext = {
|
|
6
8
|
root: string;
|
|
7
9
|
project: ProjectContext;
|
|
8
10
|
config: VibeDoctorConfig;
|
|
9
11
|
scanMode: "default" | "changed" | "quick" | "full";
|
|
12
|
+
toolRuntime?: ToolRuntime;
|
|
13
|
+
scanContext?: ScanContext;
|
|
10
14
|
/** Results already produced by the scan engine, available to dependent adapters for reuse. */
|
|
11
15
|
sharedToolResults?: Record<string, SharedToolExecution>;
|
|
12
16
|
};
|
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const config_1 = require("../../core/config");
|
|
10
10
|
const paths_1 = require("../../core/paths");
|
|
11
11
|
const projectDetector_1 = require("../../core/projectDetector");
|
|
12
|
+
const suppressions_1 = require("../../core/suppressions");
|
|
12
13
|
function buildYaml(detectedLanguages) {
|
|
13
14
|
const languagesBlock = detectedLanguages.length > 0
|
|
14
15
|
? ` languages:\n${detectedLanguages.map((language) => ` - ${language}`).join("\n")}`
|
|
@@ -32,35 +33,85 @@ paths:
|
|
|
32
33
|
- dist/**
|
|
33
34
|
- build/**
|
|
34
35
|
- .venv/**
|
|
35
|
-
- coverage/**
|
|
36
|
-
- .next/**
|
|
37
|
-
- vendor/**
|
|
38
|
-
- .agents/**
|
|
39
|
-
- test/**
|
|
40
|
-
- tests/**
|
|
41
|
-
- "**/test/**"
|
|
42
|
-
- "**/tests/**"
|
|
43
|
-
- "**/*.test.*"
|
|
44
|
-
- "**/*.spec.*"
|
|
45
|
-
- "**/__tests__/**"
|
|
46
|
-
|
|
47
|
-
baseline:
|
|
36
|
+
- coverage/**
|
|
37
|
+
- .next/**
|
|
38
|
+
- vendor/**
|
|
39
|
+
- .agents/**
|
|
40
|
+
- test/**
|
|
41
|
+
- tests/**
|
|
42
|
+
- "**/test/**"
|
|
43
|
+
- "**/tests/**"
|
|
44
|
+
- "**/*.test.*"
|
|
45
|
+
- "**/*.spec.*"
|
|
46
|
+
- "**/__tests__/**"
|
|
47
|
+
|
|
48
|
+
baseline:
|
|
48
49
|
enabled: true
|
|
49
50
|
file: .vibedoctor/baseline.json
|
|
50
51
|
fail_only_on_new_issues: true
|
|
51
52
|
|
|
52
|
-
score:
|
|
53
|
-
minimum: ${config_1.defaultConfig.score.minimum}
|
|
54
|
-
|
|
55
|
-
runtime:
|
|
56
|
-
default_timeout_seconds: ${config_1.defaultConfig.runtime.defaultTimeoutSeconds}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
score:
|
|
54
|
+
minimum: ${config_1.defaultConfig.score.minimum}
|
|
55
|
+
|
|
56
|
+
runtime:
|
|
57
|
+
default_timeout_seconds: ${config_1.defaultConfig.runtime.defaultTimeoutSeconds}
|
|
58
|
+
# Per-tool time budgets. A tool that exceeds its budget is reported as timed
|
|
59
|
+
# out, never as passing.
|
|
60
|
+
tool_timeouts:
|
|
61
|
+
biome: ${config_1.defaultConfig.runtime.toolTimeouts.biome}
|
|
62
|
+
semgrep: ${config_1.defaultConfig.runtime.toolTimeouts.semgrep}
|
|
63
|
+
required_tools: []
|
|
64
|
+
fail_on_incomplete_scan: false
|
|
65
|
+
# Wall-clock ceiling for the whole scan; 0 means no ceiling.
|
|
66
|
+
total_budget_seconds: ${config_1.defaultConfig.runtime.totalBudgetSeconds}
|
|
67
|
+
# On timeout: scoped_retry reruns the tool over changed files only and reports
|
|
68
|
+
# the partial coverage. Alternatives: skip, fail.
|
|
69
|
+
on_timeout: ${config_1.defaultConfig.runtime.onTimeout}
|
|
70
|
+
scoped_retry_timeout_seconds: ${config_1.defaultConfig.runtime.scopedRetryTimeoutSeconds}
|
|
71
|
+
# Tools deliberately not run. The report says they were deferred rather than
|
|
72
|
+
# implying they passed — use this for tools this environment cannot support.
|
|
73
|
+
deferred_tools: []
|
|
74
|
+
verify_tools_before_scan: true
|
|
75
|
+
managed_tools:
|
|
76
|
+
enabled: true
|
|
77
|
+
allow_network: true
|
|
78
|
+
prefer_project_local: true
|
|
79
|
+
|
|
80
|
+
# Controls how much of what the tools report actually reaches the report.
|
|
81
|
+
# Nothing is dropped silently: every filter states what it withheld and why.
|
|
82
|
+
relevance:
|
|
83
|
+
enabled: true
|
|
84
|
+
min_confidence: ${config_1.defaultConfig.relevance.minConfidence}
|
|
85
|
+
max_findings_per_tool: ${config_1.defaultConfig.relevance.maxFindingsPerTool}
|
|
86
|
+
max_findings_total: ${config_1.defaultConfig.relevance.maxFindingsTotal}
|
|
87
|
+
# Findings in tests, fixtures, generated, and vendored files: keep, downgrade,
|
|
88
|
+
# or drop.
|
|
89
|
+
synthetic_file_policy: ${config_1.defaultConfig.relevance.syntheticFilePolicy}
|
|
90
|
+
# Check that findings claiming to be credentials look like credentials.
|
|
91
|
+
validate_secrets: true
|
|
92
|
+
per_tool:
|
|
93
|
+
vulture:
|
|
94
|
+
min_confidence: medium
|
|
95
|
+
max_findings: 50
|
|
96
|
+
pyright:
|
|
97
|
+
max_findings: 150
|
|
98
|
+
tsc:
|
|
99
|
+
max_findings: 150
|
|
100
|
+
# Correct a file-role misclassification without disabling the defaults.
|
|
101
|
+
# file_roles:
|
|
102
|
+
# source: ["fixtures/real/**"]
|
|
103
|
+
|
|
104
|
+
# Acknowledged findings live in this file. Each entry needs a reason; an expiry
|
|
105
|
+
# date is strongly recommended, because a lapsed acknowledgement resurfaces its
|
|
106
|
+
# findings instead of hiding them forever.
|
|
107
|
+
suppressions:
|
|
108
|
+
enabled: true
|
|
109
|
+
file: ${config_1.defaultConfig.suppressions.file}
|
|
110
|
+
# Turn this on to reject acknowledgements that have no expiry date: they are
|
|
111
|
+
# listed as rejected in the report and hide nothing.
|
|
112
|
+
require_expiry: false
|
|
113
|
+
|
|
114
|
+
checks:
|
|
64
115
|
security:
|
|
65
116
|
enabled: true
|
|
66
117
|
fail_on_secrets: true
|
|
@@ -71,6 +122,9 @@ checks:
|
|
|
71
122
|
fail_on_type_errors: true
|
|
72
123
|
fail_on_test_failures: true
|
|
73
124
|
|
|
125
|
+
flow_analysis:
|
|
126
|
+
enabled: true
|
|
127
|
+
|
|
74
128
|
dead_code:
|
|
75
129
|
enabled: true
|
|
76
130
|
delete_automatically: false
|
|
@@ -94,33 +148,33 @@ checks:
|
|
|
94
148
|
min_coverage: 70
|
|
95
149
|
min_changed_code_coverage: 80
|
|
96
150
|
|
|
97
|
-
dependencies:
|
|
98
|
-
enabled: true
|
|
99
|
-
fail_on_missing_dependencies: true
|
|
100
|
-
fail_on_new_direct_vulnerabilities: true
|
|
101
|
-
|
|
102
|
-
privacy:
|
|
103
|
-
enabled: true
|
|
104
|
-
min_confidence_to_report: medium
|
|
105
|
-
mask_examples: true
|
|
106
|
-
max_file_bytes: 1048576
|
|
107
|
-
fail_on_regulated_identifiers: false
|
|
108
|
-
fail_on_sensitive_attributes: false
|
|
109
|
-
ai:
|
|
110
|
-
enabled: false
|
|
111
|
-
api_key_env: VIBEDOCTOR_AI_API_KEY
|
|
112
|
-
base_url_env: VIBEDOCTOR_AI_BASE_URL
|
|
113
|
-
model_env: VIBEDOCTOR_AI_MODEL
|
|
114
|
-
include_raw_values: false
|
|
115
|
-
presidio:
|
|
116
|
-
enabled: false
|
|
117
|
-
|
|
118
|
-
output:
|
|
151
|
+
dependencies:
|
|
152
|
+
enabled: true
|
|
153
|
+
fail_on_missing_dependencies: true
|
|
154
|
+
fail_on_new_direct_vulnerabilities: true
|
|
155
|
+
|
|
156
|
+
privacy:
|
|
157
|
+
enabled: true
|
|
158
|
+
min_confidence_to_report: medium
|
|
159
|
+
mask_examples: true
|
|
160
|
+
max_file_bytes: 1048576
|
|
161
|
+
fail_on_regulated_identifiers: false
|
|
162
|
+
fail_on_sensitive_attributes: false
|
|
163
|
+
ai:
|
|
164
|
+
enabled: false
|
|
165
|
+
api_key_env: VIBEDOCTOR_AI_API_KEY
|
|
166
|
+
base_url_env: VIBEDOCTOR_AI_BASE_URL
|
|
167
|
+
model_env: VIBEDOCTOR_AI_MODEL
|
|
168
|
+
include_raw_values: false
|
|
169
|
+
presidio:
|
|
170
|
+
enabled: false
|
|
171
|
+
|
|
172
|
+
output:
|
|
119
173
|
terminal: true
|
|
120
174
|
json: .vibedoctor/report.json
|
|
121
|
-
html: .vibedoctor/report.html
|
|
122
|
-
agent: .vibedoctor/agent-plan.md
|
|
123
|
-
privacy_review: .vibedoctor/privacy-review.json
|
|
175
|
+
html: .vibedoctor/report.html
|
|
176
|
+
agent: .vibedoctor/agent-plan.md
|
|
177
|
+
privacy_review: .vibedoctor/privacy-review.json
|
|
124
178
|
`;
|
|
125
179
|
}
|
|
126
180
|
async function runInit(root) {
|
|
@@ -130,5 +184,13 @@ async function runInit(root) {
|
|
|
130
184
|
await (0, paths_1.ensureDir)(baselineDir);
|
|
131
185
|
await node_fs_1.promises.writeFile(configPath, buildYaml(project.languages), "utf8");
|
|
132
186
|
await node_fs_1.promises.writeFile(node_path_1.default.join(baselineDir, "baseline.json"), JSON.stringify({ createdAt: new Date().toISOString(), findings: [] }, null, 2), "utf8");
|
|
187
|
+
// Scaffold the acknowledgements file with its rules explained, so the first
|
|
188
|
+
// person who needs to suppress a false positive finds the format waiting for
|
|
189
|
+
// them instead of inventing one. Never overwrite an existing file.
|
|
190
|
+
const suppressionsPath = node_path_1.default.join(root, config_1.defaultConfig.suppressions.file);
|
|
191
|
+
if (!(await (0, paths_1.pathExists)(suppressionsPath))) {
|
|
192
|
+
await (0, paths_1.ensureDir)(node_path_1.default.dirname(suppressionsPath));
|
|
193
|
+
await node_fs_1.promises.writeFile(suppressionsPath, suppressions_1.SUPPRESSIONS_TEMPLATE, "utf8");
|
|
194
|
+
}
|
|
133
195
|
return configPath;
|
|
134
196
|
}
|
|
@@ -18,10 +18,9 @@ async function loadOrRefreshScan(root, refresh) {
|
|
|
18
18
|
const parsed = JSON.parse(await node_fs_1.promises.readFile(reportPath, "utf8"));
|
|
19
19
|
if (Array.isArray(parsed.findings)) {
|
|
20
20
|
const privacyFindings = parsed.privacyFindings ?? parsed.findings.filter((finding) => finding.category === "privacy");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
21
|
+
// A cached report may predate fields this version expects, so fill the gaps
|
|
22
|
+
// rather than handing downstream code a half-built scan.
|
|
23
|
+
return (0, engine_1.withReportingDefaults)({ ...parsed, findings: parsed.findings, privacyFindings });
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
const scan = await (0, engine_1.runScan)(root, "full");
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { VibeDoctorConfig } from "../../core/config";
|
|
2
2
|
import { type ScanOutput } from "../../core/engine";
|
|
3
|
+
import type { ScanMode } from "../../core/scanPlanner";
|
|
3
4
|
export type ScanCommandResult = {
|
|
4
5
|
output: string;
|
|
5
6
|
exitCode: number;
|
|
6
7
|
};
|
|
7
8
|
export declare function determineExitCode(scan: Pick<ScanOutput, "score" | "findings"> & Partial<Pick<ScanOutput, "completeness">>, config: VibeDoctorConfig): number;
|
|
9
|
+
export declare function resolveScanMode(options: {
|
|
10
|
+
changed?: boolean;
|
|
11
|
+
quick?: boolean;
|
|
12
|
+
full?: boolean;
|
|
13
|
+
}): ScanMode;
|
|
8
14
|
export declare function runScanCommand(root: string, options: {
|
|
9
15
|
changed?: boolean;
|
|
10
16
|
quick?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.determineExitCode = determineExitCode;
|
|
4
|
+
exports.resolveScanMode = resolveScanMode;
|
|
4
5
|
exports.runScanCommand = runScanCommand;
|
|
5
6
|
const engine_1 = require("../../core/engine");
|
|
6
7
|
const finding_1 = require("../../core/finding");
|
|
@@ -43,7 +44,11 @@ function determineExitCode(scan, config) {
|
|
|
43
44
|
failingFindings.some((finding) => finding.source === "deptry" && finding.title === "DEP002");
|
|
44
45
|
const typeFailure = config.checks.correctness.enabled &&
|
|
45
46
|
config.checks.correctness.failOnTypeErrors &&
|
|
46
|
-
failingFindings.some((finding) =>
|
|
47
|
+
failingFindings.some((finding) => finding.source === "tsc" ||
|
|
48
|
+
finding.source === "pyright" ||
|
|
49
|
+
(finding.category === "correctness" &&
|
|
50
|
+
isHighSeverity(finding) &&
|
|
51
|
+
finding.source !== "flow-doctor"));
|
|
47
52
|
const testFailure = config.checks.correctness.enabled &&
|
|
48
53
|
config.checks.correctness.failOnTestFailures &&
|
|
49
54
|
failingFindings.some((finding) => finding.category === "tests" && isHighSeverity(finding));
|
|
@@ -71,8 +76,17 @@ function determineExitCode(scan, config) {
|
|
|
71
76
|
? 1
|
|
72
77
|
: 0;
|
|
73
78
|
}
|
|
79
|
+
function resolveScanMode(options) {
|
|
80
|
+
if (options.changed) {
|
|
81
|
+
return "changed";
|
|
82
|
+
}
|
|
83
|
+
if (options.quick) {
|
|
84
|
+
return "quick";
|
|
85
|
+
}
|
|
86
|
+
return "full";
|
|
87
|
+
}
|
|
74
88
|
async function runScanCommand(root, options) {
|
|
75
|
-
const mode = options
|
|
89
|
+
const mode = resolveScanMode(options);
|
|
76
90
|
const scan = await (0, engine_1.runScan)(root, mode);
|
|
77
91
|
const categories = (0, finding_1.parseFindingCategoryList)(options.category);
|
|
78
92
|
const filteredScan = categories ? (0, engine_2.filterScanByCategories)(scan, categories) : scan;
|
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
import type { CommandSpec } from "../../core/toolRunner";
|
|
2
|
-
import { type ProjectContext
|
|
2
|
+
import { type ProjectContext } from "../../core/projectDetector";
|
|
3
|
+
import { type ToolRegistryEntry } from "../../core/toolRegistry";
|
|
4
|
+
import { type RuntimeProbes, type ToolVerification } from "../../core/toolVerification";
|
|
3
5
|
export type SetupPriority = "essential" | "recommended";
|
|
4
6
|
export type SetupInclude = "essential" | "recommended" | "all" | "npm" | "python" | "manual" | "built-in";
|
|
5
7
|
export type SetupOptions = {
|
|
6
8
|
apply?: boolean;
|
|
7
9
|
include?: SetupInclude;
|
|
8
10
|
};
|
|
9
|
-
type SetupTool = {
|
|
10
|
-
id: string;
|
|
11
|
-
packageName?: string;
|
|
12
|
-
executable?: string;
|
|
13
|
-
ecosystem: "npm" | "python" | "manual" | "built-in";
|
|
14
|
-
priority: SetupPriority;
|
|
15
|
-
languages?: ProjectLanguage[];
|
|
16
|
-
requiresLockfile?: boolean;
|
|
17
|
-
reason: string;
|
|
18
|
-
installHint?: string;
|
|
19
|
-
};
|
|
20
11
|
export type SetupPlan = {
|
|
21
12
|
project: ProjectContext;
|
|
22
|
-
builtIn:
|
|
23
|
-
available:
|
|
13
|
+
builtIn: ToolRegistryEntry[];
|
|
14
|
+
available: ToolRegistryEntry[];
|
|
24
15
|
npmPackages: string[];
|
|
25
16
|
pythonPackages: string[];
|
|
26
|
-
manual:
|
|
27
|
-
skipped:
|
|
17
|
+
manual: ToolRegistryEntry[];
|
|
18
|
+
skipped: Array<ToolRegistryEntry & {
|
|
19
|
+
installHint: string;
|
|
20
|
+
}>;
|
|
28
21
|
commands: CommandSpec[];
|
|
22
|
+
/** Runtimes the selected tools need, probed once up front. */
|
|
23
|
+
runtimes: RuntimeProbes;
|
|
24
|
+
/** Verification of every relevant tool as the scanner would resolve it. */
|
|
25
|
+
verifications: ToolVerification[];
|
|
29
26
|
};
|
|
30
27
|
export declare function createSetupPlan(root: string, include?: SetupInclude): Promise<SetupPlan>;
|
|
31
28
|
export declare function runSetupCommand(root: string, options?: SetupOptions): Promise<{
|
|
32
29
|
output: string;
|
|
33
30
|
exitCode: number;
|
|
34
31
|
}>;
|
|
35
|
-
export {};
|