field-redactor 1.2.0 → 1.5.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/.github/workflows/ci.yml +38 -0
- package/CHANGELOG.md +156 -0
- package/README.md +64 -670
- package/dist/configValidator.d.ts +10 -0
- package/dist/configValidator.d.ts.map +1 -0
- package/dist/configValidator.js +94 -0
- package/dist/configValidator.js.map +1 -0
- package/dist/copyOnWriteHelpers.d.ts +20 -0
- package/dist/copyOnWriteHelpers.d.ts.map +1 -0
- package/dist/copyOnWriteHelpers.js +58 -0
- package/dist/copyOnWriteHelpers.js.map +1 -0
- package/dist/customObjectManager.d.ts +13 -7
- package/dist/customObjectManager.d.ts.map +1 -1
- package/dist/customObjectManager.js +30 -29
- package/dist/customObjectManager.js.map +1 -1
- package/dist/dryRun.d.ts +8 -0
- package/dist/dryRun.d.ts.map +1 -0
- package/dist/dryRun.js +75 -0
- package/dist/dryRun.js.map +1 -0
- package/dist/dryRunAttribution.d.ts +8 -0
- package/dist/dryRunAttribution.d.ts.map +1 -0
- package/dist/dryRunAttribution.js +106 -0
- package/dist/dryRunAttribution.js.map +1 -0
- package/dist/fieldRedactor.d.ts +43 -5
- package/dist/fieldRedactor.d.ts.map +1 -1
- package/dist/fieldRedactor.js +124 -24
- package/dist/fieldRedactor.js.map +1 -1
- package/dist/fieldRedactorConfigBuilder.d.ts +49 -0
- package/dist/fieldRedactorConfigBuilder.d.ts.map +1 -0
- package/dist/fieldRedactorConfigBuilder.js +98 -0
- package/dist/fieldRedactorConfigBuilder.js.map +1 -0
- package/dist/fieldRedactorDeps.d.ts +17 -0
- package/dist/fieldRedactorDeps.d.ts.map +1 -0
- package/dist/fieldRedactorDeps.js +41 -0
- package/dist/fieldRedactorDeps.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonWalk.d.ts +11 -0
- package/dist/jsonWalk.d.ts.map +1 -0
- package/dist/jsonWalk.js +86 -0
- package/dist/jsonWalk.js.map +1 -0
- package/dist/objectRedactor.d.ts +9 -34
- package/dist/objectRedactor.d.ts.map +1 -1
- package/dist/objectRedactor.js +11 -298
- package/dist/objectRedactor.js.map +1 -1
- package/dist/objectRedactorCow.d.ts +35 -0
- package/dist/objectRedactorCow.d.ts.map +1 -0
- package/dist/objectRedactorCow.js +300 -0
- package/dist/objectRedactorCow.js.map +1 -0
- package/dist/objectRedactorCustomObject.d.ts +49 -0
- package/dist/objectRedactorCustomObject.d.ts.map +1 -0
- package/dist/objectRedactorCustomObject.js +138 -0
- package/dist/objectRedactorCustomObject.js.map +1 -0
- package/dist/objectRedactorHelpers.d.ts +9 -0
- package/dist/objectRedactorHelpers.d.ts.map +1 -0
- package/dist/objectRedactorHelpers.js +58 -0
- package/dist/objectRedactorHelpers.js.map +1 -0
- package/dist/objectRedactorMutation.d.ts +10 -0
- package/dist/objectRedactorMutation.d.ts.map +1 -0
- package/dist/objectRedactorMutation.js +89 -0
- package/dist/objectRedactorMutation.js.map +1 -0
- package/dist/objectRedactorSync.d.ts +2 -0
- package/dist/objectRedactorSync.d.ts.map +1 -0
- package/dist/objectRedactorSync.js +7 -0
- package/dist/objectRedactorSync.js.map +1 -0
- package/dist/objectRedactorTraversal.d.ts +57 -0
- package/dist/objectRedactorTraversal.d.ts.map +1 -0
- package/dist/objectRedactorTraversal.js +576 -0
- package/dist/objectRedactorTraversal.js.map +1 -0
- package/dist/presets.d.ts +22 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +50 -0
- package/dist/presets.js.map +1 -0
- package/dist/primitiveRedactor.d.ts +13 -8
- package/dist/primitiveRedactor.d.ts.map +1 -1
- package/dist/primitiveRedactor.js +32 -27
- package/dist/primitiveRedactor.js.map +1 -1
- package/dist/redactionRules.d.ts +23 -0
- package/dist/redactionRules.d.ts.map +1 -0
- package/dist/redactionRules.js +76 -0
- package/dist/redactionRules.js.map +1 -0
- package/dist/regexUtils.d.ts +3 -0
- package/dist/regexUtils.d.ts.map +1 -0
- package/dist/regexUtils.js +8 -0
- package/dist/regexUtils.js.map +1 -0
- package/dist/secretManager.d.ts +12 -6
- package/dist/secretManager.d.ts.map +1 -1
- package/dist/secretManager.js +40 -14
- package/dist/secretManager.js.map +1 -1
- package/dist/types.d.ts +103 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/dist/valuePatternMatcher.d.ts +15 -0
- package/dist/valuePatternMatcher.d.ts.map +1 -0
- package/dist/valuePatternMatcher.js +30 -0
- package/dist/valuePatternMatcher.js.map +1 -0
- package/docs/guides/anti-patterns.md +107 -0
- package/docs/guides/metadata-redaction.md +112 -0
- package/docs/guides/migration-1.2-to-1.5.md +106 -0
- package/docs/guides/secret-key-modes.md +108 -0
- package/docs/guides/value-pattern-redaction.md +58 -0
- package/docs/reference/config.md +135 -0
- package/docs/release-notes/2.0.0.md +19 -0
- package/docs/release-notes/2.1.0.md +17 -0
- package/docs/release-notes/2.2.0.md +16 -0
- package/docs/release-notes/2.3.0.md +17 -0
- package/docs/release-notes/2.3.1.md +17 -0
- package/docs/release-notes/2.4.0.md +30 -0
- package/docs/release-notes/2.5.0.md +33 -0
- package/docs/release-notes/2.5.1.md +17 -0
- package/docs/release-notes/README.md +30 -0
- package/docs/release-notes/v1.0.0.md +17 -0
- package/docs/release-notes/v1.1.0.md +18 -0
- package/docs/release-notes/v1.2.0.md +18 -0
- package/docs/release-notes/v1.2.1.md +16 -0
- package/docs/release-notes/v1.2.2.md +19 -0
- package/docs/release-notes/v1.3.0.md +112 -0
- package/docs/release-notes/v1.5.0.md +88 -0
- package/jest.config.js +4 -1
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { hasExplicitRedactionRules } from './redactionRules';
|
|
2
|
+
import { CustomObject, FieldRedactorConfig } from './types';
|
|
3
|
+
export { hasExplicitRedactionRules };
|
|
4
|
+
export declare const assertNoIdenticalCustomObjectSchemas: (customObjects?: CustomObject[]) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Returns non-fatal configuration warnings. Throws {@link FieldRedactorConfigurationError} for
|
|
7
|
+
* invalid custom object duplicates and when `strict` is true on any warning.
|
|
8
|
+
*/
|
|
9
|
+
export declare const validateFieldRedactorConfig: (config?: FieldRedactorConfig) => string[];
|
|
10
|
+
//# sourceMappingURL=configValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configValidator.d.ts","sourceRoot":"","sources":["../src/configValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,yBAAyB,EAG1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAIrC,eAAO,MAAM,oCAAoC,mBAAoB,YAAY,EAAE,KAAG,IAgBrF,CAAC;AAoEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,YAAa,mBAAmB,KAAG,MAAM,EAiBhF,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFieldRedactorConfig = exports.assertNoIdenticalCustomObjectSchemas = exports.hasExplicitRedactionRules = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
const regexUtils_1 = require("./regexUtils");
|
|
6
|
+
const redactionRules_1 = require("./redactionRules");
|
|
7
|
+
Object.defineProperty(exports, "hasExplicitRedactionRules", { enumerable: true, get: function () { return redactionRules_1.hasExplicitRedactionRules; } });
|
|
8
|
+
const KEY_RULE_FIELDS = new Set(redactionRules_1.SECRET_REGEX_FIELDS);
|
|
9
|
+
const assertNoIdenticalCustomObjectSchemas = (customObjects) => {
|
|
10
|
+
if (!customObjects || customObjects.length <= 1) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
for (let i = 0; i < customObjects.length - 1; i++) {
|
|
14
|
+
const keys = Object.keys(customObjects[i]);
|
|
15
|
+
for (let j = i + 1; j < customObjects.length; j++) {
|
|
16
|
+
const otherKeys = Object.keys(customObjects[j]);
|
|
17
|
+
if (keys.length === otherKeys.length && keys.every((key) => otherKeys.includes(key))) {
|
|
18
|
+
throw new errors_1.FieldRedactorConfigurationError(`Custom Objects at indexes ${i} and ${j} cannot have identical keys: ${keys}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.assertNoIdenticalCustomObjectSchemas = assertNoIdenticalCustomObjectSchemas;
|
|
24
|
+
const collectRegexWarnings = (config) => {
|
|
25
|
+
const warnings = [];
|
|
26
|
+
const keyRuleDuplicates = new Map();
|
|
27
|
+
for (const field of redactionRules_1.REGEX_ARRAY_CONFIG_FIELDS) {
|
|
28
|
+
const regexes = config[field];
|
|
29
|
+
if (!regexes) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
for (const regex of regexes) {
|
|
33
|
+
if (regex.global) {
|
|
34
|
+
warnings.push(`Global regex ${(0, regexUtils_1.formatRegExp)(regex)} in \`${field}\` can produce surprising \`.test()\` results; remove the \`g\` flag.`);
|
|
35
|
+
}
|
|
36
|
+
if (!KEY_RULE_FIELDS.has(field)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const identity = (0, regexUtils_1.regexIdentity)(regex);
|
|
40
|
+
const prior = keyRuleDuplicates.get(identity);
|
|
41
|
+
if (prior && prior !== field) {
|
|
42
|
+
warnings.push(`${(0, regexUtils_1.formatRegExp)(regex)} appears in both \`${prior}\` and \`${field}\` — only the higher-precedence rule applies.`);
|
|
43
|
+
}
|
|
44
|
+
else if (!prior) {
|
|
45
|
+
keyRuleDuplicates.set(identity, field);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return warnings;
|
|
50
|
+
};
|
|
51
|
+
const collectSchemaWarnings = (customObjects) => {
|
|
52
|
+
const warnings = [];
|
|
53
|
+
customObjects.forEach((schema, schemaIndex) => {
|
|
54
|
+
for (const [field, rule] of Object.entries(schema)) {
|
|
55
|
+
if (typeof rule === 'string' && !Object.prototype.hasOwnProperty.call(schema, rule)) {
|
|
56
|
+
warnings.push(`Schema at index ${schemaIndex}: field \`${field}: '${rule}'\` references sibling key \`${rule}\` which is not defined in the schema.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
for (let i = 0; i < customObjects.length - 1; i++) {
|
|
61
|
+
const keysA = Object.keys(customObjects[i]);
|
|
62
|
+
for (let j = i + 1; j < customObjects.length; j++) {
|
|
63
|
+
const keysB = Object.keys(customObjects[j]);
|
|
64
|
+
const aSubsetOfB = keysA.length < keysB.length && keysA.every((key) => keysB.includes(key));
|
|
65
|
+
const bSubsetOfA = keysB.length < keysA.length && keysB.every((key) => keysA.includes(key));
|
|
66
|
+
if (aSubsetOfB || bSubsetOfA) {
|
|
67
|
+
warnings.push(`Schemas at index ${i} and ${j} may both match the same object; index ${keysB.length > keysA.length ? j : i} wins only when it has more keys.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return warnings;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Returns non-fatal configuration warnings. Throws {@link FieldRedactorConfigurationError} for
|
|
75
|
+
* invalid custom object duplicates and when `strict` is true on any warning.
|
|
76
|
+
*/
|
|
77
|
+
const validateFieldRedactorConfig = (config) => {
|
|
78
|
+
var _a;
|
|
79
|
+
const resolved = config !== null && config !== void 0 ? config : {};
|
|
80
|
+
(0, exports.assertNoIdenticalCustomObjectSchemas)(resolved.customObjects);
|
|
81
|
+
const warnings = [
|
|
82
|
+
...(!(0, redactionRules_1.hasExplicitRedactionRules)(resolved)
|
|
83
|
+
? ['All values will be redacted. Did you mean to set `secretKeys` or use `FieldRedactor.createSafe()`?']
|
|
84
|
+
: []),
|
|
85
|
+
...collectRegexWarnings(resolved),
|
|
86
|
+
...collectSchemaWarnings((_a = resolved.customObjects) !== null && _a !== void 0 ? _a : [])
|
|
87
|
+
];
|
|
88
|
+
if (resolved.strict && warnings[0]) {
|
|
89
|
+
throw new errors_1.FieldRedactorConfigurationError(warnings[0]);
|
|
90
|
+
}
|
|
91
|
+
return warnings;
|
|
92
|
+
};
|
|
93
|
+
exports.validateFieldRedactorConfig = validateFieldRedactorConfig;
|
|
94
|
+
//# sourceMappingURL=configValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configValidator.js","sourceRoot":"","sources":["../src/configValidator.ts"],"names":[],"mappings":";;;AAAA,qCAA2D;AAC3D,6CAA2D;AAC3D,qDAI0B;AAGjB,0GANP,0CAAyB,OAMO;AAElC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS,oCAAmB,CAAC,CAAC;AAEtD,MAAM,oCAAoC,GAAG,CAAC,aAA8B,EAAQ,EAAE;IAC3F,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAA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ue } from './types';
|
|
2
|
+
export type ObjectCopyState<T extends JsonObject> = {
|
|
3
|
+
source: T;
|
|
4
|
+
current: T;
|
|
5
|
+
copied: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type ArrayCopyState<T extends JsonArray> = {
|
|
8
|
+
source: T;
|
|
9
|
+
current: T;
|
|
10
|
+
copied: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const createObjectCopyState: <T extends JsonObject>(source: T) => ObjectCopyState<T>;
|
|
13
|
+
export declare const createArrayCopyState: <T extends JsonArray>(source: T) => ArrayCopyState<T>;
|
|
14
|
+
export declare const finishObjectCopy: <T extends JsonObject>(state: ObjectCopyState<T>) => T;
|
|
15
|
+
export declare const finishArrayCopy: <T extends JsonArray>(state: ArrayCopyState<T>) => T;
|
|
16
|
+
export declare const setObjectKey: <T extends JsonObject>(state: ObjectCopyState<T>, key: string, value: JsonValue | undefined) => void;
|
|
17
|
+
export declare const deleteObjectKey: <T extends JsonObject>(state: ObjectCopyState<T>, key: string) => void;
|
|
18
|
+
export declare const setArrayIndex: <T extends JsonArray>(state: ArrayCopyState<T>, index: number, value: JsonValue | undefined) => void;
|
|
19
|
+
export declare const deleteArrayIndex: <T extends JsonArray>(state: ArrayCopyState<T>, index: number) => void;
|
|
20
|
+
//# sourceMappingURL=copyOnWriteHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyOnWriteHelpers.d.ts","sourceRoot":"","sources":["../src/copyOnWriteHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAc,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI;IAClD,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,IAAI;IAChD,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,UAAU,UAAU,CAAC,KAAG,eAAe,CAAC,CAAC,CAIvF,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,SAAS,UAAU,CAAC,KAAG,cAAc,CAAC,CAAC,CAIpF,CAAC;AAEH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,UAAU,SAAS,eAAe,CAAC,CAAC,CAAC,KAAG,CACtC,CAAC;AAE9C,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,SAAS,SAAS,cAAc,CAAC,CAAC,CAAC,KAAG,CACnC,CAAC;AAoB9C,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,UAAU,SACxC,eAAe,CAAC,CAAC,CAAC,OACpB,MAAM,SACJ,SAAS,GAAG,SAAS,KAC3B,IAIF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,UAAU,SAAS,eAAe,CAAC,CAAC,CAAC,OAAO,MAAM,KAAG,IAI9F,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,SAAS,SACxC,cAAc,CAAC,CAAC,CAAC,SACjB,MAAM,SACN,SAAS,GAAG,SAAS,KAC3B,IAIF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,SAAS,SAAS,cAAc,CAAC,CAAC,CAAC,SAAS,MAAM,KAAG,IAI/F,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteArrayIndex = exports.setArrayIndex = exports.deleteObjectKey = exports.setObjectKey = exports.finishArrayCopy = exports.finishObjectCopy = exports.createArrayCopyState = exports.createObjectCopyState = void 0;
|
|
4
|
+
const createObjectCopyState = (source) => ({
|
|
5
|
+
source,
|
|
6
|
+
current: source,
|
|
7
|
+
copied: false
|
|
8
|
+
});
|
|
9
|
+
exports.createObjectCopyState = createObjectCopyState;
|
|
10
|
+
const createArrayCopyState = (source) => ({
|
|
11
|
+
source,
|
|
12
|
+
current: source,
|
|
13
|
+
copied: false
|
|
14
|
+
});
|
|
15
|
+
exports.createArrayCopyState = createArrayCopyState;
|
|
16
|
+
const finishObjectCopy = (state) => state.copied ? state.current : state.source;
|
|
17
|
+
exports.finishObjectCopy = finishObjectCopy;
|
|
18
|
+
const finishArrayCopy = (state) => state.copied ? state.current : state.source;
|
|
19
|
+
exports.finishArrayCopy = finishArrayCopy;
|
|
20
|
+
const ensureObjectCopy = (state) => {
|
|
21
|
+
if (!state.copied) {
|
|
22
|
+
state.current = Object.assign({}, state.source);
|
|
23
|
+
state.copied = true;
|
|
24
|
+
}
|
|
25
|
+
return state.current;
|
|
26
|
+
};
|
|
27
|
+
const ensureArrayCopy = (state) => {
|
|
28
|
+
if (!state.copied) {
|
|
29
|
+
state.current = state.source.slice();
|
|
30
|
+
state.copied = true;
|
|
31
|
+
}
|
|
32
|
+
return state.current;
|
|
33
|
+
};
|
|
34
|
+
const setObjectKey = (state, key, value) => {
|
|
35
|
+
if (state.source[key] !== value) {
|
|
36
|
+
ensureObjectCopy(state)[key] = value;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.setObjectKey = setObjectKey;
|
|
40
|
+
const deleteObjectKey = (state, key) => {
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(state.source, key)) {
|
|
42
|
+
delete ensureObjectCopy(state)[key];
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.deleteObjectKey = deleteObjectKey;
|
|
46
|
+
const setArrayIndex = (state, index, value) => {
|
|
47
|
+
if (state.source[index] !== value) {
|
|
48
|
+
ensureArrayCopy(state)[index] = value;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.setArrayIndex = setArrayIndex;
|
|
52
|
+
const deleteArrayIndex = (state, index) => {
|
|
53
|
+
if (index < state.source.length) {
|
|
54
|
+
delete ensureArrayCopy(state)[index];
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.deleteArrayIndex = deleteArrayIndex;
|
|
58
|
+
//# sourceMappingURL=copyOnWriteHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyOnWriteHelpers.js","sourceRoot":"","sources":["../src/copyOnWriteHelpers.ts"],"names":[],"mappings":";;;AAcO,MAAM,qBAAqB,GAAG,CAAuB,MAAS,EAAsB,EAAE,CAAC,CAAC;IAC7F,MAAM;IACN,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAJU,QAAA,qBAAqB,yBAI/B;AAEI,MAAM,oBAAoB,GAAG,CAAsB,MAAS,EAAqB,EAAE,CAAC,CAAC;IAC1F,MAAM;IACN,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAJU,QAAA,oBAAoB,wBAI9B;AAEI,MAAM,gBAAgB,GAAG,CAAuB,KAAyB,EAAK,EAAE,CACrF,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;AADjC,QAAA,gBAAgB,oBACiB;AAEvC,MAAM,eAAe,GAAG,CAAsB,KAAwB,EAAK,EAAE,CAClF,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;AADjC,QAAA,eAAe,mBACkB;AAE9C,MAAM,gBAAgB,GAAG,CAAuB,KAAyB,EAAc,EAAE;IACvF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,KAAK,CAAC,OAAO,qBAAQ,KAAK,CAAC,MAAM,CAAE,CAAC;QACpC,KAAK,CAAC,MAAM,GAAG,IAAI,C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,EAAE;IACrG,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;AACH,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { CustomObject } from './types';
|
|
1
|
+
import { CustomObject, MatchedSchemaReport } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Utility for determining if a given object matches a CustomObject schema.
|
|
4
|
+
* A value matches when it contains every key defined in the schema; additional keys on the value are allowed.
|
|
5
|
+
* When multiple schemas match, the schema with the most keys is selected.
|
|
4
6
|
*/
|
|
5
7
|
export declare class CustomObjectManager {
|
|
6
|
-
private customObjects;
|
|
8
|
+
private readonly customObjects;
|
|
9
|
+
private readonly schemaNames;
|
|
7
10
|
/**
|
|
8
11
|
* Creates a CustomObjectChecker with the specified CustomObjects.
|
|
9
12
|
* @param customObjects The CustomObjects to check against.
|
|
13
|
+
* @param schemaNames Optional labels parallel to `customObjects` for dry-run reports.
|
|
10
14
|
*/
|
|
11
|
-
constructor(customObjects?: CustomObject[]);
|
|
15
|
+
constructor(customObjects?: CustomObject[], schemaNames?: readonly (string | undefined)[]);
|
|
16
|
+
getSchemaIndex(schema: CustomObject): number;
|
|
17
|
+
getSchemaName(schemaIndex: number): string | undefined;
|
|
18
|
+
getSchemaMetadata(schema: CustomObject): Pick<MatchedSchemaReport, 'schemaIndex' | 'schemaName'>;
|
|
12
19
|
/**
|
|
13
20
|
* Determines if the input value matches any of the custom objects provided in the constructor.
|
|
21
|
+
* When multiple schemas match, returns the schema with the most keys.
|
|
14
22
|
* @param value The value to compare against the custom objects.
|
|
15
|
-
* @returns
|
|
23
|
+
* @returns The most specific matching custom object, otherwise undefined.
|
|
16
24
|
*/
|
|
17
|
-
getMatchingCustomObject(value:
|
|
25
|
+
getMatchingCustomObject(value: unknown): CustomObject | undefined;
|
|
18
26
|
private isCustomObject;
|
|
19
|
-
private objectHasExtraKeys;
|
|
20
|
-
private validateCustomObjects;
|
|
21
27
|
}
|
|
22
28
|
//# sourceMappingURL=customObjectManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customObjectManager.d.ts","sourceRoot":"","sources":["../src/customObjectManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customObjectManager.d.ts","sourceRoot":"","sources":["../src/customObjectManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGxE;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;IAE9D;;;;OAIG;gBACS,aAAa,CAAC,EAAE,YAAY,EAAE,EAAE,WAAW,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAMlF,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAI5C,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAItD,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC,mBAAmB,EAAE,aAAa,GAAG,YAAY,CAAC;IAMvG;;;;;OAKG;IACI,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS;IAiBxE,OAAO,CAAC,cAAc;CAOvB"}
|
|
@@ -1,58 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CustomObjectManager = void 0;
|
|
4
|
-
const
|
|
4
|
+
const configValidator_1 = require("./configValidator");
|
|
5
5
|
/**
|
|
6
6
|
* Utility for determining if a given object matches a CustomObject schema.
|
|
7
|
+
* A value matches when it contains every key defined in the schema; additional keys on the value are allowed.
|
|
8
|
+
* When multiple schemas match, the schema with the most keys is selected.
|
|
7
9
|
*/
|
|
8
10
|
class CustomObjectManager {
|
|
9
11
|
/**
|
|
10
12
|
* Creates a CustomObjectChecker with the specified CustomObjects.
|
|
11
13
|
* @param customObjects The CustomObjects to check against.
|
|
14
|
+
* @param schemaNames Optional labels parallel to `customObjects` for dry-run reports.
|
|
12
15
|
*/
|
|
13
|
-
constructor(customObjects) {
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
16
|
+
constructor(customObjects, schemaNames) {
|
|
17
|
+
(0, configValidator_1.assertNoIdenticalCustomObjectSchemas)(customObjects);
|
|
18
|
+
this.customObjects = customObjects !== null && customObjects !== void 0 ? customObjects : [];
|
|
19
|
+
this.schemaNames = schemaNames !== null && schemaNames !== void 0 ? schemaNames : [];
|
|
20
|
+
}
|
|
21
|
+
getSchemaIndex(schema) {
|
|
22
|
+
return this.customObjects.indexOf(schema);
|
|
23
|
+
}
|
|
24
|
+
getSchemaName(schemaIndex) {
|
|
25
|
+
return this.schemaNames[schemaIndex];
|
|
26
|
+
}
|
|
27
|
+
getSchemaMetadata(schema) {
|
|
28
|
+
const schemaIndex = this.getSchemaIndex(schema);
|
|
29
|
+
const schemaName = this.getSchemaName(schemaIndex);
|
|
30
|
+
return schemaName ? { schemaIndex, schemaName } : { schemaIndex };
|
|
17
31
|
}
|
|
18
32
|
/**
|
|
19
33
|
* Determines if the input value matches any of the custom objects provided in the constructor.
|
|
34
|
+
* When multiple schemas match, returns the schema with the most keys.
|
|
20
35
|
* @param value The value to compare against the custom objects.
|
|
21
|
-
* @returns
|
|
36
|
+
* @returns The most specific matching custom object, otherwise undefined.
|
|
22
37
|
*/
|
|
23
38
|
getMatchingCustomObject(value) {
|
|
39
|
+
let bestMatch;
|
|
40
|
+
let bestMatchKeyCount = -1;
|
|
24
41
|
for (const customObject of this.customObjects) {
|
|
25
42
|
if (this.isCustomObject(value, customObject)) {
|
|
26
|
-
|
|
43
|
+
const keyCount = Object.keys(customObject).length;
|
|
44
|
+
if (keyCount > bestMatchKeyCount) {
|
|
45
|
+
bestMatch = customObject;
|
|
46
|
+
bestMatchKeyCount = keyCount;
|
|
47
|
+
}
|
|
27
48
|
}
|
|
28
49
|
}
|
|
29
|
-
return
|
|
50
|
+
return bestMatch;
|
|
30
51
|
}
|
|
31
52
|
isCustomObject(value, customObject) {
|
|
32
53
|
if (typeof value !== 'object' || !value || Array.isArray(value)) {
|
|
33
54
|
return false;
|
|
34
55
|
}
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
objectHasExtraKeys(object, objectToCompareTo) {
|
|
38
|
-
return Object.keys(object).some((key) => !objectToCompareTo.hasOwnProperty(key));
|
|
39
|
-
}
|
|
40
|
-
validateCustomObjects(customObjects) {
|
|
41
|
-
if (!customObjects || customObjects.length <= 1) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
for (let i = 0; i < customObjects.length - 1; i++) {
|
|
45
|
-
const current = customObjects[i];
|
|
46
|
-
const keys = Object.keys(current);
|
|
47
|
-
for (let j = i + 1; j < customObjects.length; j++) {
|
|
48
|
-
const other = customObjects[j];
|
|
49
|
-
const otherKeys = Object.keys(other);
|
|
50
|
-
const commonKeys = keys.filter((key) => otherKeys.includes(key));
|
|
51
|
-
if (commonKeys.length === keys.length && commonKeys.length === otherKeys.length) {
|
|
52
|
-
throw new errors_1.FieldRedactorConfigurationError(`Custom Objects at indexes ${i} and ${j} cannot have identical keys: ${commonKeys}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
+
return Object.keys(customObject).every((key) => Object.prototype.hasOwnProperty.call(value, key));
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
exports.CustomObjectManager = CustomObjectManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customObjectManager.js","sourceRoot":"","sources":["../src/customObjectManager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"customObjectMan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AG,YAAY,CAAC;oBACzB,iBAAiB,GAAG,QAAQ,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,cAAc,CAAC,KAAc,EAAE,YAA0B;QAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACpG,CAAC;CACF;AA3DD,kDA2DC"}
|
package/dist/dryRun.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomObjectManager } from './customObjectManager';
|
|
2
|
+
import { SecretManager } from './secretManager';
|
|
3
|
+
import { ValuePatternMatcher } from './valuePatternMatcher';
|
|
4
|
+
import { DryRunReport, JsonValue } from './types';
|
|
5
|
+
export declare const createEmptyDryRunReport: () => DryRunReport;
|
|
6
|
+
export declare const EMPTY_DRY_RUN_REPORT: DryRunReport;
|
|
7
|
+
export declare const buildDryRunReport: (before: JsonValue | undefined, after: JsonValue | undefined, manager: CustomObjectManager, secretManager: SecretManager, valuePatternMatcher: ValuePatternMatcher) => DryRunReport;
|
|
8
|
+
//# sourceMappingURL=dryRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dryRun.d.ts","sourceRoot":"","sources":["../src/dryRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAgB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,MAAM,uBAAuB,QAAO,YAKzC,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,YAAwC,CAAC;AA0E5E,eAAO,MAAM,iBAAiB,WACpB,SAAS,GAAG,SAAS,SACtB,SAAS,GAAG,SAAS,WACnB,mBAAmB,iBACb,aAAa,uBACP,mBAAmB,KACvC,YAiBF,CAAC"}
|
package/dist/dryRun.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDryRunReport = exports.EMPTY_DRY_RUN_REPORT = exports.createEmptyDryRunReport = void 0;
|
|
4
|
+
const dryRunAttribution_1 = require("./dryRunAttribution");
|
|
5
|
+
const jsonWalk_1 = require("./jsonWalk");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const createEmptyDryRunReport = () => ({
|
|
8
|
+
redactedPaths: [],
|
|
9
|
+
deletedPaths: [],
|
|
10
|
+
matchedSchemas: [],
|
|
11
|
+
pathRules: []
|
|
12
|
+
});
|
|
13
|
+
exports.createEmptyDryRunReport = createEmptyDryRunReport;
|
|
14
|
+
exports.EMPTY_DRY_RUN_REPORT = (0, exports.createEmptyDryRunReport)();
|
|
15
|
+
const pushPath = (report, path, list) => {
|
|
16
|
+
if (path) {
|
|
17
|
+
report[list].push(path);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const diffRedaction = (before, after, path, report) => {
|
|
21
|
+
if (before === after) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!(0, jsonWalk_1.isTraversableJson)(before) || !(0, jsonWalk_1.isTraversableJson)(after)) {
|
|
25
|
+
pushPath(report, path, after === undefined && before !== undefined ? 'deletedPaths' : 'redactedPaths');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(before)) {
|
|
29
|
+
if (!Array.isArray(after)) {
|
|
30
|
+
pushPath(report, path, 'redactedPaths');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (let index = 0; index < Math.max(before.length, after.length); index++) {
|
|
34
|
+
if (!Object.prototype.hasOwnProperty.call(after, index) && Object.prototype.hasOwnProperty.call(before, index)) {
|
|
35
|
+
report.deletedPaths.push((0, jsonWalk_1.joinPath)(path, index));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
diffRedaction(before[index], after[index], (0, jsonWalk_1.joinPath)(path, index), report);
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!(0, types_1.isJsonObject)(before) || !(0, types_1.isJsonObject)(after)) {
|
|
43
|
+
pushPath(report, path, 'redactedPaths');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
for (const key of Object.keys(before)) {
|
|
47
|
+
const childPath = (0, jsonWalk_1.joinPath)(path, key);
|
|
48
|
+
if (!Object.prototype.hasOwnProperty.call(after, key)) {
|
|
49
|
+
report.deletedPaths.push(childPath);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
diffRedaction(before[key], after[key], childPath, report);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const collectMatchedSchemas = (value, manager, path, report) => {
|
|
57
|
+
(0, jsonWalk_1.walkTraversableJson)(value, path, (node, nodePath) => {
|
|
58
|
+
const schema = manager.getMatchingCustomObject(node);
|
|
59
|
+
if (!schema) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
report.matchedSchemas.push(Object.assign({ path: nodePath || '(root)' }, manager.getSchemaMetadata(schema)));
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const buildDryRunReport = (before, after, manager, secretManager, valuePatternMatcher) => {
|
|
66
|
+
const report = (0, exports.createEmptyDryRunReport)();
|
|
67
|
+
if (before !== undefined) {
|
|
68
|
+
diffRedaction(before, after, '', report);
|
|
69
|
+
collectMatchedSchemas(before, manager, '', report);
|
|
70
|
+
report.pathRules = (0, dryRunAttribution_1.buildPathRules)(before, report.redactedPaths, report.deletedPaths, secretManager, manager, valuePatternMatcher);
|
|
71
|
+
}
|
|
72
|
+
return report;
|
|
73
|
+
};
|
|
74
|
+
exports.buildDryRunReport = buildDryRunReport;
|
|
75
|
+
//# sourceMappingURL=dryRun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dryRun.js","sourceRoot":"","sources":["../src/dryRun.ts"],"names":[],"mappings":";;;AACA,2DAAqD;AACrD,yCAA8E;AAG9E,mCAAgE;AAEzD,MAAM,uBAAuB,GAAG,GAAiB,EAAE,CAAC,CAAC;IAC1D,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,EAAE;IAChB,cAAc,EAAE,EAAE;IAClB,SAAS,EAAE,EAAE;CACd,CAAC,CAAC;AALU,QAAA,uBAAuB,2BAKjC;AAEU,QAAA,oBAAoB,GAAiB,IAAA,+BAAuB,GAAE,CAAC;AAE5E,MAAM,QAAQ,GAAG,CAAC,MAAoB,EAAE,IAAY,EAAE,IAAsC,EAAQ,EAAE;IACpG,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CACpB,MAA6B,EAC7B,KAA4B,EAC5B,IAAY,EACZ,MAAoB,EACd,EAAE;IACR,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAA,4BAAiB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,4BAAiB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,C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N,MAAM,CAAC,aAAa,EACpB,MAAM,CAAC,YAAY,EACnB,aAAa,EACb,OAAO,EACP,mBAAmB,CACpB,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomObjectManager } from './customObjectManager';
|
|
2
|
+
import { SecretManager } from './secretManager';
|
|
3
|
+
import { ValuePatternMatcher } from './valuePatternMatcher';
|
|
4
|
+
import { DryRunPathRule, JsonValue } from './types';
|
|
5
|
+
export declare const attributeDeletePathRule: (before: JsonValue | undefined, path: string, secretManager: SecretManager) => DryRunPathRule;
|
|
6
|
+
export declare const attributeRedactPathRule: (before: JsonValue | undefined, path: string, secretManager: SecretManager, manager: CustomObjectManager, valuePatternMatcher: ValuePatternMatcher) => DryRunPathRule;
|
|
7
|
+
export declare const buildPathRules: (before: JsonValue | undefined, redactedPaths: readonly string[], deletedPaths: readonly string[], secretManager: SecretManager, manager: CustomObjectManager, valuePatternMatcher: ValuePatternMatcher) => DryRunPathRule[];
|
|
8
|
+
//# sourceMappingURL=dryRunAttribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dryRunAttribution.d.ts","sourceRoot":"","sources":["../src/dryRunAttribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,cAAc,EAGd,SAAS,EAGV,MAAM,SAAS,CAAC;AAkIjB,eAAO,MAAM,uBAAuB,WAC1B,SAAS,GAAG,SAAS,QACvB,MAAM,iBACG,aAAa,KAC3B,cAOF,CAAC;AAEF,eAAO,MAAM,uBAAuB,WAC1B,SAAS,GAAG,SAAS,QACvB,MAAM,iBACG,aAAa,WACnB,mBAAmB,uBACP,mBAAmB,KACvC,cAoBF,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,SAAS,GAAG,SAAS,iBACd,SAAS,MAAM,EAAE,gBAClB,SAAS,MAAM,EAAE,iBAChB,aAAa,WACnB,mBAAmB,uBACP,mBAAmB,KACvC,cAAc,EAGhB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPathRules = exports.attributeRedactPathRule = exports.attributeDeletePathRule = void 0;
|
|
4
|
+
const objectRedactorHelpers_1 = require("./objectRedactorHelpers");
|
|
5
|
+
const jsonWalk_1 = require("./jsonWalk");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const objectKeysFromPath = (segments) => segments.filter((segment) => typeof segment === 'string');
|
|
8
|
+
const toPathRule = (path, action, rule, extras = {}) => (Object.assign({ path, action, rule }, extras));
|
|
9
|
+
const patternForKey = (secretManager, key, rule) => secretManager.getKeyRulePattern(key, rule);
|
|
10
|
+
const attributeKeyRule = (path, action, key, secretManager) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const rule = (_a = secretManager.classifyKeyRule(key)) !== null && _a !== void 0 ? _a : 'default';
|
|
13
|
+
if (rule === 'default') {
|
|
14
|
+
return toPathRule(path, action, rule);
|
|
15
|
+
}
|
|
16
|
+
return toPathRule(path, action, rule, { pattern: patternForKey(secretManager, key, rule) });
|
|
17
|
+
};
|
|
18
|
+
const trySchemaRule = ({ before, path, segments, secretManager, manager }) => {
|
|
19
|
+
const { parent, leaf } = (0, jsonWalk_1.getParentContext)(before, segments);
|
|
20
|
+
if (!(0, types_1.isJsonObject)(parent) || typeof leaf !== 'string') {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const schema = manager.getMatchingCustomObject(parent);
|
|
24
|
+
if (!schema || !(leaf in schema)) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
let pattern;
|
|
28
|
+
if (typeof schema[leaf] === 'string') {
|
|
29
|
+
const siblingSpecifier = (0, objectRedactorHelpers_1.getStringSpecifiedCustomObjectSecretKeyValueIfExists)(parent, schema, leaf);
|
|
30
|
+
if (siblingSpecifier !== undefined) {
|
|
31
|
+
const siblingRule = secretManager.classifyKeyRule(siblingSpecifier);
|
|
32
|
+
if (siblingRule && siblingRule !== 'default') {
|
|
33
|
+
pattern = patternForKey(secretManager, siblingSpecifier, siblingRule);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return toPathRule(path, 'redact', 'schema', Object.assign(Object.assign({}, manager.getSchemaMetadata(schema)), (pattern ? { pattern } : {})));
|
|
38
|
+
};
|
|
39
|
+
const tryEnclosingOpaqueOrDeep = ({ path, objectKeys, secretManager }) => {
|
|
40
|
+
for (let index = objectKeys.length - 2; index >= 0; index--) {
|
|
41
|
+
const key = objectKeys[index];
|
|
42
|
+
const rule = secretManager.classifyKeyRule(key);
|
|
43
|
+
if (rule === 'opaque' || rule === 'deep') {
|
|
44
|
+
return toPathRule(path, 'redact', rule, { pattern: patternForKey(secretManager, key, rule) });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
};
|
|
49
|
+
const tryLeafKeyRule = ({ path, objectKeys, secretManager }) => {
|
|
50
|
+
const leafKey = objectKeys.at(-1);
|
|
51
|
+
if (!leafKey || !secretManager.classifyKeyRule(leafKey)) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return attributeKeyRule(path, 'redact', leafKey, secretManager);
|
|
55
|
+
};
|
|
56
|
+
const tryValuePatternRule = ({ before, path, segments, valuePatternMatcher }) => {
|
|
57
|
+
const value = (0, jsonWalk_1.getJsonValueAtPath)(before, segments);
|
|
58
|
+
if (value === undefined || (typeof value !== 'string' && typeof value !== 'number')) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const match = valuePatternMatcher.findMatching((0, objectRedactorHelpers_1.toRedactablePrimitive)(value));
|
|
62
|
+
if (!match) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return toPathRule(path, 'redact', 'value', { pattern: valuePatternMatcher.formatPattern(match) });
|
|
66
|
+
};
|
|
67
|
+
const REDACT_RULE_RESOLVERS = [
|
|
68
|
+
trySchemaRule,
|
|
69
|
+
tryEnclosingOpaqueOrDeep,
|
|
70
|
+
tryLeafKeyRule,
|
|
71
|
+
tryValuePatternRule
|
|
72
|
+
];
|
|
73
|
+
const attributeDeletePathRule = (before, path, secretManager) => {
|
|
74
|
+
const deleteKey = objectKeysFromPath((0, jsonWalk_1.parseJsonPath)(path)).at(-1);
|
|
75
|
+
if (deleteKey) {
|
|
76
|
+
return attributeKeyRule(path, 'delete', deleteKey, secretManager);
|
|
77
|
+
}
|
|
78
|
+
return toPathRule(path, 'delete', 'default');
|
|
79
|
+
};
|
|
80
|
+
exports.attributeDeletePathRule = attributeDeletePathRule;
|
|
81
|
+
const attributeRedactPathRule = (before, path, secretManager, manager, valuePatternMatcher) => {
|
|
82
|
+
const segments = (0, jsonWalk_1.parseJsonPath)(path);
|
|
83
|
+
const context = {
|
|
84
|
+
before,
|
|
85
|
+
path,
|
|
86
|
+
segments,
|
|
87
|
+
objectKeys: objectKeysFromPath(segments),
|
|
88
|
+
secretManager,
|
|
89
|
+
manager,
|
|
90
|
+
valuePatternMatcher
|
|
91
|
+
};
|
|
92
|
+
for (const resolve of REDACT_RULE_RESOLVERS) {
|
|
93
|
+
const rule = resolve(context);
|
|
94
|
+
if (rule) {
|
|
95
|
+
return rule;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return toPathRule(path, 'redact', 'default');
|
|
99
|
+
};
|
|
100
|
+
exports.attributeRedactPathRule = attributeRedactPathRule;
|
|
101
|
+
const buildPathRules = (before, redactedPaths, deletedPaths, secretManager, manager, valuePatternMatcher) => [
|
|
102
|
+
...deletedPaths.map((path) => (0, exports.attributeDeletePathRule)(before, path, secretManager)),
|
|
103
|
+
...redactedPaths.map((path) => (0, exports.attributeRedactPathRule)(before, path, secretManager, manager, valuePatternMatcher))
|
|
104
|
+
];
|
|
105
|
+
exports.buildPathRules = buildPathRules;
|
|
106
|
+
//# sourceMappingURL=dryRunAttribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dryRunAttribution.js","sourceRoot":"","sources":["../src/dryRunAttribution.ts"],"names":[],"mappings":";;;AACA,mEAAsH;AACtH,yCAAiF;AAGjF,mCAOiB;AAcjB,MAAM,kBAAkB,GAAG,CAAC,QAAgC,EAAY,EAAE,CACxE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAqB,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC;AAE/E,MAAM,UAAU,GAAG,CACjB,IAAY,EACZ,MAAgC,EAChC,IAAwB,EACxB,SAAkF,EAAE,EACpE,EAAE,CAAC,iBAAG,IAAI,EAAE,MAAM,EAAE,IAAI,IAAK,MAAM,EAAG,CAAC;AAEzD,MAAM,aAAa,GAAG,CAAC,aAA4B,EAAE,GAAyB,EAAE,IAAa,EAAsB,EAAE,CACnH,aAAa,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAE7C,MAAM,gBAAgB,GAAG,CACvB,IAAY,EACZ,MAAgC,EAChC,GAAyB,EACzB,aAA4B,EACZ,EAAE;;IAClB,MAAM,IAAI,GAAG,MAAA,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAC;IAC7D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,GAAG,EAAE,IAAI,CA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