@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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.codePoints = void 0;
|
|
4
|
-
/**
|
|
4
|
+
/** The number of characters as Python counts it (`len`): code points, not UTF-16 units. */
|
|
5
5
|
const codePoints = (text) => [...text].length;
|
|
6
6
|
exports.codePoints = codePoints;
|
|
7
7
|
//# sourceMappingURL=code-points.js.map
|
|
@@ -2,10 +2,10 @@ import type { FlagRule } from './flag-rule.type';
|
|
|
2
2
|
import type { LineSink } from './line-sink';
|
|
3
3
|
import type { ShellToken } from './shell-token.type';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A secret in a command line. A short flag means a password only for its own
|
|
6
|
+
* command (`-p` for `sshpass` is a password, for `docker run` ports), so
|
|
7
|
+
* short flags are tied to a command; a long flag whose last word
|
|
8
|
+
* names a secret (`--requirepass`, `--api-key`) counts for any command.
|
|
9
9
|
*/
|
|
10
10
|
export declare class CommandRules {
|
|
11
11
|
private static readonly PASSWORD;
|
|
@@ -15,37 +15,37 @@ export declare class CommandRules {
|
|
|
15
15
|
private static readonly OPENSSL;
|
|
16
16
|
private static readonly SECRET;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* `src=.npmrc`):
|
|
20
|
-
*
|
|
21
|
-
* (`id=x,password=…`)
|
|
18
|
+
* A BuildKit secret spec (`docker build --secret id=npm_token,env=NPM_TOKEN`,
|
|
19
|
+
* `src=.npmrc`): a reference to a secret by variable or file name, not its
|
|
20
|
+
* value. The keys are a closed set and `id` is required: a foreign key
|
|
21
|
+
* (`id=x,password=…`) is not considered a spec.
|
|
22
22
|
*/
|
|
23
23
|
private static readonly BUILD_SECRET_SPEC;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* An escaped variable reference (`\$PW`, `\${PW}`, `\"\$PW\"`) in
|
|
26
|
+
* a command for another shell (`ssh host redis-cli -a \"\$PW\"`): in this
|
|
27
|
+
* shell the word is literal, but its value is a variable name, not a password.
|
|
28
|
+
* The escaped quotes around it (`\"\$PW\"`) are part of the word and are double quotes for the remote
|
|
29
|
+
* shell too: the reference is the same.
|
|
30
30
|
*/
|
|
31
31
|
private static readonly VARIABLE_REFERENCE;
|
|
32
|
-
/** `mysql -p`
|
|
32
|
+
/** `mysql -p` separately is a password prompt, and the next word is the database name: only glued. */
|
|
33
33
|
private static readonly MYSQL;
|
|
34
34
|
private static readonly MONGO;
|
|
35
35
|
private static readonly LDAP;
|
|
36
|
-
/**
|
|
36
|
+
/** Flags by command. The command name is the last path segment of the word (`/usr/bin/curl`). */
|
|
37
37
|
static readonly COMMANDS: Readonly<Record<string, Readonly<Record<string, FlagRule>>>>;
|
|
38
|
-
/**
|
|
38
|
+
/** Registry clients for which `login -p` is a password. */
|
|
39
39
|
private static readonly REGISTRY_CLIENTS;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Findings of a word list. `from` is the word number from which values
|
|
42
|
+
* are judged: a YAML list grows line by line, and every value
|
|
43
|
+
* is named once.
|
|
44
44
|
*/
|
|
45
45
|
static evaluate(tokens: readonly ShellToken[], sink: LineSink, placeholders: ReadonlySet<string>, from?: number): void;
|
|
46
|
-
/** `KEY
|
|
46
|
+
/** `KEY=value` in an assignment position: before the command, `-e`, `--build-arg`, `-o user=…,password=…`. */
|
|
47
47
|
private static assignments;
|
|
48
|
-
/**
|
|
48
|
+
/** The last word of a flag names a secret: `--admin-password` yes, `--password-file` no. */
|
|
49
49
|
private static lastWordNamesSecret;
|
|
50
50
|
private static judge;
|
|
51
51
|
private static judgeSecret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-rules.d.ts","sourceRoot":"","sources":["../../src/scanner/command-rules.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAgE;IAEhG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA+D;IAErG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAK9B;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAA8D;IAE5F,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAmE;IAElG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAA8D;IAE5F;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAC2F;IAEpI;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAC2B;IAErE,
|
|
1
|
+
{"version":3,"file":"command-rules.d.ts","sourceRoot":"","sources":["../../src/scanner/command-rules.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,C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,10 @@ const secret_key_1 = require("./secret-key");
|
|
|
8
8
|
const secret_rules_1 = require("./secret-rules");
|
|
9
9
|
const secret_value_1 = require("./secret-value");
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* A secret in a command line. A short flag means a password only for its own
|
|
12
|
+
* command (`-p` for `sshpass` is a password, for `docker run` ports), so
|
|
13
|
+
* short flags are tied to a command; a long flag whose last word
|
|
14
|
+
* names a secret (`--requirepass`, `--api-key`) counts for any command.
|
|
15
15
|
*/
|
|
16
16
|
class CommandRules {
|
|
17
17
|
static PASSWORD = { mode: 'password', separate: true, glued: false };
|
|
@@ -26,21 +26,21 @@ class CommandRules {
|
|
|
26
26
|
static OPENSSL = { mode: 'opensslpass', separate: true, glued: false };
|
|
27
27
|
static SECRET = { mode: 'secret', separate: true, glued: false };
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* `src=.npmrc`):
|
|
31
|
-
*
|
|
32
|
-
* (`id=x,password=…`)
|
|
29
|
+
* A BuildKit secret spec (`docker build --secret id=npm_token,env=NPM_TOKEN`,
|
|
30
|
+
* `src=.npmrc`): a reference to a secret by variable or file name, not its
|
|
31
|
+
* value. The keys are a closed set and `id` is required: a foreign key
|
|
32
|
+
* (`id=x,password=…`) is not considered a spec.
|
|
33
33
|
*/
|
|
34
34
|
static BUILD_SECRET_SPEC = /^(?=(?:[^,]*,)*id=[^,]+(?:,|$))(?:id|env|src|source|type|required)=[^,=\s]*(?:,(?:id|env|src|source|type|required)=[^,=\s]*)*$/u;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* An escaped variable reference (`\$PW`, `\${PW}`, `\"\$PW\"`) in
|
|
37
|
+
* a command for another shell (`ssh host redis-cli -a \"\$PW\"`): in this
|
|
38
|
+
* shell the word is literal, but its value is a variable name, not a password.
|
|
39
|
+
* The escaped quotes around it (`\"\$PW\"`) are part of the word and are double quotes for the remote
|
|
40
|
+
* shell too: the reference is the same.
|
|
41
41
|
*/
|
|
42
42
|
static VARIABLE_REFERENCE = /^("?)\$(?:[A-Za-z_][A-Za-z0-9_]*|\{[A-Za-z_][A-Za-z0-9_]*\})\1$/u;
|
|
43
|
-
/** `mysql -p`
|
|
43
|
+
/** `mysql -p` separately is a password prompt, and the next word is the database name: only glued. */
|
|
44
44
|
static MYSQL = {
|
|
45
45
|
'-p': { mode: 'password', separate: false, glued: true },
|
|
46
46
|
};
|
|
@@ -48,7 +48,7 @@ class CommandRules {
|
|
|
48
48
|
'-p': CommandRules.PASSWORD,
|
|
49
49
|
};
|
|
50
50
|
static LDAP = { '-w': CommandRules.PASSWORD_GLUED };
|
|
51
|
-
/**
|
|
51
|
+
/** Flags by command. The command name is the last path segment of the word (`/usr/bin/curl`). */
|
|
52
52
|
static COMMANDS = {
|
|
53
53
|
'redis-cli': { '-a': CommandRules.PASSWORD, '--pass': CommandRules.PASSWORD },
|
|
54
54
|
sshpass: { '-p': CommandRules.PASSWORD_GLUED },
|
|
@@ -85,10 +85,10 @@ class CommandRules {
|
|
|
85
85
|
'-pass': CommandRules.OPENSSL,
|
|
86
86
|
'-k': CommandRules.PASSWORD,
|
|
87
87
|
},
|
|
88
|
-
// `login
|
|
88
|
+
// `login`: flags only after a registry client (`docker login -p`).
|
|
89
89
|
login: { '-p': CommandRules.PASSWORD, '--password': CommandRules.PASSWORD },
|
|
90
90
|
};
|
|
91
|
-
/**
|
|
91
|
+
/** Registry clients for which `login -p` is a password. */
|
|
92
92
|
static REGISTRY_CLIENTS = new Set([
|
|
93
93
|
'docker',
|
|
94
94
|
'podman',
|
|
@@ -100,9 +100,9 @@ class CommandRules {
|
|
|
100
100
|
'crane',
|
|
101
101
|
]);
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* Findings of a word list. `from` is the word number from which values
|
|
104
|
+
* are judged: a YAML list grows line by line, and every value
|
|
105
|
+
* is named once.
|
|
106
106
|
*/
|
|
107
107
|
static evaluate(tokens, sink, placeholders, from = 0) {
|
|
108
108
|
const judge = (key, rule, token, index) => {
|
|
@@ -167,7 +167,7 @@ class CommandRules {
|
|
|
167
167
|
CommandRules.assignments(token, sink, placeholders, index >= from);
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
/** `KEY
|
|
170
|
+
/** `KEY=value` in an assignment position: before the command, `-e`, `--build-arg`, `-o user=…,password=…`. */
|
|
171
171
|
static assignments(token, sink, placeholders, report) {
|
|
172
172
|
if (!report || !token.text.includes('=')) {
|
|
173
173
|
return;
|
|
@@ -175,7 +175,7 @@ class CommandRules {
|
|
|
175
175
|
for (const part of token.text.split(',')) {
|
|
176
176
|
const match = /^([A-Za-z_][A-Za-z0-9_.-]*)=(.+)$/su.exec(part);
|
|
177
177
|
if (match !== null && match[1] === '_auth' && base64_credentials_1.Base64Credentials.decode(match[2]) !== null) {
|
|
178
|
-
// `_auth` .npmrc
|
|
178
|
+
// `_auth` in .npmrc is base64 "login:password": by the content, as in TextScanner.keyValues.
|
|
179
179
|
base64_credentials_1.Base64Credentials.judgeKey('_auth', match[2], sink, placeholders);
|
|
180
180
|
}
|
|
181
181
|
else if (match !== null && (0, secret_key_1.isSecretKey)(match[1])) {
|
|
@@ -183,7 +183,7 @@ class CommandRules {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
/**
|
|
186
|
+
/** The last word of a flag names a secret: `--admin-password` yes, `--password-file` no. */
|
|
187
187
|
static lastWordNamesSecret(flag) {
|
|
188
188
|
const words = (0, secret_key_1.wordsOf)(flag);
|
|
189
189
|
const last = words.at(-1);
|
|
@@ -193,7 +193,7 @@ class CommandRules {
|
|
|
193
193
|
return (0, secret_key_1.namesSecret)([last]) || (words.length > 1 && secret_rules_1.SECRET_PAIRS.has(`${words.at(-2)} ${last}`));
|
|
194
194
|
}
|
|
195
195
|
static judge(key, rule, token, sink, placeholders) {
|
|
196
|
-
//
|
|
196
|
+
// A substitution without a default value is not a literal; `${X:-literal}` is a literal.
|
|
197
197
|
const parts = token.literal ? [token.text] : token.text.includes('${') ? (0, secret_value_1.literalParts)(token.text) : [];
|
|
198
198
|
for (const part of parts) {
|
|
199
199
|
if (rule.mode === 'secret' || rule.mode === 'header') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-rules.js","sourceRoot":"","sources":["../../src/scanner/command-rules.ts"],"names":[],"mappings":";;;AAAA,6EAAiE;AACjE,6DAAyD;AACzD,yDAAkD;AAGlD,6CAAiE;AACjE,iDAA8C;AAC9C,iDAA+D;AAG/D;;;;;GAKG;AACH,MAAa,YAAY;IACf,MAAM,CAAU,QAAQ,GAAa,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAExF,MAAM,CAAU,cAAc,GAAa,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAE7F,MAAM,CAAU,QAAQ,GAAa;QAC3C,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,GAAG;KACf,CAAC;IAEM,MAAM,CAAU,MAAM,GAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAEpF,MAAM,CAAU,OAAO,GAAa,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAE1F,MAAM,CAAU,MAAM,GAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAE5F;;;;;OAKG;IACK,MAAM,CAAU,iBAAi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AE,YAAY,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;aAAM,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,IAAI,IAAA,8BAAe,EAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;;AAtRH,oCAuRC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Where the gate reads its files from (the configuration, the fixture list, the
|
|
3
|
+
* baseline): from the working tree or from the INDEX. The `--staged` hook judges what
|
|
4
|
+
* goes into the commit, and the measure must be the list that is committed as well:
|
|
5
|
+
* a fixture entry added on disk but not added to the index does not
|
|
6
|
+
* exempt a finding of the commit.
|
|
7
7
|
*/
|
|
8
8
|
export declare class ConfigSource {
|
|
9
9
|
readonly root: string;
|
|
10
10
|
readonly fromIndex: boolean;
|
|
11
11
|
constructor(root: string, fromIndex: boolean);
|
|
12
|
-
/**
|
|
12
|
+
/** Where it was looked for, for the refusal text. */
|
|
13
13
|
where(path: string): string;
|
|
14
|
-
/**
|
|
14
|
+
/** The file content or `null` if there is none. */
|
|
15
15
|
read(path: string): string | null;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=config-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../../src/scanner/config-source.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qBAAa,YAAY;aAEL,IAAI,EAAE,MAAM;aACZ,SAAS,EAAE,OAAO;gBADlB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO;IAGpC,
|
|
1
|
+
{"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../../src/scanner/config-source.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qBAAa,YAAY;aAEL,IAAI,EAAE,MAAM;aACZ,SAAS,EAAE,OAAO;gBADlB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO;IAGpC,qDAAqD;IAC9C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,mDAAmD;IAC5C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAmBzC"}
|
|
@@ -5,11 +5,11 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const git_1 = require("./git");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Where the gate reads its files from (the configuration, the fixture list, the
|
|
9
|
+
* baseline): from the working tree or from the INDEX. The `--staged` hook judges what
|
|
10
|
+
* goes into the commit, and the measure must be the list that is committed as well:
|
|
11
|
+
* a fixture entry added on disk but not added to the index does not
|
|
12
|
+
* exempt a finding of the commit.
|
|
13
13
|
*/
|
|
14
14
|
class ConfigSource {
|
|
15
15
|
root;
|
|
@@ -18,11 +18,11 @@ class ConfigSource {
|
|
|
18
18
|
this.root = root;
|
|
19
19
|
this.fromIndex = fromIndex;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/** Where it was looked for, for the refusal text. */
|
|
22
22
|
where(path) {
|
|
23
|
-
return this.fromIndex ? `${path}
|
|
23
|
+
return this.fromIndex ? `${path} in the index` : (0, node_path_1.join)(this.root, path);
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
25
|
+
/** The file content or `null` if there is none. */
|
|
26
26
|
read(path) {
|
|
27
27
|
if (!this.fromIndex) {
|
|
28
28
|
const full = (0, node_path_1.join)(this.root, path);
|
|
@@ -31,7 +31,7 @@ class ConfigSource {
|
|
|
31
31
|
}
|
|
32
32
|
return (0, node_fs_1.readFileSync)(full, 'utf8');
|
|
33
33
|
}
|
|
34
|
-
//
|
|
34
|
+
// `:./path` is a path relative to the launch directory, not the repository root.
|
|
35
35
|
const found = git_1.Git.run(this.root, ['rev-parse', '--verify', '--quiet', `:./${path}`], {
|
|
36
36
|
allowFailure: true,
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-source.js","sourceRoot":"","sources":["../../src/scanner/config-source.ts"],"names":[],"mappings":";;;AAAA,qCAA6D;AAC7D,yCAAiC;AAEjC,+BAA4B;AAE5B;;;;;;GAMG;AACH,MAAa,YAAY;IAEL;IACA;IAFlB,YACkB,IAAY,EACZ,SAAkB;QADlB,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAS;IACjC,CAAC;IAEJ,
|
|
1
|
+
{"version":3,"file":"config-source.js","sourceRoot":"","sources":["../../src/scanner/config-source.ts"],"names":[],"mappings":";;;AAAA,qCAA6D;AAC7D,yCAAiC;AAEjC,+BAA4B;AAE5B;;;;;;GAMG;AACH,MAAa,YAAY;IAEL;IACA;IAFlB,YACkB,IAAY,EACZ,SAAkB;QADlB,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAS;IACjC,CAAC;IAEJ,qDAAqD;IAC9C,KAAK,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,mDAAmD;IAC5C,IAAI,CAAC,IAAY;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;gBAClD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QACD,iFAAiF;QACjF,MAAM,KAAK,GAAG,SAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE;YACnF,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,SAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CACnG,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AA/BD,oCA+BC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* A password without a lower length bound, where the form itself says "this is a password":
|
|
3
|
+
* a URL, `curl -u login:password`, `sshpass -p`, base64 "login:password".
|
|
4
|
+
* A three-letter password is a password too; placeholders (`password`, `<pw>`) are not.
|
|
5
5
|
*/
|
|
6
6
|
export declare function isCredential(value: string, placeholders: ReadonlySet<string>): boolean;
|
|
7
7
|
//# sourceMappingURL=credential-value.d.ts.map
|
|
@@ -4,9 +4,9 @@ exports.isCredential = isCredential;
|
|
|
4
4
|
const secret_rules_1 = require("./secret-rules");
|
|
5
5
|
const secret_value_1 = require("./secret-value");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* A password without a lower length bound, where the form itself says "this is a password":
|
|
8
|
+
* a URL, `curl -u login:password`, `sshpass -p`, base64 "login:password".
|
|
9
|
+
* A three-letter password is a password too; placeholders (`password`, `<pw>`) are not.
|
|
10
10
|
*/
|
|
11
11
|
function isCredential(value, placeholders) {
|
|
12
12
|
return (value !== '' &&
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `keys/client-secret.json`, `tls/server.key`):
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `abc.def` (
|
|
2
|
+
* The value is a file name or a path without `./` (`gl-secret-detection-report.json`,
|
|
3
|
+
* `keys/client-secret.json`, `tls/server.key`): a reference to a file, not a literal.
|
|
4
|
+
* Narrow, so that a secret with an appended extension stays a finding: the directories and the name are
|
|
5
|
+
* lower-case words separated by `-`, `_` or `.`, the extension is from the list of data,
|
|
6
|
+
* report and key file formats. `Zq8vR2mT7x.json` (mixed case) and
|
|
7
|
+
* `abc.def` (an extension not from the list) are still literals.
|
|
8
8
|
*/
|
|
9
9
|
export declare const DATA_FILE_NAME: RegExp;
|
|
10
10
|
//# sourceMappingURL=data-file-name.constant.d.ts.map
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DATA_FILE_NAME = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* `keys/client-secret.json`, `tls/server.key`):
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `abc.def` (
|
|
5
|
+
* The value is a file name or a path without `./` (`gl-secret-detection-report.json`,
|
|
6
|
+
* `keys/client-secret.json`, `tls/server.key`): a reference to a file, not a literal.
|
|
7
|
+
* Narrow, so that a secret with an appended extension stays a finding: the directories and the name are
|
|
8
|
+
* lower-case words separated by `-`, `_` or `.`, the extension is from the list of data,
|
|
9
|
+
* report and key file formats. `Zq8vR2mT7x.json` (mixed case) and
|
|
10
|
+
* `abc.def` (an extension not from the list) are still literals.
|
|
11
11
|
*/
|
|
12
12
|
exports.DATA_FILE_NAME = /^(?:[a-z0-9_.-]+\/)*[a-z0-9]+(?:[-_.][a-z0-9]+)*\.(?:json|ya?ml|xml|sarif|txt|csv|log|html?|toml|ini|env|pem|key|crt|cer|p12|pfx|jks)$/u;
|
|
13
13
|
//# sourceMappingURL=data-file-name.constant.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Example values from vendor documentation, published as deliberately
|
|
3
|
+
* invalid (AWS: "AKIAIOSFODNN7EXAMPLE"). A closed set of exact
|
|
4
|
+
* values: a key of a similar shape stays a finding.
|
|
5
5
|
*/
|
|
6
6
|
export declare const DOCUMENTED_EXAMPLE_SECRETS: ReadonlySet<string>;
|
|
7
7
|
//# sourceMappingURL=documented-example-secrets.constant.d.ts.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DOCUMENTED_EXAMPLE_SECRETS = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Example values from vendor documentation, published as deliberately
|
|
6
|
+
* invalid (AWS: "AKIAIOSFODNN7EXAMPLE"). A closed set of exact
|
|
7
|
+
* values: a key of a similar shape stays a finding.
|
|
8
8
|
*/
|
|
9
9
|
exports.DOCUMENTED_EXAMPLE_SECRETS = new Set([
|
|
10
10
|
'AKIAIOSFODNN7EXAMPLE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-code.constant.d.ts","sourceRoot":"","sources":["../../src/scanner/exit-code.constant.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"exit-code.constant.d.ts","sourceRoot":"","sources":["../../src/scanner/exit-code.constant.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,SAAS;;;;CAAgD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EXIT_CODE = void 0;
|
|
4
|
-
/**
|
|
4
|
+
/** Gate exit codes: "could not check" differs both from success and from a finding. */
|
|
5
5
|
exports.EXIT_CODE = { clean: 0, findings: 1, broken: 2 };
|
|
6
6
|
//# sourceMappingURL=exit-code.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-code.constant.js","sourceRoot":"","sources":["../../src/scanner/exit-code.constant.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"exit-code.constant.js","sourceRoot":"","sources":["../../src/scanner/exit-code.constant.ts"],"names":[],"mappings":";;;AAAA,uFAAuF;AAC1E,QAAA,SAAS,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* env.REGION ?? 'x'
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* The expression of a key value up to its boundary: the first comma, `;` or closing
|
|
3
|
+
* bracket OUTSIDE nested brackets and strings. `apiKey: process.env.API_KEY, region:
|
|
4
|
+
* env.REGION ?? 'x'`: the `apiKey` value ends at the comma: the literal of the neighbouring
|
|
5
|
+
* property does not belong to it. A comma inside a call (`get('KEY', 'x')`) is not a
|
|
6
|
+
* boundary.
|
|
7
7
|
*/
|
|
8
8
|
export declare function expressionExtent(text: string): string;
|
|
9
9
|
//# sourceMappingURL=expression-extent.d.ts.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expressionExtent = expressionExtent;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* env.REGION ?? 'x'
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* The expression of a key value up to its boundary: the first comma, `;` or closing
|
|
6
|
+
* bracket OUTSIDE nested brackets and strings. `apiKey: process.env.API_KEY, region:
|
|
7
|
+
* env.REGION ?? 'x'`: the `apiKey` value ends at the comma: the literal of the neighbouring
|
|
8
|
+
* property does not belong to it. A comma inside a call (`get('KEY', 'x')`) is not a
|
|
9
|
+
* boundary.
|
|
10
10
|
*/
|
|
11
11
|
function expressionExtent(text) {
|
|
12
12
|
let depth = 0;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A file class: which forms to look for in it. */
|
|
2
2
|
export interface FileKind {
|
|
3
|
-
/**
|
|
3
|
+
/** An unquoted value is a secret (.env, YAML, shell, Dockerfile…). */
|
|
4
4
|
readonly config: boolean;
|
|
5
5
|
readonly markdown: boolean;
|
|
6
|
-
/**
|
|
6
|
+
/** YAML structure: `|` blocks, lists, `name`/`value`, `encryptedData`. */
|
|
7
7
|
readonly yaml: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/** A directive and a value separated by a space (`requirepass …` in redis.conf). */
|
|
9
9
|
readonly directives: boolean;
|
|
10
10
|
/** `.netrc`: `machine … login … password …`. */
|
|
11
11
|
readonly netrc: boolean;
|
|
12
|
-
/** `.pgpass`:
|
|
12
|
+
/** `.pgpass`: `host:port:database:user:password`. */
|
|
13
13
|
readonly pgpass: boolean;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=file-kind.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-kind.type.d.ts","sourceRoot":"","sources":["../../src/scanner/file-kind.type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"file-kind.type.d.ts","sourceRoot":"","sources":["../../src/scanner/file-kind.type.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACvB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FileKind } from './file-kind.type';
|
|
2
|
-
/**
|
|
2
|
+
/** The file class by name. */
|
|
3
3
|
export declare class FileKinds {
|
|
4
|
-
/**
|
|
4
|
+
/** Configuration files without a configuration extension: shell profiles, client credential files. */
|
|
5
5
|
static readonly CONFIG_NAMES: ReadonlySet<string>;
|
|
6
6
|
static of(path: string): FileKind;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-kinds.d.ts","sourceRoot":"","sources":["../../src/scanner/file-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,
|
|
1
|
+
{"version":3,"file":"file-kinds.d.ts","sourceRoot":"","sources":["../../src/scanner/file-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,8BAA8B;AAC9B,qBAAa,SAAS;IACpB,sGAAsG;IACtG,gBAAuB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAiBrD;WAEW,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;CAwBzC"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileKinds = void 0;
|
|
4
4
|
const path_suffix_1 = require("./path-suffix");
|
|
5
5
|
const secret_rules_1 = require("./secret-rules");
|
|
6
|
-
/**
|
|
6
|
+
/** The file class by name. */
|
|
7
7
|
class FileKinds {
|
|
8
|
-
/**
|
|
8
|
+
/** Configuration files without a configuration extension: shell profiles, client credential files. */
|
|
9
9
|
static CONFIG_NAMES = new Set([
|
|
10
10
|
'.bashrc',
|
|
11
11
|
'.bash_profile',
|
|
@@ -30,7 +30,7 @@ class FileKinds {
|
|
|
30
30
|
const config = secret_rules_1.CONFIG_SUFFIXES.some((ending) => name.endsWith(ending)) ||
|
|
31
31
|
FileKinds.CONFIG_NAMES.has(name) ||
|
|
32
32
|
name.startsWith('.env') ||
|
|
33
|
-
// `prod.env.example`, `app.env.local`:
|
|
33
|
+
// `prod.env.example`, `app.env.local`: an environment file with a variant suffix.
|
|
34
34
|
/(?:^|\.)env\.(?:example|sample|template|tpl|dist|defaults?|local|dev|development|test|staging|stage|prod|production)$/u.test(name) ||
|
|
35
35
|
name.startsWith('Dockerfile') ||
|
|
36
36
|
name.endsWith('.Dockerfile') ||
|