@futdevpro/fsm-dynamo 1.20.200 → 1.20.204
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/build/_collections/utils/stack.util.d.ts.map +1 -1
- package/build/_collections/utils/stack.util.js +12 -4
- package/build/_collections/utils/stack.util.js.map +1 -1
- package/build/_modules/security/_collections/secret-file.util.d.ts +25 -0
- package/build/_modules/security/_collections/secret-file.util.d.ts.map +1 -0
- package/build/_modules/security/_collections/secret-file.util.js +41 -0
- package/build/_modules/security/_collections/secret-file.util.js.map +1 -0
- package/build/_modules/security/_collections/secret-key-patterns.const.d.ts +19 -0
- package/build/_modules/security/_collections/secret-key-patterns.const.d.ts.map +1 -0
- package/build/_modules/security/_collections/secret-key-patterns.const.js +57 -0
- package/build/_modules/security/_collections/secret-key-patterns.const.js.map +1 -0
- package/build/_modules/security/_collections/stored-secret.util.d.ts +8 -0
- package/build/_modules/security/_collections/stored-secret.util.d.ts.map +1 -1
- package/build/_modules/security/_collections/stored-secret.util.js +11 -0
- package/build/_modules/security/_collections/stored-secret.util.js.map +1 -1
- package/build/_modules/security/_models/secret-key-pattern.interface.d.ts +17 -0
- package/build/_modules/security/_models/secret-key-pattern.interface.d.ts.map +1 -0
- package/build/_modules/security/_models/secret-key-pattern.interface.js +3 -0
- package/build/_modules/security/_models/secret-key-pattern.interface.js.map +1 -0
- package/build/_modules/security/index.d.ts +3 -0
- package/build/_modules/security/index.d.ts.map +1 -1
- package/build/_modules/security/index.js +4 -0
- package/build/_modules/security/index.js.map +1 -1
- package/build-esm/_collections/utils/stack.util.js +12 -4
- package/build-esm/_modules/security/_collections/secret-file.util.js +36 -0
- package/build-esm/_modules/security/_collections/secret-key-patterns.const.js +53 -0
- package/build-esm/_modules/security/_collections/stored-secret.util.js +11 -0
- package/build-esm/_modules/security/_models/secret-key-pattern.interface.js +1 -0
- package/build-esm/_modules/security/index.js +4 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.util.d.ts","sourceRoot":"","sources":["../../../src/_collections/utils/stack.util.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"stack.util.d.ts","sourceRoot":"","sources":["../../../src/_collections/utils/stack.util.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM,CA6E3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM,CA2EpE"}
|
|
@@ -16,6 +16,10 @@ const log_util_1 = require("./log.util");
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
function DyFM_getConstructionStackLocation(level = 0) {
|
|
19
|
+
if (level < 0) {
|
|
20
|
+
log_util_1.DyFM_Log.warn(`Negative level parameter provided to DyFM_getConstructionStackLocation: ${level}.`, { level });
|
|
21
|
+
level = 0;
|
|
22
|
+
}
|
|
19
23
|
const stack = new Error().stack;
|
|
20
24
|
// Split the stack into lines and remove the first line (Error:)
|
|
21
25
|
let stackLines = stack?.split('\n')?.slice(2);
|
|
@@ -29,8 +33,8 @@ function DyFM_getConstructionStackLocation(level = 0) {
|
|
|
29
33
|
if (isNaN(level)) {
|
|
30
34
|
throw new Error('level must be a number');
|
|
31
35
|
}
|
|
32
|
-
if (level) {
|
|
33
|
-
while (level) {
|
|
36
|
+
if (level > 0) {
|
|
37
|
+
while (level > 0) {
|
|
34
38
|
stackLines = stackLines?.filter(line => line !== constructorLine);
|
|
35
39
|
level--;
|
|
36
40
|
constructorLine = stackLines?.find(line => line &&
|
|
@@ -81,6 +85,10 @@ function DyFM_getConstructionStackLocation(level = 0) {
|
|
|
81
85
|
* ```
|
|
82
86
|
*/
|
|
83
87
|
function DyFM_getLocalStackLocation(level = 0) {
|
|
88
|
+
if (level < 0) {
|
|
89
|
+
log_util_1.DyFM_Log.warn(`Negative level parameter provided to DyFM_getLocalStackLocation: ${level}.`, { level });
|
|
90
|
+
level = 0;
|
|
91
|
+
}
|
|
84
92
|
let stack = new Error().stack;
|
|
85
93
|
// Split the stack into lines and remove the first line (Error:) and the second line (DyFM_getLocalStackLocation)
|
|
86
94
|
let stackLines = stack?.split('\n')?.slice(2);
|
|
@@ -92,8 +100,8 @@ function DyFM_getLocalStackLocation(level = 0) {
|
|
|
92
100
|
if (isNaN(level)) {
|
|
93
101
|
throw new Error('level must be a number');
|
|
94
102
|
}
|
|
95
|
-
if (level) {
|
|
96
|
-
while (level) {
|
|
103
|
+
if (level > 0) {
|
|
104
|
+
while (level > 0) {
|
|
97
105
|
stackLines = stackLines?.filter(line => line !== locationLine);
|
|
98
106
|
level--;
|
|
99
107
|
locationLine = stackLines?.find(line => line &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.util.js","sourceRoot":"","sources":["../../../src/_collections/utils/stack.util.ts"],"names":[],"mappings":";;AAcA,
|
|
1
|
+
{"version":3,"file":"stack.util.js","sourceRoot":"","sources":["../../../src/_collections/utils/stack.util.ts"],"names":[],"mappings":";;AAcA,8EA6EC;AAcD,gEA2EC;AApLD,yCAAsC;AAEtC;;;;;;;;;;;GAWG;AACH,SAAgB,iCAAiC,CAAC,QAAgB,CAAC;IACjE,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,mBAAQ,CAAC,IAAI,CACX,2EAA2E,KAAK,GAAG,EACnF,EAAE,KAAK,EAAE,CACV,CAAC;QACF,KAAK,GAAG,CAAC,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAW,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAExC,gEAAgE;IAChE,IAAI,UAAU,GAAG,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAE9C,mDAAmD;IAC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C,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EACjE;gBACE,KAAK;aACN,CACF,CAAC;YAEF,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,IAAI,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,YAAY,GAAG,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,YAAY,GAAG,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,mBAAQ,CAAC,IAAI,CACX,+BAA+B,OAAO,KAAK,KAAK,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EAAE;YAC7F,KAAK;SACN,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔐 **BFR-MICROWORK-003 — the secret-file names, ONE list** *(the FAM `FAM_SecretExclude_Util` HARD patterns and the
|
|
3
|
+
* `micro-work` `secret-file.util.ts` held the same eight; a new one now reaches every detector)*.
|
|
4
|
+
*
|
|
5
|
+
* @description Matched on the file NAME, without the path. A `.env.example` / `.env.sample` / `.env.template` is a
|
|
6
|
+
* template, not a secret: `isSecretFile` says no to it unless the caller excludes templates too
|
|
7
|
+
* (`isEnvTemplateSecret: true`, the FAM index's choice).
|
|
8
|
+
*/
|
|
9
|
+
export declare class DyFM_SecretFile_Util {
|
|
10
|
+
/** The secret-file name patterns. */
|
|
11
|
+
static readonly fileNamePatterns: RegExp[];
|
|
12
|
+
/** The `.env` templates: they show the keys, never the values. */
|
|
13
|
+
static readonly envTemplatePattern: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a file is a secret file, by its name.
|
|
16
|
+
*
|
|
17
|
+
* @param set.filePath the path or the bare name (both `/` and `\` separators)
|
|
18
|
+
* @param set.isEnvTemplateSecret also count the `.env` templates (default: no)
|
|
19
|
+
*/
|
|
20
|
+
static isSecretFile(set: {
|
|
21
|
+
filePath: string;
|
|
22
|
+
isEnvTemplateSecret?: boolean;
|
|
23
|
+
}): boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=secret-file.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-file.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/secret-file.util.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC/B,qCAAqC;IACrC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CASxC;IAEF,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAyC;IAEnF;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO;CASvF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyFM_SecretFile_Util = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 🔐 **BFR-MICROWORK-003 — the secret-file names, ONE list** *(the FAM `FAM_SecretExclude_Util` HARD patterns and the
|
|
6
|
+
* `micro-work` `secret-file.util.ts` held the same eight; a new one now reaches every detector)*.
|
|
7
|
+
*
|
|
8
|
+
* @description Matched on the file NAME, without the path. A `.env.example` / `.env.sample` / `.env.template` is a
|
|
9
|
+
* template, not a secret: `isSecretFile` says no to it unless the caller excludes templates too
|
|
10
|
+
* (`isEnvTemplateSecret: true`, the FAM index's choice).
|
|
11
|
+
*/
|
|
12
|
+
class DyFM_SecretFile_Util {
|
|
13
|
+
/** The secret-file name patterns. */
|
|
14
|
+
static fileNamePatterns = [
|
|
15
|
+
/^\.env(\..*)?$/i,
|
|
16
|
+
/\.key$/i,
|
|
17
|
+
/\.pem$/i,
|
|
18
|
+
/\.p12$/i,
|
|
19
|
+
/\.pfx$/i,
|
|
20
|
+
/\.crt$/i,
|
|
21
|
+
/^id_rsa/i,
|
|
22
|
+
/^id_ed25519/i,
|
|
23
|
+
];
|
|
24
|
+
/** The `.env` templates: they show the keys, never the values. */
|
|
25
|
+
static envTemplatePattern = /^\.env\.(example|sample|template)$/i;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a file is a secret file, by its name.
|
|
28
|
+
*
|
|
29
|
+
* @param set.filePath the path or the bare name (both `/` and `\` separators)
|
|
30
|
+
* @param set.isEnvTemplateSecret also count the `.env` templates (default: no)
|
|
31
|
+
*/
|
|
32
|
+
static isSecretFile(set) {
|
|
33
|
+
const fileName = set.filePath.split(/[\\/]/).pop() ?? set.filePath;
|
|
34
|
+
if (!set.isEnvTemplateSecret && DyFM_SecretFile_Util.envTemplatePattern.test(fileName)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return DyFM_SecretFile_Util.fileNamePatterns.some((pattern) => pattern.test(fileName));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.DyFM_SecretFile_Util = DyFM_SecretFile_Util;
|
|
41
|
+
//# sourceMappingURL=secret-file.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-file.util.js","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/secret-file.util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,MAAa,oBAAoB;IAC/B,qCAAqC;IACrC,MAAM,CAAU,gBAAgB,GAAa;QAC3C,iBAAiB;QACjB,SAAS;QACT,SAAS;QACT,SAAS;QACT,SAAS;QACT,SAAS;QACT,UAAU;QACV,cAAc;KACf,CAAC;IAEF,kEAAkE;IAClE,MAAM,CAAU,kBAAkB,GAAW,qCAAqC,CAAC;IAEnF;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,GAAwD;QAC1E,MAAM,QAAQ,GAAW,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC;QAE3E,IAAI,CAAC,GAAG,CAAC,mBAAmB,IAAI,oBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvF,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,oBAAoB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAe,EAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1G,CAAC;;AA9BH,oDA+BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DyFM_SecretKeyPattern_Interface } from '../_models/secret-key-pattern.interface';
|
|
2
|
+
/**
|
|
3
|
+
* 🔐 **BFR-MICROWORK-003 — the key-shaped text patterns, ONE list for every detector** *(`dc rev` `no-secrets-in-repo`,
|
|
4
|
+
* `dc publish-check`, the FAM ingest, the micro-work gates)*.
|
|
5
|
+
*
|
|
6
|
+
* @description Measured 2026-11-18: five separate lists lived side by side (`dc rev` 12, `publish-check` 14, the FAM's
|
|
7
|
+
* `FAM_SecretContent_Util` in two copies, `micro-work` `MW_KeyPattern_Util` 9), and a fix to one (a missed key, a
|
|
8
|
+
* false positive) never reached the others. This is their union, each format at the bound the lists agreed on, or
|
|
9
|
+
* the wider one where they differed.
|
|
10
|
+
*
|
|
11
|
+
* Only formats that are a credential on their own sight: a generic "long random string" is left out on purpose (the
|
|
12
|
+
* noise would get the gate switched off, and a switched-off gate protects nothing). The name-based patterns
|
|
13
|
+
* (`apiKey: '…'`) stay with their detectors: each tunes its own context.
|
|
14
|
+
*
|
|
15
|
+
* The masking of logs (`DyFM_SECRET_PATTERNS`) is a different job (it also masks `Bearer …` and `NAME=value` pairs,
|
|
16
|
+
* which would be noise in source); it is not this list.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DyFM_secretKeyPatterns: DyFM_SecretKeyPattern_Interface[];
|
|
19
|
+
//# sourceMappingURL=secret-key-patterns.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-key-patterns.const.d.ts","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/secret-key-patterns.const.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAE1F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,EAAE,+BAA+B,EAoCnE,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyFM_secretKeyPatterns = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 🔐 **BFR-MICROWORK-003 — the key-shaped text patterns, ONE list for every detector** *(`dc rev` `no-secrets-in-repo`,
|
|
6
|
+
* `dc publish-check`, the FAM ingest, the micro-work gates)*.
|
|
7
|
+
*
|
|
8
|
+
* @description Measured 2026-11-18: five separate lists lived side by side (`dc rev` 12, `publish-check` 14, the FAM's
|
|
9
|
+
* `FAM_SecretContent_Util` in two copies, `micro-work` `MW_KeyPattern_Util` 9), and a fix to one (a missed key, a
|
|
10
|
+
* false positive) never reached the others. This is their union, each format at the bound the lists agreed on, or
|
|
11
|
+
* the wider one where they differed.
|
|
12
|
+
*
|
|
13
|
+
* Only formats that are a credential on their own sight: a generic "long random string" is left out on purpose (the
|
|
14
|
+
* noise would get the gate switched off, and a switched-off gate protects nothing). The name-based patterns
|
|
15
|
+
* (`apiKey: '…'`) stay with their detectors: each tunes its own context.
|
|
16
|
+
*
|
|
17
|
+
* The masking of logs (`DyFM_SECRET_PATTERNS`) is a different job (it also masks `Bearer …` and `NAME=value` pairs,
|
|
18
|
+
* which would be noise in source); it is not this list.
|
|
19
|
+
*/
|
|
20
|
+
exports.DyFM_secretKeyPatterns = [
|
|
21
|
+
// Anthropic BEFORE OpenAI: `sk-ant-…` is the more specific one
|
|
22
|
+
{ kind: 'anthropic-key', name: 'Anthropic API key', regex: /\bsk-ant-[A-Za-z0-9_-]{20,}/ },
|
|
23
|
+
{ kind: 'openai-key', name: 'OpenAI API key', regex: /\bsk-(?!ant-)(?:proj-)?[A-Za-z0-9_-]{32,}/ },
|
|
24
|
+
{ kind: 'google-api-key', name: 'Google API key', regex: /\bAIza[0-9A-Za-z_-]{35}\b/ },
|
|
25
|
+
{ kind: 'google-oauth-secret', name: 'Google OAuth client secret', regex: /\bGOCSPX-[A-Za-z0-9_-]{20,}/ },
|
|
26
|
+
{ kind: 'aws-access-key', name: 'AWS access key id', regex: /\bAKIA[0-9A-Z]{16}\b/ },
|
|
27
|
+
{
|
|
28
|
+
kind: 'github-token',
|
|
29
|
+
name: 'GitHub token',
|
|
30
|
+
regex: /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}/,
|
|
31
|
+
},
|
|
32
|
+
{ kind: 'npm-token', name: 'npm access token', regex: /\bnpm_[A-Za-z0-9]{36}\b/ },
|
|
33
|
+
// the `.npmrc` incident class: a registry auth token written into a config
|
|
34
|
+
{ kind: 'npm-auth-token', name: 'npm registry authToken', regex: /:_authToken\s*=\s*['"`]?[\w.:/+=-]{20,}/ },
|
|
35
|
+
{ kind: 'docker-pat', name: 'Docker Hub access token', regex: /\bdckr_pat_[A-Za-z0-9_-]{20,}/ },
|
|
36
|
+
{ kind: 'stripe-live-key', name: 'Stripe live key', regex: /\b[sr]k_live_[A-Za-z0-9]{20,}/ },
|
|
37
|
+
{ kind: 'slack-token', name: 'Slack token', regex: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/ },
|
|
38
|
+
{ kind: 'sendgrid-key', name: 'SendGrid key', regex: /\bSG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{30,}/ },
|
|
39
|
+
{
|
|
40
|
+
kind: 'discord-webhook',
|
|
41
|
+
name: 'Discord webhook URL',
|
|
42
|
+
regex: /discord(?:app)?\.com\/api\/webhooks\/\d+\/[\w-]{60,}/,
|
|
43
|
+
},
|
|
44
|
+
{ kind: 'private-key', name: 'private key (PEM)', regex: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },
|
|
45
|
+
{
|
|
46
|
+
kind: 'db-url-password',
|
|
47
|
+
name: 'database connection string with a password',
|
|
48
|
+
regex: /\b(?:mongodb|postgres|postgresql|mysql|amqp|redis)(?:\+srv)?:\/\/[^\s'"/:@]+:[^\s'"@]+@/,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
kind: 'jwt',
|
|
52
|
+
name: 'JSON Web Token',
|
|
53
|
+
regex: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}\b/,
|
|
54
|
+
isNoisyInSource: true,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
//# sourceMappingURL=secret-key-patterns.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-key-patterns.const.js","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/secret-key-patterns.const.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;GAeG;AACU,QAAA,sBAAsB,GAAsC;IACvE,+DAA+D;IAC/D,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,6BAA6B,EAAE;IAC1F,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,g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,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,kEAAkE;QACzE,eAAe,EAAE,IAAI;KACtB;CACF,CAAC"}
|
|
@@ -25,6 +25,14 @@ export declare class DyFM_StoredSecret_Util {
|
|
|
25
25
|
* `...` preview. A `keyLength` ettol fuggetlenul mindig a nyers hossz.
|
|
26
26
|
*/
|
|
27
27
|
static derivePreview(rawSecret: string, reveal?: DyFM_SecretMask_PartialReveal_Interface): DyFM_StoredSecret_Preview_Interface;
|
|
28
|
+
/**
|
|
29
|
+
* 🔐 BFR-MICROWORK-003 — a finding's short form of a key: the first 4 characters and the length, never the rest
|
|
30
|
+
* (`sk-a... (51 chars)`). A detector's output (a finding, a log line, a report) carries this, so no output carries
|
|
31
|
+
* the value. Up to 8 characters nothing is shown (the first 4 would be half of it): `... (8 chars)`.
|
|
32
|
+
*
|
|
33
|
+
* @param rawSecret the found key-shaped text
|
|
34
|
+
*/
|
|
35
|
+
static fingerprint(rawSecret: string): string;
|
|
28
36
|
/**
|
|
29
37
|
* Egy DyFM_StoredSecret osszeallitasa a USER-SAJAT nyers secret-bol — a masked-reszt levezeti,
|
|
30
38
|
* az `encryptedValue`-t a HIVO adja (a host/auth titkositja a `FDP_PRIVATE_API_KEY_CRYPT_KEY`-jel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-secret.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/stored-secret.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uCAAuC,EACxC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,2FAA2F;AAC3F,MAAM,WAAW,mCAAmC;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAKD;;;;;GAKG;AACH,qBAAa,sBAAsB;IAEjC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAexD;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAClB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,uCAAwD,GAC/D,mCAAmC;IAoBtC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,uCAAuC,CAAC;KAClD,GAAG,iBAAiB;CAatB"}
|
|
1
|
+
{"version":3,"file":"stored-secret.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/stored-secret.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uCAAuC,EACxC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,2FAA2F;AAC3F,MAAM,WAAW,mCAAmC;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAKD;;;;;GAKG;AACH,qBAAa,sBAAsB;IAEjC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAexD;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAClB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,uCAAwD,GAC/D,mCAAmC;IAoBtC;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAM7C;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,uCAAuC,CAAC;KAClD,GAAG,iBAAiB;CAatB"}
|
|
@@ -52,6 +52,17 @@ class DyFM_StoredSecret_Util {
|
|
|
52
52
|
kind: kind,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* 🔐 BFR-MICROWORK-003 — a finding's short form of a key: the first 4 characters and the length, never the rest
|
|
57
|
+
* (`sk-a... (51 chars)`). A detector's output (a finding, a log line, a report) carries this, so no output carries
|
|
58
|
+
* the value. Up to 8 characters nothing is shown (the first 4 would be half of it): `... (8 chars)`.
|
|
59
|
+
*
|
|
60
|
+
* @param rawSecret the found key-shaped text
|
|
61
|
+
*/
|
|
62
|
+
static fingerprint(rawSecret) {
|
|
63
|
+
const preview = this.derivePreview(rawSecret, { prefix: 4, suffix: 0 });
|
|
64
|
+
return `${preview.maskedPreview} (${preview.keyLength} chars)`;
|
|
65
|
+
}
|
|
55
66
|
/**
|
|
56
67
|
* Egy DyFM_StoredSecret osszeallitasa a USER-SAJAT nyers secret-bol — a masked-reszt levezeti,
|
|
57
68
|
* az `encryptedValue`-t a HIVO adja (a host/auth titkositja a `FDP_PRIVATE_API_KEY_CRYPT_KEY`-jel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-secret.util.js","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/stored-secret.util.ts"],"names":[],"mappings":";;;AAAA,mFAGsD;AACtD,wFAA2E;AAS3E,mGAAmG;AACnG,MAAM,cAAc,GAA4C,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEzF;;;;;GAKG;AACH,MAAa,sBAAsB;IAEjC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,SAAiB;QACjC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,uCAAoB,EAAE,CAAC;YAC3C,mF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I,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAKZ;QACC,MAAM,OAAO,GACX,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC;QAElE,OAAO,IAAI,+CAAiB,CAAC;YAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"stored-secret.util.js","sourceRoot":"","sources":["../../../../src/_modules/security/_collections/stored-secret.util.ts"],"names":[],"mappings":";;;AAAA,mFAGsD;AACtD,wFAA2E;AAS3E,mGAAmG;AACnG,MAAM,cAAc,GAA4C,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEzF;;;;;GAKG;AACH,MAAa,sBAAsB;IAEjC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,SAAiB;QACjC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,uCAAoB,EAAE,CAAC;YAC3C,mFAAmF;YACnF,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;YAC5B,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBAClC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;gBAC5B,OAAO,OAAO,CAAC,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,MA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;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAKZ;QACC,MAAM,OAAO,GACX,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC;QAElE,OAAO,IAAI,+CAAiB,CAAC;YAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,CAAC;CACF;AAtFD,wDAsFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One key-shaped text pattern of the shared detection list (`DyFM_secretKeyPatterns`, BFR-MICROWORK-003).
|
|
3
|
+
*/
|
|
4
|
+
export interface DyFM_SecretKeyPattern_Interface {
|
|
5
|
+
/** A stable kebab-case id (`github-token`); a finding or a counter may carry it. */
|
|
6
|
+
kind: string;
|
|
7
|
+
/** The human name a finding shows (`GitHub token`). */
|
|
8
|
+
name: string;
|
|
9
|
+
/** The regex, WITHOUT the global flag (a scanner adds it, so no shared `lastIndex` state). */
|
|
10
|
+
regex: RegExp;
|
|
11
|
+
/**
|
|
12
|
+
* The format also appears in harmless source text often (a JWT in a test fixture or a doc), so a repository scanner
|
|
13
|
+
* may leave it out; a log, a diff or a build output check keeps it.
|
|
14
|
+
*/
|
|
15
|
+
isNoisyInSource?: boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=secret-key-pattern.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-key-pattern.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/security/_models/secret-key-pattern.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-key-pattern.interface.js","sourceRoot":"","sources":["../../../../src/_modules/security/_models/secret-key-pattern.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from './_models/stored-secret.control-model';
|
|
2
2
|
export * from './_collections/stored-secret.util';
|
|
3
|
+
export * from './_models/secret-key-pattern.interface';
|
|
4
|
+
export * from './_collections/secret-key-patterns.const';
|
|
5
|
+
export * from './_collections/secret-file.util';
|
|
3
6
|
export * from '../../_collections/utils/secret-mask.util';
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/security/index.ts"],"names":[],"mappings":"AAIA,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/security/index.ts"],"names":[],"mappings":"AAIA,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAElD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAGhD,cAAc,2CAA2C,CAAC"}
|
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
tslib_1.__exportStar(require("./_models/stored-secret.control-model"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./_collections/stored-secret.util"), exports);
|
|
9
|
+
// BFR-MICROWORK-003 — the key-shaped text patterns and the secret-file names: ONE list for every detector
|
|
10
|
+
tslib_1.__exportStar(require("./_models/secret-key-pattern.interface"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./_collections/secret-key-patterns.const"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./_collections/secret-file.util"), exports);
|
|
9
13
|
// a mar letezo univerzalis secret-maszkolas (log/output-redaction) is innen elerheto, egy helyrol
|
|
10
14
|
tslib_1.__exportStar(require("../../_collections/utils/secret-mask.util"), exports);
|
|
11
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/security/index.ts"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,iGAAiG;AACjG,iGAAiG;;;AAEjG,gFAAsD;AACtD,4EAAkD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/security/index.ts"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,iGAAiG;AACjG,iGAAiG;;;AAEjG,gFAAsD;AACtD,4EAAkD;AAClD,0GAA0G;AAC1G,iFAAuD;AACvD,mFAAyD;AACzD,0EAAgD;AAEhD,kGAAkG;AAClG,oFAA0D"}
|
|
@@ -12,6 +12,10 @@ import { DyFM_Log } from './log.util';
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export function DyFM_getConstructionStackLocation(level = 0) {
|
|
15
|
+
if (level < 0) {
|
|
16
|
+
DyFM_Log.warn(`Negative level parameter provided to DyFM_getConstructionStackLocation: ${level}.`, { level });
|
|
17
|
+
level = 0;
|
|
18
|
+
}
|
|
15
19
|
const stack = new Error().stack;
|
|
16
20
|
// Split the stack into lines and remove the first line (Error:)
|
|
17
21
|
let stackLines = stack?.split('\n')?.slice(2);
|
|
@@ -25,8 +29,8 @@ export function DyFM_getConstructionStackLocation(level = 0) {
|
|
|
25
29
|
if (isNaN(level)) {
|
|
26
30
|
throw new Error('level must be a number');
|
|
27
31
|
}
|
|
28
|
-
if (level) {
|
|
29
|
-
while (level) {
|
|
32
|
+
if (level > 0) {
|
|
33
|
+
while (level > 0) {
|
|
30
34
|
stackLines = stackLines?.filter(line => line !== constructorLine);
|
|
31
35
|
level--;
|
|
32
36
|
constructorLine = stackLines?.find(line => line &&
|
|
@@ -77,6 +81,10 @@ export function DyFM_getConstructionStackLocation(level = 0) {
|
|
|
77
81
|
* ```
|
|
78
82
|
*/
|
|
79
83
|
export function DyFM_getLocalStackLocation(level = 0) {
|
|
84
|
+
if (level < 0) {
|
|
85
|
+
DyFM_Log.warn(`Negative level parameter provided to DyFM_getLocalStackLocation: ${level}.`, { level });
|
|
86
|
+
level = 0;
|
|
87
|
+
}
|
|
80
88
|
let stack = new Error().stack;
|
|
81
89
|
// Split the stack into lines and remove the first line (Error:) and the second line (DyFM_getLocalStackLocation)
|
|
82
90
|
let stackLines = stack?.split('\n')?.slice(2);
|
|
@@ -88,8 +96,8 @@ export function DyFM_getLocalStackLocation(level = 0) {
|
|
|
88
96
|
if (isNaN(level)) {
|
|
89
97
|
throw new Error('level must be a number');
|
|
90
98
|
}
|
|
91
|
-
if (level) {
|
|
92
|
-
while (level) {
|
|
99
|
+
if (level > 0) {
|
|
100
|
+
while (level > 0) {
|
|
93
101
|
stackLines = stackLines?.filter(line => line !== locationLine);
|
|
94
102
|
level--;
|
|
95
103
|
locationLine = stackLines?.find(line => line &&
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔐 **BFR-MICROWORK-003 — the secret-file names, ONE list** *(the FAM `FAM_SecretExclude_Util` HARD patterns and the
|
|
3
|
+
* `micro-work` `secret-file.util.ts` held the same eight; a new one now reaches every detector)*.
|
|
4
|
+
*
|
|
5
|
+
* @description Matched on the file NAME, without the path. A `.env.example` / `.env.sample` / `.env.template` is a
|
|
6
|
+
* template, not a secret: `isSecretFile` says no to it unless the caller excludes templates too
|
|
7
|
+
* (`isEnvTemplateSecret: true`, the FAM index's choice).
|
|
8
|
+
*/
|
|
9
|
+
export class DyFM_SecretFile_Util {
|
|
10
|
+
/** The secret-file name patterns. */
|
|
11
|
+
static fileNamePatterns = [
|
|
12
|
+
/^\.env(\..*)?$/i,
|
|
13
|
+
/\.key$/i,
|
|
14
|
+
/\.pem$/i,
|
|
15
|
+
/\.p12$/i,
|
|
16
|
+
/\.pfx$/i,
|
|
17
|
+
/\.crt$/i,
|
|
18
|
+
/^id_rsa/i,
|
|
19
|
+
/^id_ed25519/i,
|
|
20
|
+
];
|
|
21
|
+
/** The `.env` templates: they show the keys, never the values. */
|
|
22
|
+
static envTemplatePattern = /^\.env\.(example|sample|template)$/i;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a file is a secret file, by its name.
|
|
25
|
+
*
|
|
26
|
+
* @param set.filePath the path or the bare name (both `/` and `\` separators)
|
|
27
|
+
* @param set.isEnvTemplateSecret also count the `.env` templates (default: no)
|
|
28
|
+
*/
|
|
29
|
+
static isSecretFile(set) {
|
|
30
|
+
const fileName = set.filePath.split(/[\\/]/).pop() ?? set.filePath;
|
|
31
|
+
if (!set.isEnvTemplateSecret && DyFM_SecretFile_Util.envTemplatePattern.test(fileName)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return DyFM_SecretFile_Util.fileNamePatterns.some((pattern) => pattern.test(fileName));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔐 **BFR-MICROWORK-003 — the key-shaped text patterns, ONE list for every detector** *(`dc rev` `no-secrets-in-repo`,
|
|
3
|
+
* `dc publish-check`, the FAM ingest, the micro-work gates)*.
|
|
4
|
+
*
|
|
5
|
+
* @description Measured 2026-11-18: five separate lists lived side by side (`dc rev` 12, `publish-check` 14, the FAM's
|
|
6
|
+
* `FAM_SecretContent_Util` in two copies, `micro-work` `MW_KeyPattern_Util` 9), and a fix to one (a missed key, a
|
|
7
|
+
* false positive) never reached the others. This is their union, each format at the bound the lists agreed on, or
|
|
8
|
+
* the wider one where they differed.
|
|
9
|
+
*
|
|
10
|
+
* Only formats that are a credential on their own sight: a generic "long random string" is left out on purpose (the
|
|
11
|
+
* noise would get the gate switched off, and a switched-off gate protects nothing). The name-based patterns
|
|
12
|
+
* (`apiKey: '…'`) stay with their detectors: each tunes its own context.
|
|
13
|
+
*
|
|
14
|
+
* The masking of logs (`DyFM_SECRET_PATTERNS`) is a different job (it also masks `Bearer …` and `NAME=value` pairs,
|
|
15
|
+
* which would be noise in source); it is not this list.
|
|
16
|
+
*/
|
|
17
|
+
export const DyFM_secretKeyPatterns = [
|
|
18
|
+
// Anthropic BEFORE OpenAI: `sk-ant-…` is the more specific one
|
|
19
|
+
{ kind: 'anthropic-key', name: 'Anthropic API key', regex: /\bsk-ant-[A-Za-z0-9_-]{20,}/ },
|
|
20
|
+
{ kind: 'openai-key', name: 'OpenAI API key', regex: /\bsk-(?!ant-)(?:proj-)?[A-Za-z0-9_-]{32,}/ },
|
|
21
|
+
{ kind: 'google-api-key', name: 'Google API key', regex: /\bAIza[0-9A-Za-z_-]{35}\b/ },
|
|
22
|
+
{ kind: 'google-oauth-secret', name: 'Google OAuth client secret', regex: /\bGOCSPX-[A-Za-z0-9_-]{20,}/ },
|
|
23
|
+
{ kind: 'aws-access-key', name: 'AWS access key id', regex: /\bAKIA[0-9A-Z]{16}\b/ },
|
|
24
|
+
{
|
|
25
|
+
kind: 'github-token',
|
|
26
|
+
name: 'GitHub token',
|
|
27
|
+
regex: /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}/,
|
|
28
|
+
},
|
|
29
|
+
{ kind: 'npm-token', name: 'npm access token', regex: /\bnpm_[A-Za-z0-9]{36}\b/ },
|
|
30
|
+
// the `.npmrc` incident class: a registry auth token written into a config
|
|
31
|
+
{ kind: 'npm-auth-token', name: 'npm registry authToken', regex: /:_authToken\s*=\s*['"`]?[\w.:/+=-]{20,}/ },
|
|
32
|
+
{ kind: 'docker-pat', name: 'Docker Hub access token', regex: /\bdckr_pat_[A-Za-z0-9_-]{20,}/ },
|
|
33
|
+
{ kind: 'stripe-live-key', name: 'Stripe live key', regex: /\b[sr]k_live_[A-Za-z0-9]{20,}/ },
|
|
34
|
+
{ kind: 'slack-token', name: 'Slack token', regex: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/ },
|
|
35
|
+
{ kind: 'sendgrid-key', name: 'SendGrid key', regex: /\bSG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{30,}/ },
|
|
36
|
+
{
|
|
37
|
+
kind: 'discord-webhook',
|
|
38
|
+
name: 'Discord webhook URL',
|
|
39
|
+
regex: /discord(?:app)?\.com\/api\/webhooks\/\d+\/[\w-]{60,}/,
|
|
40
|
+
},
|
|
41
|
+
{ kind: 'private-key', name: 'private key (PEM)', regex: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },
|
|
42
|
+
{
|
|
43
|
+
kind: 'db-url-password',
|
|
44
|
+
name: 'database connection string with a password',
|
|
45
|
+
regex: /\b(?:mongodb|postgres|postgresql|mysql|amqp|redis)(?:\+srv)?:\/\/[^\s'"/:@]+:[^\s'"@]+@/,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
kind: 'jwt',
|
|
49
|
+
name: 'JSON Web Token',
|
|
50
|
+
regex: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{6,}\b/,
|
|
51
|
+
isNoisyInSource: true,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
@@ -49,6 +49,17 @@ export class DyFM_StoredSecret_Util {
|
|
|
49
49
|
kind: kind,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* 🔐 BFR-MICROWORK-003 — a finding's short form of a key: the first 4 characters and the length, never the rest
|
|
54
|
+
* (`sk-a... (51 chars)`). A detector's output (a finding, a log line, a report) carries this, so no output carries
|
|
55
|
+
* the value. Up to 8 characters nothing is shown (the first 4 would be half of it): `... (8 chars)`.
|
|
56
|
+
*
|
|
57
|
+
* @param rawSecret the found key-shaped text
|
|
58
|
+
*/
|
|
59
|
+
static fingerprint(rawSecret) {
|
|
60
|
+
const preview = this.derivePreview(rawSecret, { prefix: 4, suffix: 0 });
|
|
61
|
+
return `${preview.maskedPreview} (${preview.keyLength} chars)`;
|
|
62
|
+
}
|
|
52
63
|
/**
|
|
53
64
|
* Egy DyFM_StoredSecret osszeallitasa a USER-SAJAT nyers secret-bol — a masked-reszt levezeti,
|
|
54
65
|
* az `encryptedValue`-t a HIVO adja (a host/auth titkositja a `FDP_PRIVATE_API_KEY_CRYPT_KEY`-jel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
// kozos forma (DyFM_StoredSecret) + decrypt-nelkuli preview-derive + a meglevo secret-maszkolas.
|
|
4
4
|
export * from './_models/stored-secret.control-model';
|
|
5
5
|
export * from './_collections/stored-secret.util';
|
|
6
|
+
// BFR-MICROWORK-003 — the key-shaped text patterns and the secret-file names: ONE list for every detector
|
|
7
|
+
export * from './_models/secret-key-pattern.interface';
|
|
8
|
+
export * from './_collections/secret-key-patterns.const';
|
|
9
|
+
export * from './_collections/secret-file.util';
|
|
6
10
|
// a mar letezo univerzalis secret-maszkolas (log/output-redaction) is innen elerheto, egy helyrol
|
|
7
11
|
export * from '../../_collections/utils/secret-mask.util';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/fsm-dynamo",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.204",
|
|
4
4
|
"description": "Full Stack Model Collection for Dynamic (NodeJS-Typescript) Framework called Dynamo, by Future Development Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "full-stack-package",
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
"uuid": "~11.1.1"
|
|
383
383
|
},
|
|
384
384
|
"devDependencies": {
|
|
385
|
-
"@futdevpro/dynamo-eslint": "1.20.
|
|
385
|
+
"@futdevpro/dynamo-eslint": "1.20.88",
|
|
386
386
|
"@types/jasmine": "~4.3.5",
|
|
387
387
|
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
388
388
|
"@typescript-eslint/parser": "^8.41.0",
|