@vaultcompass/conductor 0.8.1 → 0.10.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/README.md +261 -46
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +20 -5
- package/dist/envelope.d.ts +8 -0
- package/dist/exit-codes.d.ts +52 -2
- package/dist/exit-codes.js +64 -14
- package/dist/gate-runner.d.ts +124 -11
- package/dist/gate-runner.js +491 -60
- package/dist/git.d.ts +15 -0
- package/dist/git.js +20 -0
- package/dist/init-hook-detect.d.ts +1 -0
- package/dist/init-hook-detect.js +45 -0
- package/dist/init-policy.js +51 -2
- package/dist/init.d.ts +8 -0
- package/dist/init.js +166 -20
- package/dist/intent-prepare.d.ts +18 -1
- package/dist/intent-prepare.js +23 -2
- package/dist/normalize.d.ts +43 -2
- package/dist/normalize.js +168 -10
- package/dist/osv-baseline.d.ts +84 -0
- package/dist/osv-baseline.js +325 -0
- package/dist/osv-coverage.d.ts +80 -0
- package/dist/osv-coverage.js +223 -0
- package/dist/output-sarif.js +61 -2
- package/dist/output-text.d.ts +31 -3
- package/dist/output-text.js +354 -26
- package/dist/policy.d.ts +18 -0
- package/dist/policy.js +45 -6
- package/dist/products.d.ts +40 -11
- package/dist/products.js +87 -9
- package/dist/requirements-pin.d.ts +47 -0
- package/dist/requirements-pin.js +256 -0
- package/dist/run.d.ts +17 -0
- package/dist/run.js +29 -4
- package/dist/trust-base.d.ts +19 -0
- package/dist/trust-base.js +30 -1
- package/dist/unread-manifests.d.ts +14 -0
- package/dist/unread-manifests.js +69 -0
- package/package.json +1 -1
- package/schema/guardrails.schema.json +10 -0
package/dist/output-sarif.js
CHANGED
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
// product, which puts an end column in its own SARIF; see the note in
|
|
118
118
|
// normalize.ts, which is where the omission would stop mattering if the
|
|
119
119
|
// field were ever carried.
|
|
120
|
+
import { gateExitBlocks } from './exit-codes.js';
|
|
120
121
|
import { NATIVE_CONTRACT_PATH, isLegacyContractPath } from './intent-prepare.js';
|
|
121
122
|
import { INTENT_WARNING } from './normalize.js';
|
|
122
123
|
import { POLICY_FILE_NAME } from './policy.js';
|
|
@@ -320,6 +321,18 @@ function toResult(finding, fallbackUri) {
|
|
|
320
321
|
if (finding.fingerprint !== null) {
|
|
321
322
|
entry.partialFingerprints = { [fingerprintKey(finding.fingerprint.scope)]: finding.fingerprint.value };
|
|
322
323
|
}
|
|
324
|
+
// SARIF's own baselineState, only where the umbrella has a baseline to
|
|
325
|
+
// support it: an osv result from a compared pull-request run, `new` for
|
|
326
|
+
// introduced (including every finding in a lockfile the comparison was
|
|
327
|
+
// unavailable for) and `unchanged` for present-on-base. A run with no
|
|
328
|
+
// comparison sets no label, and so no state.
|
|
329
|
+
const baseline = finding.details.baseline;
|
|
330
|
+
if (baseline === 'introduced') {
|
|
331
|
+
entry.baselineState = 'new';
|
|
332
|
+
}
|
|
333
|
+
else if (baseline === 'present-on-base') {
|
|
334
|
+
entry.baselineState = 'unchanged';
|
|
335
|
+
}
|
|
323
336
|
// Unconditional. The old code omitted the key when there was nothing
|
|
324
337
|
// honest to say, and one such result makes GitHub reject the whole log.
|
|
325
338
|
entry.locations = withFallbackLocation(locationsFor(finding), fallbackUri);
|
|
@@ -771,6 +784,23 @@ function nodeModulesSkippedNotifications(result) {
|
|
|
771
784
|
},
|
|
772
785
|
];
|
|
773
786
|
}
|
|
787
|
+
/**
|
|
788
|
+
* A passthrough option that is a gate's own setting under a name conductor
|
|
789
|
+
* also uses (gitleaks' `options.timeout`), as notifications. A NOTE: nothing
|
|
790
|
+
* went wrong, and the gate's own outcome, whatever it was, is reported on its
|
|
791
|
+
* own. It says which deadline is whose.
|
|
792
|
+
*/
|
|
793
|
+
function gateOwnOptionNotifications(result) {
|
|
794
|
+
return result.gates.flatMap((gate) => gate.gateOwnOption === undefined
|
|
795
|
+
? []
|
|
796
|
+
: [
|
|
797
|
+
{
|
|
798
|
+
id: 'conductor/option-is-gate-own',
|
|
799
|
+
message: gate.gateOwnOption,
|
|
800
|
+
details: { role: gate.role, product: gate.product, option: 'timeout' },
|
|
801
|
+
},
|
|
802
|
+
]);
|
|
803
|
+
}
|
|
774
804
|
/**
|
|
775
805
|
* The gates the policy file told not to decide anything, as notifications.
|
|
776
806
|
*
|
|
@@ -810,9 +840,17 @@ function unenforcedNotifications(result) {
|
|
|
810
840
|
// this number answers is "what did the gate say", and the umbrella's
|
|
811
841
|
// own findings are never the gate's answer.
|
|
812
842
|
const blocking = gate.findings.filter((finding) => finding.blocking && finding.product !== UMBRELLA_DRIVER_NAME).length;
|
|
843
|
+
// Through gateExitBlocks, like every other reader of a non-zero child
|
|
844
|
+
// exit: under present-on-base: report an osv exit of 1 can be one that
|
|
845
|
+
// does not block, and saying only "exited 1" there would read as a
|
|
846
|
+
// block the exit code never had.
|
|
847
|
+
const exitBlocks = gateExitBlocks(gate);
|
|
813
848
|
const what = gate.couldNotRun !== null
|
|
814
849
|
? `It could not run (${gate.couldNotRun.reason}), and nothing was checked by it.`
|
|
815
|
-
: `It reported ${blocking} blocking finding(s) and exited ${gate.exitCode ?? -1}
|
|
850
|
+
: `It reported ${blocking} blocking finding(s) and exited ${gate.exitCode ?? -1}` +
|
|
851
|
+
(exitBlocks || gate.baseComparison === undefined
|
|
852
|
+
? '.'
|
|
853
|
+
: ', which does not block here: every finding was already on the base branch, under present-on-base: report.');
|
|
816
854
|
return {
|
|
817
855
|
id: 'conductor/gate-not-enforced',
|
|
818
856
|
message: `The ${gate.role} gate (${gate.product}) has enforce: false, so its verdict did not ` +
|
|
@@ -823,10 +861,30 @@ function unenforcedNotifications(result) {
|
|
|
823
861
|
enforced: false,
|
|
824
862
|
couldNotRun: gate.couldNotRun === null ? null : gate.couldNotRun.reason,
|
|
825
863
|
blockingFindings: blocking,
|
|
864
|
+
exitBlocks,
|
|
826
865
|
},
|
|
827
866
|
};
|
|
828
867
|
});
|
|
829
868
|
}
|
|
869
|
+
/**
|
|
870
|
+
* A gate's run facts for its SARIF run, plus the base comparison when one
|
|
871
|
+
* ran (the vulnerabilities gate on a compared pull-request run): the ref, the
|
|
872
|
+
* two counts and the base policy's present-on-base value. not-scanned is in
|
|
873
|
+
* the gate's own run details already.
|
|
874
|
+
*/
|
|
875
|
+
function runDetails(gate) {
|
|
876
|
+
const comparison = gate.baseComparison;
|
|
877
|
+
if (comparison === undefined) {
|
|
878
|
+
return gate.run.details;
|
|
879
|
+
}
|
|
880
|
+
return {
|
|
881
|
+
...gate.run.details,
|
|
882
|
+
'baseline-ref': comparison.ref,
|
|
883
|
+
introduced: comparison.introduced,
|
|
884
|
+
'present-on-base': comparison.presentOnBase,
|
|
885
|
+
'present-on-base-policy': comparison.policy,
|
|
886
|
+
};
|
|
887
|
+
}
|
|
830
888
|
/**
|
|
831
889
|
* Renders a whole run as one SARIF log.
|
|
832
890
|
*
|
|
@@ -864,7 +922,7 @@ export function renderSarif(result, umbrellaVersion) {
|
|
|
864
922
|
// same bag the text report renders as scalars. Carried verbatim and
|
|
865
923
|
// only when there is something in it, so a gate that reports none of
|
|
866
924
|
// this keeps the properties shape it had before.
|
|
867
|
-
...(Object.keys(gate
|
|
925
|
+
...(Object.keys(runDetails(gate)).length === 0 ? {} : { details: runDetails(gate) }),
|
|
868
926
|
}));
|
|
869
927
|
}
|
|
870
928
|
// Still RESULTS, deliberately, and the asymmetry with the three above is
|
|
@@ -893,6 +951,7 @@ export function renderSarif(result, umbrellaVersion) {
|
|
|
893
951
|
...trustBaseWithheldNotifications(result),
|
|
894
952
|
...nodeModulesSkippedNotifications(result),
|
|
895
953
|
...intentWarningNotifications(result),
|
|
954
|
+
...gateOwnOptionNotifications(result),
|
|
896
955
|
];
|
|
897
956
|
// Notifications earn the run on their own. Before this, the umbrella run
|
|
898
957
|
// existed only when it had findings and a deferred gate was one; without
|
package/dist/output-text.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { RunResult } from './run.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many entries a section prints before it rolls the rest up into one
|
|
4
|
+
* line, unless --verbose. A full-history gitleaks scan or an osv-scanner run
|
|
5
|
+
* over an old lockfile printed six hundred lines on one repository, which
|
|
6
|
+
* buries the verdict and every other gate. Findings past the cap are still
|
|
7
|
+
* findings: they are counted in every number on the report, they are in the
|
|
8
|
+
* SARIF log, --verbose prints them, and the exit code never reads this.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FINDINGS_SHOWN_PER_GATE = 20;
|
|
2
11
|
/**
|
|
3
12
|
* The one sentence the whole of pull-request mode has to fit into.
|
|
4
13
|
*
|
|
@@ -61,7 +70,9 @@ export declare function jobLogSummary(result: RunResult): string;
|
|
|
61
70
|
* Describes, decides nothing: every word is read off the outcomes the exit
|
|
62
71
|
* code was already composed from. Same plain ASCII as the rest of this file.
|
|
63
72
|
*/
|
|
64
|
-
export declare function gateLogLines(result: RunResult
|
|
73
|
+
export declare function gateLogLines(result: RunResult, options?: {
|
|
74
|
+
terminal?: boolean;
|
|
75
|
+
}): string[];
|
|
65
76
|
/**
|
|
66
77
|
* One warning per gate that was found on PATH at a version other than the one
|
|
67
78
|
* this run expected (the Action's pin).
|
|
@@ -79,8 +90,11 @@ export declare function versionSkewWarnings(result: RunResult): string[];
|
|
|
79
90
|
* the state without parsing the verdict sentence.
|
|
80
91
|
*
|
|
81
92
|
* pass exit 0 and nothing was hidden by it
|
|
82
|
-
* nothing-checked exit 0, but no gate ran at
|
|
83
|
-
* or every one deferred,
|
|
93
|
+
* nothing-checked exit 0, but nothing was checked: no gate ran at
|
|
94
|
+
* all (none enabled, or every one deferred,
|
|
95
|
+
* tree-unchanged or skipped), or every gate that
|
|
96
|
+
* ran checked nothing (nothing to scan, or no
|
|
97
|
+
* contract; audit finding F4)
|
|
84
98
|
* advisory-blocked (N) exit 1 that --advisory turned into exit 0
|
|
85
99
|
* unenforced-findings (N) exit 0, but enforce: false gates blocked or
|
|
86
100
|
* could not run
|
|
@@ -160,5 +174,19 @@ export interface TextOptions {
|
|
|
160
174
|
* that did not block, never about a gate that did not run.
|
|
161
175
|
*/
|
|
162
176
|
advisory?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The report is going straight to a terminal (cli.ts: stdout is a TTY and
|
|
179
|
+
* no --output). Only one thing reads it: a refused trust base prints its
|
|
180
|
+
* refusal once at the top and one line per gate, rather than the refusal
|
|
181
|
+
* again in every gate's section and again in every gate's finding. A file,
|
|
182
|
+
* a pipe and a pull request comment never set it and are unchanged.
|
|
183
|
+
*/
|
|
184
|
+
terminal?: boolean;
|
|
163
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* dep-guard's own diagnostic code for an online budget that ran out before
|
|
188
|
+
* every lookup was made (dep-guard core, online/deadline.ts,
|
|
189
|
+
* ONLINE_DEADLINE_CODE). Read, never minted: the umbrella only repeats it.
|
|
190
|
+
*/
|
|
191
|
+
export declare const DEP_GUARD_DEADLINE_CODE = "online-deadline-exceeded";
|
|
164
192
|
export declare function renderText(result: RunResult, options?: TextOptions): string;
|