dvalincode 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +209 -4
  2. package/README.zh-CN.md +160 -4
  3. package/dist/agent/compact.d.ts +8 -0
  4. package/dist/agent/compact.js +44 -5
  5. package/dist/agent/compact.js.map +1 -1
  6. package/dist/agent/loop.d.ts +5 -0
  7. package/dist/agent/loop.js +16 -7
  8. package/dist/agent/loop.js.map +1 -1
  9. package/dist/agent/runner.d.ts +4 -3
  10. package/dist/agent/runner.js +81 -8
  11. package/dist/agent/runner.js.map +1 -1
  12. package/dist/agent/session.d.ts +7 -0
  13. package/dist/agent/session.js +27 -1
  14. package/dist/agent/session.js.map +1 -1
  15. package/dist/agent/types.d.ts +5 -1
  16. package/dist/agent/types.js.map +1 -1
  17. package/dist/audit/log.d.ts +5 -1
  18. package/dist/audit/log.js.map +1 -1
  19. package/dist/commands/dvalin.d.ts +7 -1
  20. package/dist/commands/dvalin.js +209 -9
  21. package/dist/commands/dvalin.js.map +1 -1
  22. package/dist/commands/provider.js +2 -0
  23. package/dist/commands/provider.js.map +1 -1
  24. package/dist/commands/run.js +4 -2
  25. package/dist/commands/run.js.map +1 -1
  26. package/dist/commands/security.d.ts +2 -0
  27. package/dist/commands/security.js +228 -14
  28. package/dist/commands/security.js.map +1 -1
  29. package/dist/harness/run.d.ts +8 -2
  30. package/dist/harness/run.js +1 -1
  31. package/dist/harness/run.js.map +1 -1
  32. package/dist/mcp/server.js +5 -2
  33. package/dist/mcp/server.js.map +1 -1
  34. package/dist/providers/anthropic.js +14 -2
  35. package/dist/providers/anthropic.js.map +1 -1
  36. package/dist/providers/openaiCompatible.js +7 -6
  37. package/dist/providers/openaiCompatible.js.map +1 -1
  38. package/dist/providers/retry.d.ts +32 -0
  39. package/dist/providers/retry.js +150 -0
  40. package/dist/providers/retry.js.map +1 -0
  41. package/dist/providers/types.d.ts +10 -0
  42. package/dist/remediation/automate.d.ts +1 -1
  43. package/dist/remediation/automate.js +2 -1
  44. package/dist/remediation/automate.js.map +1 -1
  45. package/dist/remediation/codeQualityExport.d.ts +25 -0
  46. package/dist/remediation/codeQualityExport.js +24 -0
  47. package/dist/remediation/codeQualityExport.js.map +1 -0
  48. package/dist/remediation/evasion.d.ts +61 -0
  49. package/dist/remediation/evasion.js +190 -0
  50. package/dist/remediation/evasion.js.map +1 -0
  51. package/dist/remediation/fixLoop.d.ts +255 -0
  52. package/dist/remediation/fixLoop.js +639 -0
  53. package/dist/remediation/fixLoop.js.map +1 -0
  54. package/dist/remediation/fixLoopStats.d.ts +93 -0
  55. package/dist/remediation/fixLoopStats.js +244 -0
  56. package/dist/remediation/fixLoopStats.js.map +1 -0
  57. package/dist/remediation/rebase.d.ts +44 -0
  58. package/dist/remediation/rebase.js +114 -0
  59. package/dist/remediation/rebase.js.map +1 -0
  60. package/dist/remediation/reproduce.d.ts +47 -0
  61. package/dist/remediation/reproduce.js +75 -0
  62. package/dist/remediation/reproduce.js.map +1 -0
  63. package/dist/remediation/sarif.d.ts +4 -1
  64. package/dist/remediation/sarif.js +19 -1
  65. package/dist/remediation/sarif.js.map +1 -1
  66. package/dist/remediation/scannerSuite.d.ts +51 -3
  67. package/dist/remediation/scannerSuite.js +346 -87
  68. package/dist/remediation/scannerSuite.js.map +1 -1
  69. package/dist/remediation/verify.d.ts +8 -0
  70. package/dist/remediation/verify.js +24 -11
  71. package/dist/remediation/verify.js.map +1 -1
  72. package/dist/security/config.d.ts +8 -2
  73. package/dist/security/config.js +10 -3
  74. package/dist/security/config.js.map +1 -1
  75. package/dist/security/contracts.js +15 -0
  76. package/dist/security/contracts.js.map +1 -1
  77. package/dist/security/fixRecord.d.ts +103 -8
  78. package/dist/security/fixRecord.js +113 -11
  79. package/dist/security/fixRecord.js.map +1 -1
  80. package/dist/security/fixRecordFile.d.ts +11 -2
  81. package/dist/security/fixRecordFile.js +20 -2
  82. package/dist/security/fixRecordFile.js.map +1 -1
  83. package/dist/security/fixRecordSignature.d.ts +104 -0
  84. package/dist/security/fixRecordSignature.js +227 -0
  85. package/dist/security/fixRecordSignature.js.map +1 -0
  86. package/dist/security/guardedScan.d.ts +39 -0
  87. package/dist/security/guardedScan.js +45 -0
  88. package/dist/security/guardedScan.js.map +1 -0
  89. package/dist/security/onboarding.d.ts +28 -0
  90. package/dist/security/onboarding.js +124 -0
  91. package/dist/security/onboarding.js.map +1 -0
  92. package/dist/security/reproduceInCi.d.ts +44 -0
  93. package/dist/security/reproduceInCi.js +96 -0
  94. package/dist/security/reproduceInCi.js.map +1 -0
  95. package/dist/security/reverify.d.ts +130 -0
  96. package/dist/security/reverify.js +361 -0
  97. package/dist/security/reverify.js.map +1 -0
  98. package/dist/security/suppressionGuard.d.ts +58 -0
  99. package/dist/security/suppressionGuard.js +216 -0
  100. package/dist/security/suppressionGuard.js.map +1 -0
  101. package/dist/security/verifyRun.js +14 -3
  102. package/dist/security/verifyRun.js.map +1 -1
  103. package/dist/security/workflow.d.ts +11 -1
  104. package/dist/security/workflow.js +2 -0
  105. package/dist/security/workflow.js.map +1 -1
  106. package/dist/server/routes/config.js +2 -0
  107. package/dist/server/routes/config.js.map +1 -1
  108. package/dist/server/routes/remediation.js +6 -5
  109. package/dist/server/routes/remediation.js.map +1 -1
  110. package/dist/tools/editFile.js +9 -2
  111. package/dist/tools/editFile.js.map +1 -1
  112. package/dist/tools/registry.d.ts +4 -1
  113. package/dist/tools/registry.js +29 -9
  114. package/dist/tools/registry.js.map +1 -1
  115. package/dist/tools/runSecuritySuite.d.ts +3 -0
  116. package/dist/tools/runSecuritySuite.js +2 -2
  117. package/dist/tools/runSecuritySuite.js.map +1 -1
  118. package/dist/version.d.ts +1 -1
  119. package/dist/version.js +1 -1
  120. package/package.json +1 -1
@@ -0,0 +1,130 @@
1
+ import { AuditSink } from '../audit/log.js';
2
+ import { runDvalinScanSuite, type DvalinScannerId } from '../remediation/scannerSuite.js';
3
+ import { type DvalinSecurityConfig } from './config.js';
4
+ import { type SecurityCoverage, type SecurityFindingSnapshot, type SecurityThreshold } from './contracts.js';
5
+ import { type VerifiedFixRecord } from './fixRecord.js';
6
+ import type { FixRecordSignatureCheck, TrustedKey } from './fixRecordSignature.js';
7
+ import type { SecurityCheckEvidence } from './workflow.js';
8
+ import { type CiReproduction } from './reproduceInCi.js';
9
+ import { type SuppressionChange } from './suppressionGuard.js';
10
+ /** Scanner credentials the scans use and the checks must not see. */
11
+ export declare const SCANNER_CREDENTIAL_ENV: string[];
12
+ /**
13
+ * Re-execute a fix record's verification, instead of re-deriving it.
14
+ *
15
+ * Offline re-derivation (`verify-fix`) proves a record is self-consistent. A
16
+ * record is self-consistent by construction, so that is all a forger needs to
17
+ * produce: nothing in it is beyond their reach, the exit codes included. The
18
+ * only way to stop taking the issuer's word for what happened is to make it
19
+ * happen again somewhere the issuer does not control.
20
+ *
21
+ * That is this function. On a runner holding the pull request's checkout, it:
22
+ *
23
+ * - scans the **base** commit, so the targets the record claims to have fixed
24
+ * must actually have existed — a record cannot claim credit for removing a
25
+ * finding nobody had;
26
+ * - scans the **head**, so "gone" is observed here, not reported;
27
+ * - runs the project's checks itself, with the checks, gate and scanners taken
28
+ * from the **base** commit's policy — the change under review does not get to
29
+ * choose the rules it is judged by (FV-4);
30
+ * - issues a fresh record from those observations alone.
31
+ *
32
+ * The claimed record contributes exactly two things: which targets to look for,
33
+ * and who the executor was. Its exit codes, coverage, verdict and gate are
34
+ * compared against, never used.
35
+ */
36
+ export declare const REVERIFICATION_KIND = "dvalin-fix-reverification";
37
+ export type ReverificationReport = {
38
+ kind: typeof REVERIFICATION_KIND;
39
+ schemaVersion: 1;
40
+ /** The fresh record verified, every claimed target was reproduced on base, and the claim re-derived. */
41
+ ok: boolean;
42
+ reasons: string[];
43
+ /** Differences between what the claim said and what was observed here. Informational. */
44
+ notes: string[];
45
+ claimed: {
46
+ recordHash: string;
47
+ rederived: boolean;
48
+ reasons: string[];
49
+ verified: boolean;
50
+ signatures: FixRecordSignatureCheck[];
51
+ };
52
+ base: {
53
+ ref: string;
54
+ commit: string;
55
+ scanId: string;
56
+ coverage: SecurityCoverage;
57
+ policy: 'base' | 'default';
58
+ };
59
+ head: {
60
+ commit: string | null;
61
+ scanId: string;
62
+ coverage: SecurityCoverage;
63
+ };
64
+ /**
65
+ * Suppressions this change added. The head was scanned with them undone, so
66
+ * a finding the change silenced rather than fixed still counts against it.
67
+ */
68
+ suppressions: SuppressionChange[];
69
+ /**
70
+ * The claimed record's reproduction, re-executed here: the change's code
71
+ * reverted to base must make the tests fail, and restored must make them
72
+ * pass. Absent when the claim carried no reproduction.
73
+ */
74
+ reproduction?: CiReproduction;
75
+ targets: {
76
+ claimed: number;
77
+ reproduced: number;
78
+ /** Claimed targets the base scan did not report, with the engine that should have. */
79
+ unreproduced: SecurityFindingSnapshot[];
80
+ };
81
+ /** The record issued by this run, from this run's observations. */
82
+ record: VerifiedFixRecord;
83
+ };
84
+ type ScanFn = (cwd: string, options: NonNullable<Parameters<typeof runDvalinScanSuite>[1]>) => ReturnType<typeof runDvalinScanSuite>;
85
+ export type ReverifyInput = {
86
+ /** The claimed record, parsed but not trusted. */
87
+ claim: unknown;
88
+ /** The workspace holding the change under review. */
89
+ root: string;
90
+ /** The git revision the change is measured against. */
91
+ base: string;
92
+ /** Replaces the base policy's scanners. The engines that produced the claimed targets are always added. */
93
+ scanners?: DvalinScannerId[];
94
+ /** Replaces the base policy's gate threshold. */
95
+ threshold?: SecurityThreshold;
96
+ timeoutMs?: number;
97
+ /** Checked on the claim and reported; re-execution does not depend on them. */
98
+ trustedKeys?: TrustedKey[];
99
+ /**
100
+ * Environment variables removed while the checks run, restored afterwards.
101
+ * The scans need scanner credentials; the checks are the reviewed change's
102
+ * own code and must not inherit them. Defaults to SCANNER_CREDENTIAL_ENV.
103
+ */
104
+ withholdFromChecks?: string[];
105
+ /** Dependency seams for deterministic tests. */
106
+ runScan?: ScanFn;
107
+ runChecks?: (input: {
108
+ cwd: string;
109
+ kinds: DvalinSecurityConfig['checks'];
110
+ audit: AuditSink;
111
+ timeoutMs?: number;
112
+ }) => Promise<SecurityCheckEvidence[]>;
113
+ runRepro?: (cwd: string, command: string) => Promise<{
114
+ exitCode: number | null;
115
+ tail: string;
116
+ }>;
117
+ };
118
+ export declare function reverifyFixRecord(input: ReverifyInput): Promise<ReverificationReport>;
119
+ /**
120
+ * Head findings the base did not have.
121
+ *
122
+ * Exact fingerprints include the line number, so comparing them across two
123
+ * commits reports every pre-existing finding below an inserted line as new.
124
+ * Grouping by target (engine, rule, file) and counting fixes that: a group is
125
+ * only charged with what it grew by, and the charged instances are the ones
126
+ * whose exact fingerprint base did not have. A finding that merely moved is
127
+ * not introduced; a second instance of the same rule in the same file is.
128
+ */
129
+ export declare function introducedSince(base: SecurityFindingSnapshot[], head: SecurityFindingSnapshot[]): SecurityFindingSnapshot[];
130
+ export {};
@@ -0,0 +1,361 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { mkdtemp, realpath, rm } from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { promisify } from 'node:util';
6
+ import { randomUUID } from 'node:crypto';
7
+ import { AuditSink } from '../audit/log.js';
8
+ import { canonicalJSON, sha256 } from '../audit/hash.js';
9
+ import { UsageError } from '../core/exitCodes.js';
10
+ import { loadPolicy } from '../core/policy.js';
11
+ import { assertSafeRef } from '../remediation/diffScope.js';
12
+ import { runDvalinScanSuite } from '../remediation/scannerSuite.js';
13
+ import { runProjectVerification } from '../remediation/verify.js';
14
+ import { loadSecurityConfig } from './config.js';
15
+ import { deriveCoverage, scannerIdForSource, securityProjectId, snapshotFinding, } from './contracts.js';
16
+ import { FIX_EXECUTORS, buildFixRecord, verifyFixRecord, } from './fixRecord.js';
17
+ import { rerunReproduction } from './reproduceInCi.js';
18
+ import { resolveReproRunner } from '../remediation/reproduce.js';
19
+ import { describeEvasion, detectEvasion, isTestPath, toRecordEvasion } from '../remediation/evasion.js';
20
+ import { describeSuppressionChange, detectSuppressionChanges, neutralizeSuppressions, } from './suppressionGuard.js';
21
+ const execFileAsync = promisify(execFile);
22
+ /** Scanner credentials the scans use and the checks must not see. */
23
+ export const SCANNER_CREDENTIAL_ENV = ['SNYK_TOKEN', 'SNYK_OAUTH_TOKEN'];
24
+ /**
25
+ * Re-execute a fix record's verification, instead of re-deriving it.
26
+ *
27
+ * Offline re-derivation (`verify-fix`) proves a record is self-consistent. A
28
+ * record is self-consistent by construction, so that is all a forger needs to
29
+ * produce: nothing in it is beyond their reach, the exit codes included. The
30
+ * only way to stop taking the issuer's word for what happened is to make it
31
+ * happen again somewhere the issuer does not control.
32
+ *
33
+ * That is this function. On a runner holding the pull request's checkout, it:
34
+ *
35
+ * - scans the **base** commit, so the targets the record claims to have fixed
36
+ * must actually have existed — a record cannot claim credit for removing a
37
+ * finding nobody had;
38
+ * - scans the **head**, so "gone" is observed here, not reported;
39
+ * - runs the project's checks itself, with the checks, gate and scanners taken
40
+ * from the **base** commit's policy — the change under review does not get to
41
+ * choose the rules it is judged by (FV-4);
42
+ * - issues a fresh record from those observations alone.
43
+ *
44
+ * The claimed record contributes exactly two things: which targets to look for,
45
+ * and who the executor was. Its exit codes, coverage, verdict and gate are
46
+ * compared against, never used.
47
+ */
48
+ export const REVERIFICATION_KIND = 'dvalin-fix-reverification';
49
+ export async function reverifyFixRecord(input) {
50
+ const claimCheck = verifyFixRecord(input.claim, { trustedKeys: input.trustedKeys });
51
+ if (!claimCheck.record)
52
+ throw new UsageError('Not a Dvalin fix record, or written by an unsupported schema version.');
53
+ const claim = claimCheck.record;
54
+ assertSafeRef(input.base);
55
+ const root = await realpath(path.resolve(input.root));
56
+ const repoRoot = await realpath((await git(root, ['rev-parse', '--show-toplevel'])).trim());
57
+ const subpath = path.relative(repoRoot, root);
58
+ const baseCommit = (await git(root, ['rev-parse', '--verify', '--quiet', `${input.base}^{commit}`]).catch(() => '')).trim();
59
+ if (!baseCommit)
60
+ throw new UsageError(`Cannot resolve base revision '${input.base}'. Fetch it first (actions/checkout with fetch-depth: 0).`);
61
+ const headCommit = (await git(root, ['rev-parse', 'HEAD']).catch(() => '')).trim() || null;
62
+ const scan = input.runScan ?? runDvalinScanSuite;
63
+ const reasons = [];
64
+ const notes = [];
65
+ // The base tree is a detached worktree, removed whatever happens. Scanning
66
+ // it in place is what lets "this target existed" be observed rather than
67
+ // taken from the claim.
68
+ const scratch = await mkdtemp(path.join(os.tmpdir(), 'dvalin-reverify-'));
69
+ const baseTree = path.join(scratch, 'base');
70
+ let baseResult;
71
+ let baseConfig;
72
+ let basePolicy;
73
+ let scanners;
74
+ try {
75
+ await git(repoRoot, ['worktree', 'add', '--detach', '--quiet', baseTree, baseCommit]);
76
+ const baseRoot = path.join(baseTree, subpath);
77
+ // The rules come from base. A pull request that relaxes its own gate, or
78
+ // deletes its own checks, is reviewed under the rules it is trying to change.
79
+ const loaded = await loadSecurityConfig(baseRoot).catch((error) => {
80
+ throw new UsageError(`The base commit's security policy does not parse: ${error instanceof Error ? error.message : String(error)}`);
81
+ });
82
+ baseConfig = loaded.config;
83
+ basePolicy = loaded.path ? 'base' : 'default';
84
+ const headConfig = await loadSecurityConfig(root).then(value => value.config).catch(() => undefined);
85
+ if (headConfig && canonicalJSON(headConfig) !== canonicalJSON(baseConfig)) {
86
+ notes.push('this change edits dvalin.security.json; it was verified under the base commit\'s policy, not its own');
87
+ }
88
+ // FV-5: at least the engines that produced the targets.
89
+ const targetEngines = claim.before.targets
90
+ .map(target => target.scanner ?? scannerIdForSource(target.source))
91
+ .filter((id) => Boolean(id));
92
+ scanners = [...new Set([...(input.scanners?.length ? input.scanners : baseConfig.scanners), ...targetEngines])];
93
+ baseResult = await scan(baseRoot, { scanners, timeoutMs: input.timeoutMs });
94
+ }
95
+ finally {
96
+ await git(repoRoot, ['worktree', 'remove', '--force', baseTree]).catch(() => undefined);
97
+ await rm(scratch, { recursive: true, force: true }).catch(() => undefined);
98
+ }
99
+ // The change does not get to tell the scanner what to overlook. Its own
100
+ // ignore entries and inline markers are undone before the head is scanned.
101
+ const suppressions = await detectSuppressionChanges(root, baseCommit);
102
+ let headResult;
103
+ if (suppressions.length) {
104
+ const neutral = await neutralizeSuppressions(root, baseCommit, suppressions);
105
+ try {
106
+ headResult = await scan(neutral.root, { scanners, timeoutMs: input.timeoutMs });
107
+ }
108
+ finally {
109
+ await neutral.cleanup();
110
+ }
111
+ notes.push(`this change adds ${suppressions.length} suppression(s); the head was judged with them undone: ${suppressions.slice(0, 5).map(describeSuppressionChange).join('; ')}${suppressions.length > 5 ? '; …' : ''}`);
112
+ }
113
+ else {
114
+ headResult = await scan(root, { scanners, timeoutMs: input.timeoutMs });
115
+ }
116
+ const baseFindings = baseResult.findings.map(snapshotFinding);
117
+ const headFindings = headResult.findings.map(snapshotFinding);
118
+ const baseCompleted = completedEngines(baseResult);
119
+ const headCompleted = completedEngines(headResult);
120
+ // Which claimed targets existed. A target the base scan did not report is
121
+ // not a repair this change can be credited with; whether that is because the
122
+ // claim invented it or because the engine did not run here, the honest
123
+ // answer is the same — it was not confirmed.
124
+ const baseByTarget = new Map();
125
+ for (const finding of baseFindings)
126
+ if (!baseByTarget.has(finding.targetFingerprint))
127
+ baseByTarget.set(finding.targetFingerprint, finding);
128
+ const claimedTargetKeys = [...new Set(claim.before.targets.map(target => target.targetFingerprint))];
129
+ const reproduced = [];
130
+ const unreproduced = [];
131
+ for (const key of claimedTargetKeys) {
132
+ const found = baseByTarget.get(key);
133
+ if (found)
134
+ reproduced.push(found);
135
+ else
136
+ unreproduced.push(claim.before.targets.find(target => target.targetFingerprint === key));
137
+ }
138
+ for (const target of unreproduced) {
139
+ const engine = target.scanner ?? scannerIdForSource(target.source);
140
+ reasons.push(engine && !baseCompleted.has(engine)
141
+ ? `claimed target ${target.ruleId} in ${target.path} could not be confirmed on base: ${engine} did not complete on this runner`
142
+ : `claimed target ${target.ruleId} in ${target.path} does not exist on base ${baseCommit.slice(0, 12)}; the record claims a repair of a finding the base did not have`);
143
+ }
144
+ // FV-22: a target whose engine did not run on head was not looked for, so
145
+ // its absence there is not evidence it was fixed.
146
+ for (const target of reproduced) {
147
+ const engine = target.scanner ?? scannerIdForSource(target.source);
148
+ if (!engine || !headCompleted.has(engine)) {
149
+ reasons.push(`target ${target.ruleId} in ${target.path} is unknown on head: ${engine ?? 'its engine'} did not complete, so its absence is not evidence of a fix`);
150
+ }
151
+ }
152
+ const reproducedKeys = new Set(reproduced.map(target => target.targetFingerprint));
153
+ const threshold = input.threshold
154
+ ?? (basePolicy === 'base' && baseConfig.gate.severity !== 'none' ? baseConfig.gate.severity : 'high');
155
+ if (!input.threshold && threshold !== baseConfig.gate.severity) {
156
+ notes.push(`the base policy sets no blocking gate; regressions were judged at ${threshold}, since a fix verified with nothing able to block it would verify anything`);
157
+ }
158
+ const audit = new AuditSink(`reverify-${randomUUID().slice(0, 8)}`);
159
+ const policy = loadPolicy(root);
160
+ audit.append({
161
+ type: 'run_start',
162
+ task: `security reverify ${claim.recordHash.slice(0, 12)} against ${baseCommit.slice(0, 12)}`,
163
+ mode: 'security-verify',
164
+ provider: 'none',
165
+ model: 'none',
166
+ cwd: root,
167
+ gitHead: headCommit,
168
+ policyHash: policy.hash,
169
+ });
170
+ let checks;
171
+ let reproduction;
172
+ let status = 'done';
173
+ const withheld = withholdEnv(input.withholdFromChecks ?? SCANNER_CREDENTIAL_ENV);
174
+ try {
175
+ checks = input.runChecks
176
+ ? await input.runChecks({ cwd: root, kinds: baseConfig.checks, audit, timeoutMs: input.timeoutMs })
177
+ : (await runProjectVerification({ cwd: root, kinds: baseConfig.checks, timeoutMs: input.timeoutMs, audit })).evidence;
178
+ if (claim.reproduction) {
179
+ // The runner comes from the base policy, or inference; the record only
180
+ // names the tests.
181
+ const runner = await resolveReproRunner(root, { configured: baseConfig.reproduce });
182
+ reproduction = await rerunReproduction({
183
+ root,
184
+ baseCommit,
185
+ claimed: claim.reproduction,
186
+ runner,
187
+ run: async (command) => {
188
+ if (input.runRepro)
189
+ return input.runRepro(root, command);
190
+ const run = await runProjectVerification({ cwd: root, commands: [command], timeoutMs: input.timeoutMs, audit });
191
+ return { exitCode: run.evidence[0]?.exitCode ?? null, tail: run.outputTails[0] ?? '' };
192
+ },
193
+ });
194
+ if (reproduction.command && reproduction.after) {
195
+ checks = [...checks, {
196
+ kind: 'reproduce',
197
+ command: reproduction.command,
198
+ exitCode: reproduction.after.exitCode,
199
+ passed: reproduction.after.exitCode === 0,
200
+ }];
201
+ }
202
+ }
203
+ }
204
+ catch (error) {
205
+ status = 'error';
206
+ throw error;
207
+ }
208
+ finally {
209
+ withheld.restore();
210
+ audit.append({ type: 'run_end', status, iterations: 1, warnings: audit.getWarnings() });
211
+ }
212
+ // What the diff shows of hiding a finding rather than fixing it. The claimed
213
+ // reproduction's tests are exempt only if they are tests: exercising the
214
+ // vulnerable call is what they are for.
215
+ const reproTests = Array.isArray(claim.reproduction?.tests)
216
+ ? claim.reproduction.tests.map(test => test?.path).filter((file) => typeof file === 'string' && isTestPath(file))
217
+ : [];
218
+ const evasionSignals = await detectEvasion(root, baseCommit, reproduced, { exempt: reproTests });
219
+ for (const signal of evasionSignals)
220
+ notes.push(`not a fix: ${describeEvasion(signal)}`);
221
+ const changes = await changedFiles(root, baseCommit);
222
+ const record = buildFixRecord({
223
+ projectId: securityProjectId(root),
224
+ executor: FIX_EXECUTORS.includes(claim.executor) ? claim.executor : 'unknown',
225
+ before: {
226
+ scanId: baseResult.id,
227
+ completedAt: baseResult.completedAt,
228
+ coverage: deriveCoverage(baseResult),
229
+ targets: reproduced,
230
+ },
231
+ after: {
232
+ scanId: headResult.id,
233
+ completedAt: headResult.completedAt,
234
+ coverage: deriveCoverage(headResult),
235
+ remainingTargets: headFindings.filter(finding => reproducedKeys.has(finding.targetFingerprint)),
236
+ },
237
+ regression: {
238
+ gate: { threshold, mode: baseConfig.gate.mode },
239
+ introduced: introducedSince(baseFindings, headFindings),
240
+ },
241
+ evasion: evasionSignals.map(toRecordEvasion),
242
+ ...(changes ? { changes } : {}),
243
+ checks,
244
+ ...(reproduction?.command && reproduction.before && reproduction.tests && reproduction.status !== 'not-attempted'
245
+ ? {
246
+ reproduction: {
247
+ status: reproduction.status === 'confirmed' ? 'reproduced' : 'failed-before-fix',
248
+ command: reproduction.command,
249
+ tests: reproduction.tests,
250
+ before: reproduction.before,
251
+ ...(reproduction.after ? { after: reproduction.after } : {}),
252
+ },
253
+ }
254
+ : {}),
255
+ audit: { runId: audit.runId, headHash: audit.head() },
256
+ policyHash: policy.hash,
257
+ });
258
+ if (!record.verdict.verified) {
259
+ reasons.push(`re-executed verification did not pass (${record.outcome ?? 'not verified'})`);
260
+ }
261
+ if (!claimCheck.ok) {
262
+ reasons.push(...claimCheck.reasons.map(reason => `claimed record: ${reason}`));
263
+ }
264
+ if (reproduction && claim.reproduction?.status === 'reproduced' && reproduction.status !== 'confirmed') {
265
+ reasons.push(`the claimed reproduction was not confirmed here: ${reproduction.detail.join('; ')}`);
266
+ }
267
+ else if (reproduction?.status === 'confirmed') {
268
+ notes.push(`reproduction confirmed here: ${reproduction.command} failed with the fix reverted and passed with it in place`);
269
+ }
270
+ if (claim.verdict.verified !== record.verdict.verified) {
271
+ notes.push(`the claimed record said ${claim.verdict.verified ? 'VERIFIED' : 'NOT VERIFIED'}; re-execution says ${record.verdict.verified ? 'VERIFIED' : 'NOT VERIFIED'}`);
272
+ }
273
+ const claimedCommands = claim.checks.map(check => check.command).sort();
274
+ const observedCommands = checks.map(check => check.command).sort();
275
+ if (canonicalJSON(claimedCommands) !== canonicalJSON(observedCommands)) {
276
+ notes.push(`the claimed record ran [${claimedCommands.join(', ') || 'nothing'}]; the base policy's checks here ran [${observedCommands.join(', ') || 'nothing'}]`);
277
+ }
278
+ if (!claimedTargetKeys.length) {
279
+ notes.push('the claimed record names no targets; this run verifies only that the change introduced nothing and the checks pass');
280
+ }
281
+ return {
282
+ kind: REVERIFICATION_KIND,
283
+ schemaVersion: 1,
284
+ ok: reasons.length === 0,
285
+ reasons,
286
+ notes,
287
+ claimed: {
288
+ recordHash: claim.recordHash,
289
+ rederived: claimCheck.ok,
290
+ reasons: claimCheck.reasons,
291
+ verified: claim.verdict.verified,
292
+ signatures: claimCheck.signatures ?? [],
293
+ },
294
+ base: { ref: input.base, commit: baseCommit, scanId: baseResult.id, coverage: deriveCoverage(baseResult), policy: basePolicy },
295
+ head: { commit: headCommit, scanId: headResult.id, coverage: deriveCoverage(headResult) },
296
+ suppressions,
297
+ ...(reproduction ? { reproduction } : {}),
298
+ targets: { claimed: claimedTargetKeys.length, reproduced: reproduced.length, unreproduced },
299
+ record,
300
+ };
301
+ }
302
+ /**
303
+ * Head findings the base did not have.
304
+ *
305
+ * Exact fingerprints include the line number, so comparing them across two
306
+ * commits reports every pre-existing finding below an inserted line as new.
307
+ * Grouping by target (engine, rule, file) and counting fixes that: a group is
308
+ * only charged with what it grew by, and the charged instances are the ones
309
+ * whose exact fingerprint base did not have. A finding that merely moved is
310
+ * not introduced; a second instance of the same rule in the same file is.
311
+ */
312
+ export function introducedSince(base, head) {
313
+ const baseFingerprints = new Set(base.map(finding => finding.fingerprint));
314
+ const baseCounts = new Map();
315
+ for (const finding of base)
316
+ baseCounts.set(finding.targetFingerprint, (baseCounts.get(finding.targetFingerprint) ?? 0) + 1);
317
+ const groups = new Map();
318
+ for (const finding of head)
319
+ groups.set(finding.targetFingerprint, [...(groups.get(finding.targetFingerprint) ?? []), finding]);
320
+ const introduced = [];
321
+ for (const [key, group] of groups) {
322
+ const excess = group.length - (baseCounts.get(key) ?? 0);
323
+ if (excess <= 0)
324
+ continue;
325
+ const unseen = group.filter(finding => !baseFingerprints.has(finding.fingerprint));
326
+ // If fewer instances are unseen than the group grew by, the rest are exact
327
+ // duplicates of base instances; charge them too rather than under-report.
328
+ const seen = group.filter(finding => baseFingerprints.has(finding.fingerprint));
329
+ introduced.push(...[...unseen, ...seen].slice(0, excess));
330
+ }
331
+ return introduced;
332
+ }
333
+ function withholdEnv(names) {
334
+ const saved = new Map();
335
+ for (const name of names) {
336
+ const value = process.env[name];
337
+ if (value !== undefined)
338
+ saved.set(name, value);
339
+ delete process.env[name];
340
+ }
341
+ return { restore: () => { for (const [name, value] of saved)
342
+ process.env[name] = value; } };
343
+ }
344
+ function completedEngines(result) {
345
+ return new Set(result.scanners.filter(run => run.status === 'completed').map(run => run.id));
346
+ }
347
+ async function changedFiles(root, baseCommit) {
348
+ try {
349
+ const files = (await git(root, ['diff', '--name-only', '--no-color', baseCommit, '--', '.'])).split('\n').map(line => line.trim()).filter(Boolean);
350
+ const diff = await git(root, ['diff', '--no-color', '--no-ext-diff', baseCommit, '--', '.']);
351
+ return { files, diffHash: sha256(diff) };
352
+ }
353
+ catch {
354
+ return undefined;
355
+ }
356
+ }
357
+ async function git(cwd, args) {
358
+ const { stdout } = await execFileAsync('git', args, { cwd, maxBuffer: 64 * 1024 * 1024 });
359
+ return stdout;
360
+ }
361
+ //# sourceMappingURL=reverify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reverify.js","sourceRoot":"","sources":["../../src/security/reverify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B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5C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;IAC1F,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Suppressions a change adds are not honored when judging that change.
3
+ *
4
+ * The cheapest way to make a scanner stop reporting a finding is to tell it to
5
+ * stop: an entry in `.snyk`, a `// deepcode ignore` above the line, a
6
+ * `nosemgrep` at the end of it. A fix loop that runs "until the scanner is
7
+ * clean" rewards exactly that, and an agent under that pressure will find it.
8
+ * A suppression is a decision a person makes about risk; it is never a repair.
9
+ *
10
+ * So when a change is judged, the head is scanned as though the suppressions
11
+ * the change itself introduced did not exist: ignore files are restored to the
12
+ * base commit's version, and inline markers on lines the change added are
13
+ * blanked in place (same length, so every line and column stays put). A target
14
+ * the change merely silenced is still found, and fails as `target-remains`; a
15
+ * finding the change introduced and then silenced is still found, and fails as
16
+ * `regressed`. Suppressions that already existed on base are base policy and
17
+ * stay in force.
18
+ */
19
+ /** Files whose content tells a scanner what not to report. Matched by basename anywhere in the tree. */
20
+ export declare const SUPPRESSION_FILES: readonly ['.snyk', '.semgrepignore', '.trivyignore', '.trivyignore.yaml', 'trivy.yaml', 'osv-scanner.toml', '.gitleaksignore', '.dvalincodeignore', 'dvalin.security.json'];
21
+ /** Inline markers that silence a finding on or near their line, and the engine that reads them. */
22
+ export declare const INLINE_SUPPRESSION_MARKERS: ReadonlyArray<{
23
+ engine: string;
24
+ pattern: RegExp;
25
+ }>;
26
+ export type SuppressionChange = {
27
+ kind: 'ignore-file';
28
+ path: string;
29
+ change: 'added' | 'modified' | 'deleted';
30
+ } | {
31
+ kind: 'inline';
32
+ path: string;
33
+ line: number;
34
+ engine: string;
35
+ marker: string;
36
+ };
37
+ export type NeutralizedTree = {
38
+ /** A copy of the workspace with the change's own suppressions removed. */
39
+ root: string;
40
+ cleanup: () => Promise<void>;
41
+ };
42
+ /**
43
+ * Suppressions this workspace adds relative to `baseCommit`, including
44
+ * uncommitted and untracked work. Paths are relative to `root`.
45
+ */
46
+ export declare function detectSuppressionChanges(root: string, baseCommit: string): Promise<SuppressionChange[]>;
47
+ /**
48
+ * Copy the workspace with the given suppression changes undone.
49
+ *
50
+ * Copies tracked and untracked-but-not-ignored files, so what is scanned is
51
+ * what a commit of this working tree would contain. Only call this when
52
+ * `changes` is non-empty; otherwise scan the workspace itself.
53
+ */
54
+ export declare function neutralizeSuppressions(root: string, baseCommit: string, changes: SuppressionChange[]): Promise<NeutralizedTree>;
55
+ /** Replace every suppression marker on a line with spaces of the same length. */
56
+ export declare function blankMarkers(line: string): string;
57
+ export declare function isSuppressionFile(file: string): boolean;
58
+ export declare function describeSuppressionChange(change: SuppressionChange): string;