field-redactor 1.0.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.
@@ -0,0 +1,28 @@
1
+ import { PrimitiveRedactorConfig } from './types';
2
+ /**
3
+ * Redacts primitive values based on the configuration provided in the constructor. Uses the redactor
4
+ * privded in the constructor to redact values, or a basic redactor which returns 'REDACTED' if no redactor
5
+ * provided. Null and undefined values are ignored by default.
6
+ */
7
+ export declare class PrimitiveRedactor {
8
+ private static DEFAULT_REDACTED_TEXT;
9
+ private ignoreBooleans;
10
+ private ignoreNullOrUndefined;
11
+ private redactor;
12
+ /**
13
+ * Creates a PrimitiveRedactor with the specified configuration.
14
+ * @param config The PrimitiveRedactor configuration which specifies the redactor to use, whether to
15
+ * ignore booleans, and whether to ignore null or undefined values.
16
+ */
17
+ constructor(config: PrimitiveRedactorConfig);
18
+ /**
19
+ * Redacts the primitive value based on the configuration provided in the constructor.
20
+ * @param value The value to redact.
21
+ * @returns The redacted value.
22
+ */
23
+ redactValue(value: any): Promise<any>;
24
+ private redactNullOrUndefinedValue;
25
+ private redactBoolean;
26
+ private redactAny;
27
+ }
28
+ //# sourceMappingURL=primitiveRedactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveRedactor.d.ts","sourceRoot":"","sources":["../src/primitiveRedactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAY,MAAM,SAAS,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAc;IAClD,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,qBAAqB,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAoF;IAEpG;;;;OAIG;gBACS,MAAM,EAAE,uBAAuB;IAY3C;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAUpC,0BAA0B;YAQ1B,aAAa;YAIb,SAAS;CAGxB"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PrimitiveRedactor = void 0;
13
+ /**
14
+ * Redacts primitive values based on the configuration provided in the constructor. Uses the redactor
15
+ * privded in the constructor to redact values, or a basic redactor which returns 'REDACTED' if no redactor
16
+ * provided. Null and undefined values are ignored by default.
17
+ */
18
+ class PrimitiveRedactor {
19
+ /**
20
+ * Creates a PrimitiveRedactor with the specified configuration.
21
+ * @param config The PrimitiveRedactor configuration which specifies the redactor to use, whether to
22
+ * ignore booleans, and whether to ignore null or undefined values.
23
+ */
24
+ constructor(config) {
25
+ this.redactor = (val) => Promise.resolve(PrimitiveRedactor.DEFAULT_REDACTED_TEXT);
26
+ if (config.redactor) {
27
+ this.redactor = config.redactor;
28
+ }
29
+ this.ignoreBooleans = !!(config === null || config === void 0 ? void 0 : config.ignoreBooleans);
30
+ if (typeof (config === null || config === void 0 ? void 0 : config.ignoreNullOrUndefined) === 'boolean') {
31
+ this.ignoreNullOrUndefined = config.ignoreNullOrUndefined;
32
+ }
33
+ else {
34
+ this.ignoreNullOrUndefined = true;
35
+ }
36
+ }
37
+ /**
38
+ * Redacts the primitive value based on the configuration provided in the constructor.
39
+ * @param value The value to redact.
40
+ * @returns The redacted value.
41
+ */
42
+ redactValue(value) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ if (typeof value === 'boolean') {
45
+ return this.redactBoolean(value);
46
+ }
47
+ else if (!value) {
48
+ return this.redactNullOrUndefinedValue(value);
49
+ }
50
+ return this.redactAny(value);
51
+ });
52
+ }
53
+ redactNullOrUndefinedValue(value) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ if (this.ignoreNullOrUndefined) {
56
+ const result = yield Promise.resolve(value);
57
+ return result;
58
+ }
59
+ return this.ignoreNullOrUndefined ? Promise.resolve(value) : this.redactor(value);
60
+ });
61
+ }
62
+ redactBoolean(value) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ return this.ignoreBooleans ? Promise.resolve(value) : this.redactor(value);
65
+ });
66
+ }
67
+ redactAny(value) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return this.redactor(value);
70
+ });
71
+ }
72
+ }
73
+ exports.PrimitiveRedactor = PrimitiveRedactor;
74
+ PrimitiveRedactor.DEFAULT_REDACTED_TEXT = 'REDACTED';
75
+ //# sourceMappingURL=primitiveRedactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveRedactor.js","sourceRoot":"","sources":["../src/primitiveRedactor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA;;;;GAIG;AACH,MAAa,iBAAiB;IAM5B;;;;OAIG;IACH,YAAY,MAA+B;QAPnC,aAAQ,GAAa,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;QAQlG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,CAAA,CAAC;QAC/C,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,CAAA,KAAK,SAAS,EAAE,CAAC;YACvD,I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
+ * Utility class for managing secrets and determining if a given value is a secret of any type. If no secrets of
4
+ * any type are provided in the configuration then all values are considered secrets (but not deep or full secrets).
5
+ */
6
+ export declare class SecretManager {
7
+ private secretKeys?;
8
+ private deepSecretKeys?;
9
+ private fullSecretKeys?;
10
+ constructor(config: SecretManagerConfig);
11
+ /**
12
+ * Determines if the given key is a secret. If no secrets of any type are provided then this function
13
+ * always returns true.
14
+ * @param key The key to check.
15
+ * @returns True if the key is a secret key or no secret keys exist, otherwise false.
16
+ */
17
+ isSecretKey(key: string): boolean;
18
+ /**
19
+ * Determines if a key is a deep secret based on the deepSecretKeys configuration provided in the constructor.
20
+ * @param key The key to check.
21
+ * @returns True if the key is a deep secret key, otherwise false.
22
+ */
23
+ isDeepSecretKey(key: string): boolean;
24
+ /**
25
+ * Determines if a key is a full secret based on the fullSecretKeys configuration provided in the constructor.
26
+ * @param key The key to check.
27
+ * @returns True if the key is a full secret key, otherwise false.
28
+ */
29
+ isFullSecretKey(key: string): boolean;
30
+ private static valueMatchesAnyRegexValue;
31
+ }
32
+ //# sourceMappingURL=secretManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secretManager.d.ts","sourceRoot":"","sources":["../src/secretManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAC,CAAW;IAC9B,OAAO,CAAC,cAAc,CAAC,CAAW;IAClC,OAAO,CAAC,cAAc,CAAC,CAAW;gBAEtB,MAAM,EAAE,mBAAmB;IAWvC;;;;;OAKG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAQxC;;;;OAIG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAQ5C;;;;OAIG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAQ5C,OAAO,CAAC,MAAM,CAAC,yBAAyB;CAGzC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecretManager = void 0;
4
+ /**
5
+ * Utility class for managing secrets and determining if a given value is a secret of any type. If no secrets of
6
+ * any type are provided in the configuration then all values are considered secrets (but not deep or full secrets).
7
+ */
8
+ class SecretManager {
9
+ constructor(config) {
10
+ this.deepSecretKeys = config.deepSecretKeys;
11
+ this.fullSecretKeys = config.fullSecretKeys;
12
+ if (!config.secretKeys && (config.deepSecretKeys || config.fullSecretKeys)) {
13
+ this.secretKeys = [];
14
+ }
15
+ else {
16
+ this.secretKeys = config.secretKeys;
17
+ }
18
+ }
19
+ /**
20
+ * Determines if the given key is a secret. If no secrets of any type are provided then this function
21
+ * always returns true.
22
+ * @param key The key to check.
23
+ * @returns True if the key is a secret key or no secret keys exist, otherwise false.
24
+ */
25
+ isSecretKey(key) {
26
+ if (!this.secretKeys) {
27
+ return true;
28
+ }
29
+ return SecretManager.valueMatchesAnyRegexValue(key, this.secretKeys);
30
+ }
31
+ /**
32
+ * Determines if a key is a deep secret based on the deepSecretKeys configuration provided in the constructor.
33
+ * @param key The key to check.
34
+ * @returns True if the key is a deep secret key, otherwise false.
35
+ */
36
+ isDeepSecretKey(key) {
37
+ if (!this.deepSecretKeys) {
38
+ return false;
39
+ }
40
+ return SecretManager.valueMatchesAnyRegexValue(key, this.deepSecretKeys);
41
+ }
42
+ /**
43
+ * Determines if a key is a full secret based on the fullSecretKeys configuration provided in the constructor.
44
+ * @param key The key to check.
45
+ * @returns True if the key is a full secret key, otherwise false.
46
+ */
47
+ isFullSecretKey(key) {
48
+ if (!this.fullSecretKeys) {
49
+ return false;
50
+ }
51
+ return SecretManager.valueMatchesAnyRegexValue(key, this.fullSecretKeys);
52
+ }
53
+ static valueMatchesAnyRegexValue(value, regexes) {
54
+ return regexes.some((regex) => regex.test(value));
55
+ }
56
+ }
57
+ exports.SecretManager = SecretManager;
58
+ //# sourceMappingURL=secretManager.js.map
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AC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;CACF;AA3DD,sCA2DC"}
@@ -0,0 +1,26 @@
1
+ export type Redactor = (value: any) => Promise<string>;
2
+ export declare enum CustomObjectMatchType {
3
+ Full = 0,
4
+ Deep = 1,
5
+ Shallow = 2,
6
+ Pass = 3,
7
+ Ignore = 4
8
+ }
9
+ export type CustomObject = {
10
+ [key: string]: CustomObjectMatchType | string;
11
+ };
12
+ export type PrimitiveRedactorConfig = {
13
+ redactor?: Redactor;
14
+ ignoreBooleans?: boolean;
15
+ ignoreNullOrUndefined?: boolean;
16
+ };
17
+ export type SecretManagerConfig = {
18
+ secretKeys?: RegExp[];
19
+ deepSecretKeys?: RegExp[];
20
+ fullSecretKeys?: RegExp[];
21
+ };
22
+ export type FieldRedactorConfig = PrimitiveRedactorConfig & SecretManagerConfig & {
23
+ redactor?: Redactor;
24
+ customObjects?: CustomObject[];
25
+ };
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvD,oBAAY,qBAAqB;IAC/B,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,MAAM,IAAA;CACP;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,GAAG,MAAM,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GACvD,mBAAmB,GAAG;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomObjectMatchType = void 0;
4
+ var CustomObjectMatchType;
5
+ (function (CustomObjectMatchType) {
6
+ CustomObjectMatchType[CustomObjectMatchType["Full"] = 0] = "Full";
7
+ CustomObjectMatchType[CustomObjectMatchType["Deep"] = 1] = "Deep";
8
+ CustomObjectMatchType[CustomObjectMatchType["Shallow"] = 2] = "Shallow";
9
+ CustomObjectMatchType[CustomObjectMatchType["Pass"] = 3] = "Pass";
10
+ CustomObjectMatchType[CustomObjectMatchType["Ignore"] = 4] = "Ignore";
11
+ })(CustomObjectMatchType || (exports.CustomObjectMatchType = CustomObjectMatchType = {}));
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,iEAAI,CAAA;IACJ,iEAAI,CAAA;IACJ,uEAAO,CAAA;IACP,iEAAI,CAAA;IACJ,qEAAM,CAAA;AACR,CAAC,EANW,qBAAqB,qCAArB,qBAAqB,QAMhC"}
package/jest.config.js ADDED
@@ -0,0 +1,20 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} **/
2
+ module.exports = {
3
+ testEnvironment: "node",
4
+ transform: {
5
+ "^.+.tsx?$": ["ts-jest",{}],
6
+ },
7
+ cacheDirectory: './tmp/jest-cache',
8
+ coverageDirectory: './tmp/jest-coverage',
9
+ coveragePathIgnorePatterns: ['./node_modules/', './tests/mocks/'],
10
+ collectCoverage: true,
11
+ coverageThreshold: {
12
+ global: {
13
+ branches: 90,
14
+ functions: 90,
15
+ lines: 90,
16
+ statements: 90
17
+ }
18
+ },
19
+ verbose: true,
20
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "field-redactor",
3
+ "version": "1.0.0",
4
+ "description": "Utility for redacting PII from complex JSON objects for which simpler redaction tools are insufficient.",
5
+ "author": {
6
+ "name": "Andrew Molony",
7
+ "url": "https://github.com/mologna"
8
+ },
9
+ "keywords": [
10
+ "redaction",
11
+ "pii",
12
+ "json",
13
+ "utility",
14
+ "redact"
15
+ ],
16
+ "homepage": "https://github.com/mologna/field-redactor",
17
+ "bugs": "https://github.com/mologna/field-redactor/issues",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/mologna/field-redactor"
21
+ },
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "scripts": {
25
+ "test": "jest",
26
+ "test:unit": "yarn test /tests/unit",
27
+ "test:integration": "yarn test /tests/integration",
28
+ "build": "tsc"
29
+ },
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "rfdc": "^1.4.1"
33
+ },
34
+ "devDependencies": {
35
+ "@types/jest": "^29.5.12",
36
+ "@types/node": "^22.10.5",
37
+ "jest": "^29.7.0",
38
+ "prettier": "^3.3.3",
39
+ "ts-jest": "^29.2.4",
40
+ "ts-node": "^10.9.2",
41
+ "tsc": "^2.0.4",
42
+ "typescript": "^5.7.2",
43
+ "yarn": "^1.22.22"
44
+ },
45
+ "prettier": {
46
+ "tabWidth": 2,
47
+ "singleQuote": true,
48
+ "trailingComma": "none",
49
+ "printWidth": 120
50
+ }
51
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Language and Environment */
6
+ "target": "es2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
7
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
8
+
9
+ /* Modules */
10
+ "module": "commonjs",
11
+ // "moduleResolution": "node",
12
+ "rootDir": "./src", /* Specify the root folder within your source files. */
13
+
14
+ /* Emit */
15
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
16
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
17
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
18
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
19
+ // "outFile": "index.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
20
+ "outDir": "./dist", /* Specify an output folder for all emitted files. */
21
+ // "removeComments": true, /* Disable emitting comments. */
22
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
23
+
24
+ /* Interop Constraints */
25
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
26
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
27
+ // "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
28
+
29
+ /* Type Checking */
30
+ "strict": true, /* Enable all strict type-checking options. */
31
+ "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
32
+ "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
33
+ "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
34
+ "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
35
+ "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
36
+ "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
37
+ "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
38
+ "allowUnreachableCode": false, /* Disable error reporting for unreachable code. */
39
+
40
+ /* Completeness */
41
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
42
+ },
43
+ "include": ["src/**/*"],
44
+ "exclude": ["tests/**/*"]
45
+ }