@hoshinotatsuya/committed-secrets 0.6.3 → 0.7.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 +12 -0
- package/README.md +3 -3
- package/README.ru.md +2 -2
- package/bin/committed-secrets.cjs +3 -3
- package/dist/scanner/auth-header-value.constant.d.ts +4 -4
- package/dist/scanner/auth-header-value.constant.js +4 -4
- package/dist/scanner/base64-credentials.d.ts +16 -16
- package/dist/scanner/base64-credentials.d.ts.map +1 -1
- package/dist/scanner/base64-credentials.js +20 -20
- package/dist/scanner/base64-credentials.js.map +1 -1
- package/dist/scanner/baseline.d.ts +7 -7
- package/dist/scanner/baseline.d.ts.map +1 -1
- package/dist/scanner/baseline.js +9 -9
- package/dist/scanner/baseline.js.map +1 -1
- package/dist/scanner/cli.js +1 -1
- package/dist/scanner/cli.js.map +1 -1
- package/dist/scanner/code-fallbacks.d.ts +13 -13
- package/dist/scanner/code-fallbacks.d.ts.map +1 -1
- package/dist/scanner/code-fallbacks.js +16 -16
- package/dist/scanner/code-fallbacks.js.map +1 -1
- package/dist/scanner/code-points.d.ts +1 -1
- package/dist/scanner/code-points.js +1 -1
- package/dist/scanner/command-rules.d.ts +21 -21
- package/dist/scanner/command-rules.d.ts.map +1 -1
- package/dist/scanner/command-rules.js +24 -24
- package/dist/scanner/command-rules.js.map +1 -1
- package/dist/scanner/config-source.d.ts +7 -7
- package/dist/scanner/config-source.d.ts.map +1 -1
- package/dist/scanner/config-source.js +9 -9
- package/dist/scanner/config-source.js.map +1 -1
- package/dist/scanner/credential-value.d.ts +3 -3
- package/dist/scanner/credential-value.js +3 -3
- package/dist/scanner/data-file-name.constant.d.ts +6 -6
- package/dist/scanner/data-file-name.constant.js +6 -6
- package/dist/scanner/documented-example-secrets.constant.d.ts +3 -3
- package/dist/scanner/documented-example-secrets.constant.js +3 -3
- package/dist/scanner/exit-code.constant.d.ts +1 -1
- package/dist/scanner/exit-code.constant.d.ts.map +1 -1
- package/dist/scanner/exit-code.constant.js +1 -1
- package/dist/scanner/exit-code.constant.js.map +1 -1
- package/dist/scanner/expression-extent.d.ts +5 -5
- package/dist/scanner/expression-extent.js +5 -5
- package/dist/scanner/file-kind.type.d.ts +5 -5
- package/dist/scanner/file-kind.type.d.ts.map +1 -1
- package/dist/scanner/file-kinds.d.ts +2 -2
- package/dist/scanner/file-kinds.d.ts.map +1 -1
- package/dist/scanner/file-kinds.js +3 -3
- package/dist/scanner/file-kinds.js.map +1 -1
- package/dist/scanner/finding.type.d.ts +7 -7
- package/dist/scanner/finding.type.d.ts.map +1 -1
- package/dist/scanner/fingerprint.d.ts +5 -5
- package/dist/scanner/fingerprint.js +5 -5
- package/dist/scanner/fixture-entry.type.d.ts +1 -1
- package/dist/scanner/fixture-entry.type.d.ts.map +1 -1
- package/dist/scanner/fixture-list.d.ts +8 -8
- package/dist/scanner/fixture-list.d.ts.map +1 -1
- package/dist/scanner/fixture-list.js +17 -17
- package/dist/scanner/fixture-list.js.map +1 -1
- package/dist/scanner/flag-rule.type.d.ts +9 -9
- package/dist/scanner/flag-rule.type.d.ts.map +1 -1
- package/dist/scanner/gate-broken.error.d.ts +1 -1
- package/dist/scanner/gate-broken.error.d.ts.map +1 -1
- package/dist/scanner/gate-broken.error.js +1 -1
- package/dist/scanner/gate-broken.error.js.map +1 -1
- package/dist/scanner/gate-config.type.d.ts +3 -3
- package/dist/scanner/gate-config.type.d.ts.map +1 -1
- package/dist/scanner/gate-files.d.ts +3 -3
- package/dist/scanner/gate-files.js +9 -9
- package/dist/scanner/gate-files.js.map +1 -1
- package/dist/scanner/gate-options.type.d.ts +5 -5
- package/dist/scanner/gate-options.type.d.ts.map +1 -1
- package/dist/scanner/gate-report.type.d.ts +2 -2
- package/dist/scanner/gate-report.type.d.ts.map +1 -1
- package/dist/scanner/git.d.ts +13 -13
- package/dist/scanner/git.d.ts.map +1 -1
- package/dist/scanner/git.js +24 -24
- package/dist/scanner/git.js.map +1 -1
- package/dist/scanner/index-entry.type.d.ts +1 -1
- package/dist/scanner/index-entry.type.d.ts.map +1 -1
- package/dist/scanner/known-token-shapes.constant.d.ts +8 -8
- package/dist/scanner/known-token-shapes.constant.d.ts.map +1 -1
- package/dist/scanner/known-token-shapes.constant.js +11 -11
- package/dist/scanner/known-token-shapes.constant.js.map +1 -1
- package/dist/scanner/line-forms.d.ts +8 -8
- package/dist/scanner/line-forms.d.ts.map +1 -1
- package/dist/scanner/line-forms.js +8 -8
- package/dist/scanner/line-forms.js.map +1 -1
- package/dist/scanner/line-sink.d.ts +5 -5
- package/dist/scanner/line-sink.d.ts.map +1 -1
- package/dist/scanner/line-sink.js +6 -6
- package/dist/scanner/line-sink.js.map +1 -1
- package/dist/scanner/load-config.d.ts +3 -3
- package/dist/scanner/load-config.js +13 -13
- package/dist/scanner/load-config.js.map +1 -1
- package/dist/scanner/markdown-code-languages.constant.d.ts +4 -4
- package/dist/scanner/markdown-code-languages.constant.js +4 -4
- package/dist/scanner/parse-gate-options.d.ts +3 -3
- package/dist/scanner/parse-gate-options.js +10 -10
- package/dist/scanner/parse-gate-options.js.map +1 -1
- package/dist/scanner/path-suffix.d.ts +1 -1
- package/dist/scanner/path-suffix.d.ts.map +1 -1
- package/dist/scanner/path-suffix.js +1 -1
- package/dist/scanner/path-suffix.js.map +1 -1
- package/dist/scanner/read-json.d.ts +1 -1
- package/dist/scanner/read-json.d.ts.map +1 -1
- package/dist/scanner/read-json.js +3 -3
- package/dist/scanner/read-json.js.map +1 -1
- package/dist/scanner/report-formats.d.ts +6 -6
- package/dist/scanner/report-formats.d.ts.map +1 -1
- package/dist/scanner/report-formats.js +7 -7
- package/dist/scanner/report-formats.js.map +1 -1
- package/dist/scanner/reported-finding.type.d.ts +2 -2
- package/dist/scanner/reported-finding.type.d.ts.map +1 -1
- package/dist/scanner/repository-files.d.ts +1 -1
- package/dist/scanner/repository-files.d.ts.map +1 -1
- package/dist/scanner/repository-source.d.ts +16 -16
- package/dist/scanner/repository-source.d.ts.map +1 -1
- package/dist/scanner/repository-source.js +23 -23
- package/dist/scanner/repository-source.js.map +1 -1
- package/dist/scanner/rule-catalog.constant.d.ts +1 -1
- package/dist/scanner/rule-catalog.constant.d.ts.map +1 -1
- package/dist/scanner/rule-catalog.constant.js +8 -8
- package/dist/scanner/rule-catalog.constant.js.map +1 -1
- package/dist/scanner/run-gate.d.ts +6 -6
- package/dist/scanner/run-gate.d.ts.map +1 -1
- package/dist/scanner/run-gate.js +29 -29
- package/dist/scanner/run-gate.js.map +1 -1
- package/dist/scanner/scan-text.d.ts +1 -1
- package/dist/scanner/scan-text.d.ts.map +1 -1
- package/dist/scanner/scan-text.js +1 -1
- package/dist/scanner/scan-text.js.map +1 -1
- package/dist/scanner/secret-key.d.ts +7 -7
- package/dist/scanner/secret-key.d.ts.map +1 -1
- package/dist/scanner/secret-key.js +7 -7
- package/dist/scanner/secret-key.js.map +1 -1
- package/dist/scanner/secret-rules.d.ts +12 -12
- package/dist/scanner/secret-rules.d.ts.map +1 -1
- package/dist/scanner/secret-rules.js +24 -24
- package/dist/scanner/secret-rules.js.map +1 -1
- package/dist/scanner/secret-value.d.ts +6 -6
- package/dist/scanner/secret-value.js +15 -15
- package/dist/scanner/secret-value.js.map +1 -1
- package/dist/scanner/shell-token.type.d.ts +1 -1
- package/dist/scanner/shell-token.type.d.ts.map +1 -1
- package/dist/scanner/shell-words.d.ts +13 -13
- package/dist/scanner/shell-words.d.ts.map +1 -1
- package/dist/scanner/shell-words.js +13 -13
- package/dist/scanner/shell-words.js.map +1 -1
- package/dist/scanner/text-of.d.ts +3 -3
- package/dist/scanner/text-of.js +5 -5
- package/dist/scanner/text-of.js.map +1 -1
- package/dist/scanner/text-scanner.d.ts +49 -49
- package/dist/scanner/text-scanner.d.ts.map +1 -1
- package/dist/scanner/text-scanner.js +80 -80
- package/dist/scanner/text-scanner.js.map +1 -1
- package/dist/scanner/value-text.d.ts +6 -6
- package/dist/scanner/value-text.js +7 -7
- package/dist/scanner/value-text.js.map +1 -1
- package/dist/scanner/volume-mode.constant.d.ts +1 -1
- package/dist/scanner/volume-mode.constant.d.ts.map +1 -1
- package/dist/scanner/volume-mode.constant.js +1 -1
- package/dist/scanner/volume-mode.constant.js.map +1 -1
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-kinds.js","sourceRoot":"","sources":["../../src/scanner/file-kinds.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,iDAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"file-kinds.js","sourceRoot":"","sources":["../../src/scanner/file-kinds.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,iDAAiD;AAEjD,8BAA8B;AAC9B,MAAa,SAAS;IACpB,sGAAsG;IAC/F,MAAM,CAAU,YAAY,GAAwB,IAAI,GAAG,CAAC;QACjE,SAAS;QACT,eAAe;QACf,aAAa;QACb,UAAU;QACV,QAAQ;QACR,SAAS;QACT,WAAW;QACX,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,SAAS;QACT,kBAAkB;QAClB,SAAS;QACT,QAAQ;KACT,CAAC,CAAC;IAEI,MAAM,CAAC,EAAE,CAAC,IAAY;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,wBAAU,EAAC,IAAI,CAAC,CAAC;QAChC,MAAM,MAAM,GACV,8BAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACvD,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YAChC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACvB,kFAAkF;YAClF,wHAAwH,CAAC,IAAI,CAC3H,IAAI,CACL;YACD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC5B,MAAM,KAAK,MAAM;YACjB,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO;YACL,MAAM;YACN,QAAQ,EAAE,MAAM,KAAK,KAAK;YAC1B,IAAI,EAAE,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACpE,UAAU,EAAE,MAAM,KAAK,OAAO;YAC9B,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,QAAQ;YAC7C,MAAM,EAAE,IAAI,KAAK,SAAS;SAC3B,CAAC;IACJ,CAAC;;AA5CH,8BA6CC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A finding in a file text, without the value in the report. */
|
|
2
2
|
export interface Finding {
|
|
3
|
-
/**
|
|
3
|
+
/** The key of the fixture list and the baseline: the key name, a command flag, `PEM`, `token <kind>`. */
|
|
4
4
|
readonly key: string;
|
|
5
|
-
/**
|
|
5
|
+
/** The rule (`RULE_CATALOG`): the identifier for SARIF and GitLab. */
|
|
6
6
|
readonly rule: string;
|
|
7
7
|
readonly line: number;
|
|
8
|
-
/**
|
|
8
|
+
/** A description without the value: `POSTGRES_PASSWORD: a literal of length 13`. */
|
|
9
9
|
readonly description: string;
|
|
10
|
-
/**
|
|
10
|
+
/** The report line: ` path:line description`. */
|
|
11
11
|
readonly report: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The value, ONLY for the fingerprint. A function, not a field: `JSON.stringify`
|
|
14
|
+
* of a finding will not output it, and the report formats are built from an explicit list of fields.
|
|
15
15
|
*/
|
|
16
16
|
readonly secret: () => string;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finding.type.d.ts","sourceRoot":"","sources":["../../src/scanner/finding.type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"finding.type.d.ts","sourceRoot":"","sources":["../../src/scanner/finding.type.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,yGAAyG;IACzG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC;CAC/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* A finding fingerprint for the baseline and the reports: from the file, the key and the VALUE,
|
|
3
|
+
* but not from the line number (lines shift with any edit above). A slow
|
|
4
|
+
* hash (scrypt), not SHA-256: the fingerprint sits in CI reports, and brute-forcing a weak
|
|
5
|
+
* password by a fast hash would take seconds. The salt is the path and the key: identical
|
|
6
|
+
* values in different places give different fingerprints.
|
|
7
7
|
*/
|
|
8
8
|
export declare function fingerprintOf(file: string, key: string, secret: string): string;
|
|
9
9
|
//# sourceMappingURL=fingerprint.d.ts.map
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fingerprintOf = fingerprintOf;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* A finding fingerprint for the baseline and the reports: from the file, the key and the VALUE,
|
|
7
|
+
* but not from the line number (lines shift with any edit above). A slow
|
|
8
|
+
* hash (scrypt), not SHA-256: the fingerprint sits in CI reports, and brute-forcing a weak
|
|
9
|
+
* password by a fast hash would take seconds. The salt is the path and the key: identical
|
|
10
|
+
* values in different places give different fingerprints.
|
|
11
11
|
*/
|
|
12
12
|
function fingerprintOf(file, key, secret) {
|
|
13
13
|
return (0, node_crypto_1.scryptSync)(secret, `committed-secrets/1\0${file}\0${key}`, 16, { N: 1024, r: 8, p: 1 }).toString('hex');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A fixture list entry: the file, the keys and how many findings of EACH key it exempts. */
|
|
2
2
|
export interface FixtureEntry {
|
|
3
3
|
readonly file: string;
|
|
4
4
|
readonly keys: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture-entry.type.d.ts","sourceRoot":"","sources":["../../src/scanner/fixture-entry.type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"fixture-entry.type.d.ts","sourceRoot":"","sources":["../../src/scanner/fixture-entry.type.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ConfigSource } from './config-source';
|
|
2
2
|
import type { FixtureEntry } from './fixture-entry.type';
|
|
3
3
|
import type { GateConfig } from './gate-config.type';
|
|
4
|
-
/**
|
|
4
|
+
/** A fixture list entry reason shorter than this is not a reason. */
|
|
5
5
|
export declare const MIN_REASON_LENGTH = 40;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* A delivery file and service code: a secret in them is a production secret, the fixture list
|
|
8
|
+
* does not exempt them. Service code is under `serviceCodeRoot`, except specs and
|
|
9
|
+
* test harnesses (`testCodePatterns`, by default `spec\.ts$` and `/testing/`).
|
|
10
10
|
*/
|
|
11
11
|
export declare function isDeliveryFile(path: string, config: GateConfig): boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* List entries and violations of the list itself. An entry exempts `count`
|
|
14
|
+
* findings of each of its keys (one by default): since 0.5.0 an entry is about
|
|
15
|
+
* SPECIFIC findings, and a second secret under the same key in the same file is
|
|
16
|
+
* a finding again, not "already allowed".
|
|
17
17
|
*/
|
|
18
18
|
export declare function loadFixtures(source: ConfigSource, config: GateConfig): {
|
|
19
19
|
entries: FixtureEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture-list.d.ts","sourceRoot":"","sources":["../../src/scanner/fixture-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,
|
|
1
|
+
{"version":3,"file":"fixture-list.d.ts","sourceRoot":"","sources":["../../src/scanner/fixture-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAUxE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,UAAU,GACjB;IAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA4CjD"}
|
|
@@ -5,15 +5,15 @@ exports.isDeliveryFile = isDeliveryFile;
|
|
|
5
5
|
exports.loadFixtures = loadFixtures;
|
|
6
6
|
const gate_broken_error_1 = require("./gate-broken.error");
|
|
7
7
|
const read_json_1 = require("./read-json");
|
|
8
|
-
/**
|
|
8
|
+
/** A fixture list entry reason shorter than this is not a reason. */
|
|
9
9
|
exports.MIN_REASON_LENGTH = 40;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* A delivery file and service code: a secret in them is a production secret, the fixture list
|
|
12
|
+
* does not exempt them. Service code is under `serviceCodeRoot`, except specs and
|
|
13
|
+
* test harnesses (`testCodePatterns`, by default `spec\.ts$` and `/testing/`).
|
|
14
14
|
*/
|
|
15
15
|
function isDeliveryFile(path, config) {
|
|
16
|
-
// `re.match
|
|
16
|
+
// Python `re.match`: a match from the start of the string, not anywhere.
|
|
17
17
|
const delivery = new RegExp(config.deliveryPattern, 'y');
|
|
18
18
|
if (delivery.test(path)) {
|
|
19
19
|
return true;
|
|
@@ -22,46 +22,46 @@ function isDeliveryFile(path, config) {
|
|
|
22
22
|
!config.testCodePatterns.some((pattern) => new RegExp(pattern, 'u').test(path)));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* List entries and violations of the list itself. An entry exempts `count`
|
|
26
|
+
* findings of each of its keys (one by default): since 0.5.0 an entry is about
|
|
27
|
+
* SPECIFIC findings, and a second secret under the same key in the same file is
|
|
28
|
+
* a finding again, not "already allowed".
|
|
29
29
|
*/
|
|
30
30
|
function loadFixtures(source, config) {
|
|
31
31
|
const list = (0, read_json_1.readJson)(source, config.fixturesPath);
|
|
32
32
|
if (!Array.isArray(list)) {
|
|
33
|
-
throw new gate_broken_error_1.GateBrokenError(`${config.fixturesPath}:
|
|
33
|
+
throw new gate_broken_error_1.GateBrokenError(`${config.fixturesPath}: expected a list of entries`);
|
|
34
34
|
}
|
|
35
35
|
const entries = [];
|
|
36
36
|
const problems = [];
|
|
37
37
|
list.forEach((entry, index) => {
|
|
38
38
|
if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {
|
|
39
|
-
problems.push(` #${index}:
|
|
39
|
+
problems.push(` #${index}: the entry is not an object`);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
const record = entry;
|
|
43
43
|
if (typeof record.file !== 'string' || record.file === '') {
|
|
44
|
-
problems.push(` #${index}: file
|
|
44
|
+
problems.push(` #${index}: file is not a non-empty string`);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const { file } = record;
|
|
48
48
|
const keys = Array.isArray(record.keys) ? record.keys : [];
|
|
49
49
|
const reason = typeof record.reason === 'string' ? record.reason : '';
|
|
50
50
|
if (isDeliveryFile(file, config)) {
|
|
51
|
-
problems.push(` #${index} ${file}:
|
|
51
|
+
problems.push(` #${index} ${file}: a delivery file or service code; the fixture list does not exempt it`);
|
|
52
52
|
}
|
|
53
53
|
if (keys.length === 0) {
|
|
54
|
-
problems.push(` #${index} ${file}:
|
|
54
|
+
problems.push(` #${index} ${file}: an empty list of keys`);
|
|
55
55
|
}
|
|
56
56
|
else if (!keys.every((key) => typeof key === 'string' && key !== '')) {
|
|
57
|
-
problems.push(` #${index} ${file}:
|
|
57
|
+
problems.push(` #${index} ${file}: a key is not a non-empty string`);
|
|
58
58
|
}
|
|
59
59
|
if ([...reason.trim()].length < exports.MIN_REASON_LENGTH) {
|
|
60
|
-
problems.push(` #${index} ${file}:
|
|
60
|
+
problems.push(` #${index} ${file}: the reason is shorter than ${exports.MIN_REASON_LENGTH} characters`);
|
|
61
61
|
}
|
|
62
62
|
const count = record.count ?? 1;
|
|
63
63
|
if (typeof count !== 'number' || !Number.isSafeInteger(count) || count < 1) {
|
|
64
|
-
problems.push(` #${index} ${file}: count
|
|
64
|
+
problems.push(` #${index} ${file}: count must be an integer from 1, not ${JSON.stringify(count)}`);
|
|
65
65
|
}
|
|
66
66
|
entries.push({
|
|
67
67
|
file,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture-list.js","sourceRoot":"","sources":["../../src/scanner/fixture-list.ts"],"names":[],"mappings":";;;AAcA,wCAUC;AAQD,oCA+CC;AA7ED,2DAAsD;AAEtD,2CAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"fixture-list.js","sourceRoot":"","sources":["../../src/scanner/fixture-list.ts"],"names":[],"mappings":";;;AAcA,wCAUC;AAQD,oCA+CC;AA7ED,2DAAsD;AAEtD,2CAAuC;AAEvC,qEAAqE;AACxD,QAAA,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAkB;IAC7D,yEAAyE;IACzE,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACzD,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC;QACvC,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAChF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAC1B,MAAoB,EACpB,MAAkB;IAElB,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD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|
|
5
|
-
* - `header
|
|
6
|
-
* - `opensslpass
|
|
7
|
-
* - `secret
|
|
2
|
+
* A command flag rule. Value modes:
|
|
3
|
+
* - `password`: a password of any length (`redis-cli -a abc`);
|
|
4
|
+
* - `userpass`: "login:password" (`curl -u`), the secret is the password;
|
|
5
|
+
* - `header`: an HTTP header (`curl -H "Authorization: Bearer …"`);
|
|
6
|
+
* - `opensslpass`: OpenSSL `pass:…` (`env:`/`file:` are not a literal);
|
|
7
|
+
* - `secret`: a literal from the length threshold (long flags of any command).
|
|
8
8
|
*/
|
|
9
9
|
export interface FlagRule {
|
|
10
10
|
readonly mode: 'password' | 'userpass' | 'header' | 'opensslpass' | 'secret';
|
|
11
|
-
/**
|
|
11
|
+
/** The value is the next word (`-a pass`). */
|
|
12
12
|
readonly separate: boolean;
|
|
13
|
-
/**
|
|
13
|
+
/** The value is glued (`-ppass`, `-uuser:pass`). */
|
|
14
14
|
readonly glued: boolean;
|
|
15
|
-
/**
|
|
15
|
+
/** The separator of login and password for `userpass`. */
|
|
16
16
|
readonly separator?: string;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=flag-rule.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-rule.type.d.ts","sourceRoot":"","sources":["../../src/scanner/flag-rule.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC7E
|
|
1
|
+
{"version":3,"file":"flag-rule.type.d.ts","sourceRoot":"","sources":["../../src/scanner/flag-rule.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC7E,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-broken.error.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-broken.error.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"gate-broken.error.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-broken.error.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,qBAAa,eAAgB,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAInC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GateBrokenError = void 0;
|
|
4
|
-
/**
|
|
4
|
+
/** The gate could not check: the reason is the text, the exit code is 2. */
|
|
5
5
|
class GateBrokenError extends Error {
|
|
6
6
|
constructor(message) {
|
|
7
7
|
super(message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-broken.error.js","sourceRoot":"","sources":["../../src/scanner/gate-broken.error.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"gate-broken.error.js","sourceRoot":"","sources":["../../src/scanner/gate-broken.error.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC5E,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;IACnC,CAAC;CACF;AALD,0CAKC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Project settings: `committed-secrets.json` at the project root. */
|
|
2
2
|
export interface GateConfig {
|
|
3
3
|
readonly minFiles: number;
|
|
4
4
|
readonly requiredKinds: readonly string[];
|
|
@@ -6,9 +6,9 @@ export interface GateConfig {
|
|
|
6
6
|
readonly deliveryPattern: string;
|
|
7
7
|
readonly serviceCodeRoot: string;
|
|
8
8
|
readonly extraPlaceholders: readonly string[];
|
|
9
|
-
/**
|
|
9
|
+
/** Service code that the fixture list exempts: specs and test harnesses (regular expressions). */
|
|
10
10
|
readonly testCodePatterns: readonly string[];
|
|
11
|
-
/**
|
|
11
|
+
/** The baseline (fingerprints of accepted findings) or `null`. */
|
|
12
12
|
readonly baselinePath: string | null;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=gate-config.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-config.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-config.type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"gate-config.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-config.type.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,kGAAkG;IAClG,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,kEAAkE;IAClE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC"}
|
|
@@ -3,9 +3,9 @@ import type { GateConfig } from './gate-config.type';
|
|
|
3
3
|
import type { GateOptions } from './gate-options.type';
|
|
4
4
|
import type { RepositoryFile } from './repository-files';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* What a run scans. `population` are the paths by which the sample threshold
|
|
7
|
+
* is judged when not all content is read (the hook on changes): index
|
|
8
|
+
* entries, not the files read. `commits` is the number of commits of a history scan.
|
|
9
9
|
*/
|
|
10
10
|
export declare class GateFiles {
|
|
11
11
|
static select(options: GateOptions, root: string, config: GateConfig, fixtures: readonly FixtureEntry[]): Promise<{
|
|
@@ -7,9 +7,9 @@ const gate_broken_error_1 = require("./gate-broken.error");
|
|
|
7
7
|
const load_config_1 = require("./load-config");
|
|
8
8
|
const repository_source_1 = require("./repository-source");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* What a run scans. `population` are the paths by which the sample threshold
|
|
11
|
+
* is judged when not all content is read (the hook on changes): index
|
|
12
|
+
* entries, not the files read. `commits` is the number of commits of a history scan.
|
|
13
13
|
*/
|
|
14
14
|
class GateFiles {
|
|
15
15
|
static async select(options, root, config, fixtures) {
|
|
@@ -18,10 +18,10 @@ class GateFiles {
|
|
|
18
18
|
const explicit = options.paths.map((path) => (0, node_path_1.resolve)(path));
|
|
19
19
|
const missing = explicit.filter((path) => !(0, node_fs_1.existsSync)(path) || !(0, node_fs_1.statSync)(path).isFile());
|
|
20
20
|
if (missing.length > 0) {
|
|
21
|
-
throw new gate_broken_error_1.GateBrokenError(
|
|
21
|
+
throw new gate_broken_error_1.GateBrokenError(`no files: ${missing.join(', ')}`);
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
24
|
-
//
|
|
24
|
+
// One file at a time: in memory there is one file, not the whole list.
|
|
25
25
|
files: (function* () {
|
|
26
26
|
for (const path of explicit) {
|
|
27
27
|
yield { path, data: (0, node_fs_1.readFileSync)(path) };
|
|
@@ -56,10 +56,10 @@ class GateFiles {
|
|
|
56
56
|
head,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
59
|
+
// The hook on changes: what did not change already passed the gate at its own commit. An edit
|
|
60
|
+
// of the gate itself (the configuration, the list, the baseline) changes the measure; then
|
|
61
|
+
// the whole index. The fixture list files are always read: otherwise a stale
|
|
62
|
+
// entry would be indistinguishable from an unread one.
|
|
63
63
|
const changed = await repository_source_1.RepositorySource.changedPaths(root, head);
|
|
64
64
|
const gateFiles = [load_config_1.CONFIG_NAME, config.fixturesPath, config.baselinePath].filter((path) => path !== null);
|
|
65
65
|
if (gateFiles.some((path) => changed.has(path))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-files.js","sourceRoot":"","sources":["../../src/scanner/gate-files.ts"],"names":[],"mappings":";;;AAAA,qCAA6D;AAC7D,yCAAoC;AAGpC,2DAAsD;AAGtD,+CAA4C;AAE5C,2DAAuD;AAEvD;;;;GAIG;AACH,MAAa,SAAS;IACb,MAAM,CAAC,KAAK,CAAC,MAAM,CACxB,OAAoB,EACpB,IAAY,EACZ,MAAkB,EAClB,QAAiC;QAQjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oCAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACzF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC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AW,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAC9E,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,IAAI,CACxC,CAAC;QACF,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO;gBACL,KAAK,EAAE,oCAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;gBAC9C,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,IAAI;gBACb,IAAI;aACL,CAAC;QACJ,CAAC;QACD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3F,OAAO;YACL,KAAK,EAAE,oCAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;YAC/C,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;YAC3C,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,IAAI;SACL,CAAC;IACJ,CAAC;CACF;AAnFD,8BAmFC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The parsed gate arguments. */
|
|
2
2
|
export interface GateOptions {
|
|
3
|
-
/** `tree
|
|
3
|
+
/** `tree`: git files in the working tree (CI); `staged`: the index (hook); `paths`: explicit paths; `history`: history blobs. */
|
|
4
4
|
readonly mode: 'tree' | 'staged' | 'paths' | 'history';
|
|
5
5
|
readonly paths: readonly string[];
|
|
6
|
-
/** `--staged --full`:
|
|
6
|
+
/** `--staged --full`: the whole index, not only what changed relative to HEAD. */
|
|
7
7
|
readonly full: boolean;
|
|
8
|
-
/** `--since
|
|
8
|
+
/** `--since <commit>`: history from the commit (not including it) to HEAD; `null` means the whole history. */
|
|
9
9
|
readonly since: string | null;
|
|
10
10
|
readonly format: 'text' | 'json' | 'sarif' | 'gitlab';
|
|
11
|
-
/**
|
|
11
|
+
/** The machine format report file; `null` means stdout. */
|
|
12
12
|
readonly output: string | null;
|
|
13
13
|
readonly writeBaseline: boolean;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-options.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-options.type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"gate-options.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-options.type.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,iIAAiI;IACjI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACtD,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReportedFinding } from './reported-finding.type';
|
|
2
|
-
/**
|
|
2
|
+
/** The run result for machine formats: only new findings, without values. */
|
|
3
3
|
export interface GateReport {
|
|
4
4
|
readonly findings: readonly ReportedFinding[];
|
|
5
5
|
readonly version: string;
|
|
6
|
-
/** HEAD
|
|
6
|
+
/** The repository HEAD (for GitLab `location.commit`), `null` without commits. */
|
|
7
7
|
readonly head: string | null;
|
|
8
8
|
readonly startedAt: Date;
|
|
9
9
|
readonly finishedAt: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-report.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-report.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,
|
|
1
|
+
{"version":3,"file":"gate-report.type.d.ts","sourceRoot":"","sources":["../../src/scanner/gate-report.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B"}
|
package/dist/scanner/git.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* git calls. A refusal is a `GateBrokenError` with a REASON: "git not found",
|
|
3
|
+
* "output above the ceiling" (ENOBUFS) and "git answered with an error" are fixed
|
|
4
|
+
* differently, and "no git" on a buffer overflow sends you to fix the wrong thing.
|
|
5
|
+
* Large outputs (the file list, history, blob contents) are streamed: memory
|
|
6
|
+
* does not grow with the repository size.
|
|
7
7
|
*/
|
|
8
8
|
export declare class Git {
|
|
9
|
-
/**
|
|
9
|
+
/** The ceiling of synchronous output: short answers (rev-parse, one configuration blob). */
|
|
10
10
|
static readonly SYNC_MAX_BUFFER: number;
|
|
11
11
|
private static readonly MISSING;
|
|
12
|
-
/**
|
|
12
|
+
/** A short call. `allowFailure`: a code ≠ 0 is not a refusal but an answer (`rev-parse --verify`). */
|
|
13
13
|
static run(root: string, args: readonly string[], options?: {
|
|
14
14
|
readonly maxBuffer?: number;
|
|
15
15
|
readonly allowFailure?: boolean;
|
|
@@ -17,17 +17,17 @@ export declare class Git {
|
|
|
17
17
|
readonly status: number;
|
|
18
18
|
readonly stdout: Buffer;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** Output records separated by NUL (`ls-files -z`, `log -z`), streamed. */
|
|
21
21
|
static records(root: string, args: readonly string[]): AsyncGenerator<string>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Blob contents one by one, in the requested order (`cat-file --batch`): in
|
|
24
|
+
* memory there is one blob, not the whole index. `null` means the blob is not in the database.
|
|
25
25
|
*/
|
|
26
26
|
static blobs(root: string, shas: readonly string[]): AsyncGenerator<Buffer | null>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* Process completion. A stop at OUR request (the consumer stopped
|
|
29
|
+
* reading) is not a refusal; any other signal or a code ≠ 0 is a refusal: a cut-off
|
|
30
|
+
* output would read as "no secrets".
|
|
31
31
|
*/
|
|
32
32
|
private static completion;
|
|
33
33
|
private static spawnError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/scanner/git.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,qBAAa,GAAG;IACd,
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/scanner/git.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,qBAAa,GAAG;IACd,4FAA4F;IAC5F,gBAAuB,eAAe,SAAoB;IAE1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAA6E;IAE5G,sGAAsG;WACxF,GAAG,CACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7E;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAavD,2EAA2E;WACtD,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IA2B3F;;;OAGG;WACkB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;IA0FhG;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAqBzB,OAAO,CAAC,MAAM,CAAC,UAAU;IAazB,OAAO,CAAC,MAAM,CAAC,WAAW;CAI3B"}
|