field-redactor 1.6.2 → 1.6.3
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/publish.yml +55 -0
- package/CHANGELOG.md +17 -0
- package/CONTRIBUTING.md +23 -2
- package/README.md +1 -0
- package/dist/api/fieldRedactor.d.ts +3 -3
- package/dist/api/fieldRedactor.js +4 -4
- package/dist/api/fieldRedactor.js.map +1 -1
- package/dist/config/configValidator.d.ts.map +1 -1
- package/dist/config/configValidator.js +16 -0
- package/dist/config/configValidator.js.map +1 -1
- package/dist/types.d.ts +27 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/guides/migration-1.5-to-1.6.md +4 -3
- package/docs/release-notes/README.md +4 -1
- package/docs/release-notes/v1.6.3.md +25 -0
- package/examples/README.md +14 -0
- package/examples/dry-run.ts +21 -0
- package/examples/logging-metadata.ts +18 -0
- package/examples/path-rules.ts +23 -0
- package/examples/value-patterns.ts +16 -0
- package/package.json +1 -1
- package/dist/arrayRedaction.d.ts +0 -12
- package/dist/arrayRedaction.d.ts.map +0 -1
- package/dist/arrayRedaction.js +0 -70
- package/dist/arrayRedaction.js.map +0 -1
- package/dist/configValidator.d.ts +0 -9
- package/dist/configValidator.d.ts.map +0 -1
- package/dist/configValidator.js +0 -77
- package/dist/configValidator.js.map +0 -1
- package/dist/copyOnWriteHelpers.d.ts +0 -20
- package/dist/copyOnWriteHelpers.d.ts.map +0 -1
- package/dist/copyOnWriteHelpers.js +0 -58
- package/dist/copyOnWriteHelpers.js.map +0 -1
- package/dist/customObjectFieldHandler.d.ts +0 -21
- package/dist/customObjectFieldHandler.d.ts.map +0 -1
- package/dist/customObjectFieldHandler.js +0 -159
- package/dist/customObjectFieldHandler.js.map +0 -1
- package/dist/customObjectManager.d.ts +0 -28
- package/dist/customObjectManager.d.ts.map +0 -1
- package/dist/customObjectManager.js +0 -60
- package/dist/customObjectManager.js.map +0 -1
- package/dist/customObjectSchemas.d.ts +0 -7
- package/dist/customObjectSchemas.d.ts.map +0 -1
- package/dist/customObjectSchemas.js +0 -35
- package/dist/customObjectSchemas.js.map +0 -1
- package/dist/dryRun.d.ts +0 -9
- package/dist/dryRun.d.ts.map +0 -1
- package/dist/dryRun.js +0 -75
- package/dist/dryRun.js.map +0 -1
- package/dist/dryRunAttribution.d.ts +0 -10
- package/dist/dryRunAttribution.d.ts.map +0 -1
- package/dist/dryRunAttribution.js +0 -14
- package/dist/dryRunAttribution.js.map +0 -1
- package/dist/dryrun/dryRunAttribution.d.ts +0 -10
- package/dist/dryrun/dryRunAttribution.d.ts.map +0 -1
- package/dist/dryrun/dryRunAttribution.js +0 -14
- package/dist/dryrun/dryRunAttribution.js.map +0 -1
- package/dist/engine/objectRedactor.d.ts +0 -18
- package/dist/engine/objectRedactor.d.ts.map +0 -1
- package/dist/engine/objectRedactor.js +0 -38
- package/dist/engine/objectRedactor.js.map +0 -1
- package/dist/engine/objectRedactorSync.d.ts +0 -2
- package/dist/engine/objectRedactorSync.d.ts.map +0 -1
- package/dist/engine/objectRedactorSync.js +0 -7
- package/dist/engine/objectRedactorSync.js.map +0 -1
- package/dist/fieldDisposition.d.ts +0 -3
- package/dist/fieldDisposition.d.ts.map +0 -1
- package/dist/fieldDisposition.js +0 -6
- package/dist/fieldDisposition.js.map +0 -1
- package/dist/fieldRedactor.d.ts +0 -51
- package/dist/fieldRedactor.d.ts.map +0 -1
- package/dist/fieldRedactor.js +0 -165
- package/dist/fieldRedactor.js.map +0 -1
- package/dist/fieldRedactorConfigBuilder.d.ts +0 -55
- package/dist/fieldRedactorConfigBuilder.d.ts.map +0 -1
- package/dist/fieldRedactorConfigBuilder.js +0 -111
- package/dist/fieldRedactorConfigBuilder.js.map +0 -1
- package/dist/fieldRedactorDeps.d.ts +0 -19
- package/dist/fieldRedactorDeps.d.ts.map +0 -1
- package/dist/fieldRedactorDeps.js +0 -43
- package/dist/fieldRedactorDeps.js.map +0 -1
- package/dist/jsonWalk.d.ts +0 -11
- package/dist/jsonWalk.d.ts.map +0 -1
- package/dist/jsonWalk.js +0 -55
- package/dist/jsonWalk.js.map +0 -1
- package/dist/maybeAsync.d.ts +0 -7
- package/dist/maybeAsync.d.ts.map +0 -1
- package/dist/maybeAsync.js +0 -56
- package/dist/maybeAsync.js.map +0 -1
- package/dist/objectRedactor.d.ts +0 -18
- package/dist/objectRedactor.d.ts.map +0 -1
- package/dist/objectRedactor.js +0 -38
- package/dist/objectRedactor.js.map +0 -1
- package/dist/objectRedactorCow.d.ts +0 -35
- package/dist/objectRedactorCow.d.ts.map +0 -1
- package/dist/objectRedactorCow.js +0 -300
- package/dist/objectRedactorCow.js.map +0 -1
- package/dist/objectRedactorCustomObject.d.ts +0 -28
- package/dist/objectRedactorCustomObject.d.ts.map +0 -1
- package/dist/objectRedactorCustomObject.js +0 -57
- package/dist/objectRedactorCustomObject.js.map +0 -1
- package/dist/objectRedactorHelpers.d.ts +0 -9
- package/dist/objectRedactorHelpers.d.ts.map +0 -1
- package/dist/objectRedactorHelpers.js +0 -61
- package/dist/objectRedactorHelpers.js.map +0 -1
- package/dist/objectRedactorMutation.d.ts +0 -10
- package/dist/objectRedactorMutation.d.ts.map +0 -1
- package/dist/objectRedactorMutation.js +0 -89
- package/dist/objectRedactorMutation.js.map +0 -1
- package/dist/objectRedactorSync.d.ts +0 -2
- package/dist/objectRedactorSync.d.ts.map +0 -1
- package/dist/objectRedactorSync.js +0 -7
- package/dist/objectRedactorSync.js.map +0 -1
- package/dist/objectRedactorTraversal.d.ts +0 -41
- package/dist/objectRedactorTraversal.d.ts.map +0 -1
- package/dist/objectRedactorTraversal.js +0 -201
- package/dist/objectRedactorTraversal.js.map +0 -1
- package/dist/pathParsing.d.ts +0 -11
- package/dist/pathParsing.d.ts.map +0 -1
- package/dist/pathParsing.js +0 -53
- package/dist/pathParsing.js.map +0 -1
- package/dist/pathRuleMatcher.d.ts +0 -19
- package/dist/pathRuleMatcher.d.ts.map +0 -1
- package/dist/pathRuleMatcher.js +0 -42
- package/dist/pathRuleMatcher.js.map +0 -1
- package/dist/presets.d.ts +0 -22
- package/dist/presets.d.ts.map +0 -1
- package/dist/presets.js +0 -50
- package/dist/presets.js.map +0 -1
- package/dist/primitiveRedactor.d.ts +0 -33
- package/dist/primitiveRedactor.d.ts.map +0 -1
- package/dist/primitiveRedactor.js +0 -75
- package/dist/primitiveRedactor.js.map +0 -1
- package/dist/redactionRules.d.ts +0 -22
- package/dist/redactionRules.d.ts.map +0 -1
- package/dist/redactionRules.js +0 -74
- package/dist/redactionRules.js.map +0 -1
- package/dist/regexUtils.d.ts +0 -3
- package/dist/regexUtils.d.ts.map +0 -1
- package/dist/regexUtils.js +0 -8
- package/dist/regexUtils.js.map +0 -1
- package/dist/ruleResolver.d.ts +0 -65
- package/dist/ruleResolver.d.ts.map +0 -1
- package/dist/ruleResolver.js +0 -193
- package/dist/ruleResolver.js.map +0 -1
- package/dist/rules/fieldDisposition.d.ts +0 -3
- package/dist/rules/fieldDisposition.d.ts.map +0 -1
- package/dist/rules/fieldDisposition.js +0 -6
- package/dist/rules/fieldDisposition.js.map +0 -1
- package/dist/secretManager.d.ts +0 -32
- package/dist/secretManager.d.ts.map +0 -1
- package/dist/secretManager.js +0 -85
- package/dist/secretManager.js.map +0 -1
- package/dist/traversalServices.d.ts +0 -21
- package/dist/traversalServices.d.ts.map +0 -1
- package/dist/traversalServices.js +0 -3
- package/dist/traversalServices.js.map +0 -1
- package/dist/valuePatternMatcher.d.ts +0 -15
- package/dist/valuePatternMatcher.d.ts.map +0 -1
- package/dist/valuePatternMatcher.js +0 -30
- package/dist/valuePatternMatcher.js.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Publish to npm when a version tag is pushed (e.g. v1.6.3).
|
|
2
|
+
# Uses npm Trusted Publishing (OIDC) — no NPM_TOKEN secret.
|
|
3
|
+
#
|
|
4
|
+
# One-time setup on npmjs.com → package Settings → Trusted Publisher:
|
|
5
|
+
# Provider: GitHub Actions
|
|
6
|
+
# Repository: mologna/field-redactor
|
|
7
|
+
# Workflow filename: publish.yml (filename only, must match exactly)
|
|
8
|
+
#
|
|
9
|
+
# Requires npm CLI ≥ 11.5.1 and Node ≥ 22.14 (ensured in this job).
|
|
10
|
+
# Pin npm to the 11.x line — npm@latest (12+) needs newer Node than the OIDC minimum.
|
|
11
|
+
name: Publish
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
push:
|
|
15
|
+
tags:
|
|
16
|
+
- 'v*.*.*'
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
id-token: write # Required for OIDC trusted publishing
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
publish:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
timeout-minutes: 15
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
29
|
+
|
|
30
|
+
- name: Setup Node.js
|
|
31
|
+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
32
|
+
with:
|
|
33
|
+
# npm docs recommend Node 24 for trusted publishing; includes a recent npm.
|
|
34
|
+
node-version: '24'
|
|
35
|
+
cache: yarn
|
|
36
|
+
registry-url: https://registry.npmjs.org
|
|
37
|
+
|
|
38
|
+
- name: Ensure npm supports OIDC trusted publishing
|
|
39
|
+
run: npm install -g npm@11
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: yarn install --frozen-lockfile --non-interactive
|
|
43
|
+
|
|
44
|
+
- name: Build
|
|
45
|
+
run: yarn build
|
|
46
|
+
|
|
47
|
+
- name: Test
|
|
48
|
+
run: yarn test
|
|
49
|
+
|
|
50
|
+
# Do not set NODE_AUTH_TOKEN — the CLI uses OIDC when id-token permission is present.
|
|
51
|
+
# setup-node may inject a placeholder; clear it so publish prefers OIDC.
|
|
52
|
+
- name: Publish
|
|
53
|
+
run: npm publish --access public
|
|
54
|
+
env:
|
|
55
|
+
NODE_AUTH_TOKEN: ''
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.6.3] - 2026-07-27
|
|
9
|
+
|
|
10
|
+
DX and release-hygiene patch: examples, legacy naming warnings, OIDC publish workflow, and test cleanup. See [docs/release-notes/v1.6.3.md](docs/release-notes/v1.6.3.md).
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Examples** — [examples/](examples/) recipes for logging metadata, path rules, value patterns, and dry-run.
|
|
15
|
+
- **Publish workflow** — tag-triggered `.github/workflows/publish.yml` using npm Trusted Publishing (OIDC).
|
|
16
|
+
- **Legacy naming warnings** — constructing with `fullSecretKeys` / `deleteSecretKeys` emits deprecation warnings (behavior unchanged).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `createSafe` error text prefers Opaque/Remove field names.
|
|
21
|
+
- Incidental JSON/engine types marked `@internal` in JSDoc (still exported).
|
|
22
|
+
- Slimmed overlapping dry-run attribution tests; contract suite remains the SSOT.
|
|
23
|
+
|
|
8
24
|
## [1.6.2] - 2026-07-22
|
|
9
25
|
|
|
10
26
|
Canonical Opaque/Remove naming internally and removal of the thin `ObjectRedactor` orchestrator. See [docs/release-notes/v1.6.2.md](docs/release-notes/v1.6.2.md).
|
|
@@ -197,6 +213,7 @@ Development tags `2.0.0`–`2.3.1` track incremental work toward `1.3.0`. See [d
|
|
|
197
213
|
|
|
198
214
|
- Initial public release: regex key rules, custom object schemas with sibling-key indirection, async `redact()` / `redactInPlace()`, and configurable redactor functions.
|
|
199
215
|
|
|
216
|
+
[1.6.3]: https://github.com/mologna/field-redactor/compare/v1.6.2...v1.6.3
|
|
200
217
|
[1.6.2]: https://github.com/mologna/field-redactor/compare/v1.6.1...v1.6.2
|
|
201
218
|
[1.6.1]: https://github.com/mologna/field-redactor/compare/v1.6.0...v1.6.1
|
|
202
219
|
[1.6.0]: https://github.com/mologna/field-redactor/compare/v1.5.0...v1.6.0
|
package/CONTRIBUTING.md
CHANGED
|
@@ -42,8 +42,8 @@ Traversal and dry-run attribution both use this module. When adding a rule type,
|
|
|
42
42
|
|------|-------------------------|----------------|
|
|
43
43
|
| Shallow | `secretKeys`, `CustomObjectMatchType.Shallow` | — |
|
|
44
44
|
| Deep | `deepSecretKeys` | — |
|
|
45
|
-
| Opaque | `opaqueSecretKeys`, `CustomObjectMatchType.Opaque`, `isOpaqueSecretKey` | `fullSecretKeys`, `Full` |
|
|
46
|
-
| Remove | `removeSecretKeys`, `CustomObjectMatchType.Remove`, `isRemoveSecretKey` | `deleteSecretKeys`, `Delete` |
|
|
45
|
+
| Opaque | `opaqueSecretKeys`, `CustomObjectMatchType.Opaque`, `isOpaqueSecretKey` | `fullSecretKeys`, `Full` (deprecated; config fields warn at construct) |
|
|
46
|
+
| Remove | `removeSecretKeys`, `CustomObjectMatchType.Remove`, `isRemoveSecretKey` | `deleteSecretKeys`, `Delete` (deprecated; config fields warn at construct) |
|
|
47
47
|
|
|
48
48
|
Internally, normalize + `SecretManager` store and match on the preferred field names. Legacy config keys are input-only aliases.
|
|
49
49
|
|
|
@@ -58,6 +58,27 @@ yarn test
|
|
|
58
58
|
- Unit tests: `tests/unit/`
|
|
59
59
|
- Integration / end-to-end: `tests/integration/` (keep these few and scenario-focused; prefer unit tests for rule edge cases)
|
|
60
60
|
- Shared test helpers: `tests/helpers/`
|
|
61
|
+
- Copy-paste recipes: `examples/`
|
|
62
|
+
|
|
63
|
+
## Publishing
|
|
64
|
+
|
|
65
|
+
CI runs on push/PR to `master` (`.github/workflows/ci.yml`).
|
|
66
|
+
|
|
67
|
+
Pushing a version tag (`v*.*.*`) runs `.github/workflows/publish.yml`: build, test, then `npm publish` via **npm Trusted Publishing (OIDC)**. No `NPM_TOKEN` secret is required.
|
|
68
|
+
|
|
69
|
+
### One-time npm setup
|
|
70
|
+
|
|
71
|
+
1. Open [field-redactor](https://www.npmjs.com/package/field-redactor) → **Settings → Trusted Publisher**
|
|
72
|
+
2. Choose **GitHub Actions**
|
|
73
|
+
3. Set:
|
|
74
|
+
- **Owner / repository:** `mologna/field-redactor`
|
|
75
|
+
- **Workflow filename:** `publish.yml` (filename only — must match exactly, including `.yml`)
|
|
76
|
+
4. Save. After a successful OIDC publish, you can optionally restrict token-based publishing in **Publishing access**.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git tag -a v1.6.3 -m "v1.6.3"
|
|
80
|
+
git push origin v1.6.3
|
|
81
|
+
```
|
|
61
82
|
|
|
62
83
|
## Pull requests
|
|
63
84
|
|
package/README.md
CHANGED
|
@@ -71,6 +71,7 @@ Use `FieldRedactor.createSafe({ ... })` or `FieldRedactorConfigBuilder` so you n
|
|
|
71
71
|
| [Value-pattern redaction](docs/guides/value-pattern-redaction.md) | Detect PII in free-text field values |
|
|
72
72
|
| [Path rules & allowlists](docs/guides/path-rules.md) | Target stable JSON paths; exempt keys under deep redaction |
|
|
73
73
|
| [Configuration reference](docs/reference/config.md) | Full option table, API, presets, validation |
|
|
74
|
+
| [Examples](examples/README.md) | Copy-paste recipes (logging, path rules, value patterns, dryRun) |
|
|
74
75
|
| [Migration 1.5 → 1.6](docs/guides/migration-1.5-to-1.6.md) | Upgrade from 1.5.x (path rules, naming, exports) |
|
|
75
76
|
| [Migration 1.2 → 1.5](docs/guides/migration-1.2-to-1.5.md) | Upgrade from the previous npm line |
|
|
76
77
|
| [Release notes](docs/release-notes/README.md) | Per-version notes for every published tag |
|
|
@@ -13,9 +13,9 @@ export declare class FieldRedactor {
|
|
|
13
13
|
readonly configWarnings: readonly string[];
|
|
14
14
|
constructor(config?: FieldRedactorConfig);
|
|
15
15
|
/**
|
|
16
|
-
* Creates a FieldRedactor that requires at least one explicit redaction rule:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Creates a FieldRedactor that requires at least one explicit redaction rule:
|
|
17
|
+
* `secretKeys`, `deepSecretKeys`, `opaqueSecretKeys`, `removeSecretKeys`, `customObjects`,
|
|
18
|
+
* `valuePatterns`, or `pathRules`.
|
|
19
19
|
* Unlike `new FieldRedactor()`, omitting all rules does not default to redacting every value.
|
|
20
20
|
*/
|
|
21
21
|
static createSafe(config: FieldRedactorConfig): FieldRedactor;
|
|
@@ -36,14 +36,14 @@ class FieldRedactor {
|
|
|
36
36
|
this.deps = (0, fieldRedactorDeps_1.buildFieldRedactorDeps)(config);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Creates a FieldRedactor that requires at least one explicit redaction rule:
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Creates a FieldRedactor that requires at least one explicit redaction rule:
|
|
40
|
+
* `secretKeys`, `deepSecretKeys`, `opaqueSecretKeys`, `removeSecretKeys`, `customObjects`,
|
|
41
|
+
* `valuePatterns`, or `pathRules`.
|
|
42
42
|
* Unlike `new FieldRedactor()`, omitting all rules does not default to redacting every value.
|
|
43
43
|
*/
|
|
44
44
|
static createSafe(config) {
|
|
45
45
|
if (!(0, configValidator_1.hasExplicitRedactionRules)(config)) {
|
|
46
|
-
throw new errors_1.FieldRedactorConfigurationError('FieldRedactor.createSafe() requires at least one non-empty secretKeys, deepSecretKeys, opaqueSecretKeys, removeSecretKeys, customObjects, valuePatterns, or pathRules entry
|
|
46
|
+
throw new errors_1.FieldRedactorConfigurationError('FieldRedactor.createSafe() requires at least one non-empty secretKeys, deepSecretKeys, opaqueSecretKeys, removeSecretKeys, customObjects, valuePatterns, or pathRules entry. Without explicit rules, new FieldRedactor() redacts all values by default.');
|
|
47
47
|
}
|
|
48
48
|
return new FieldRedactor(config);
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldRedactor.js","sourceRoot":"","sources":["../../src/api/fieldRedactor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAgF;AAChF,2DAAgF;AAUhF,6CAA2E;AAC3E,gDAAwB;AACxB,+DAAmG;AAEnG;;;;;;GAMG;AACH,MAAa,aAAa;IAOxB,YAAY,MAA4B;;QANvB,aAAQ,GAAG,IAAA,cAAI,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAO/D,IAAI,CAAC,cAAc,GAAG,IAAA,6CAA2B,EAAC,MAAM,CAAC,CAAC;QAC1D,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,eAAe,uDAAG,OAAO,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAA,0CAAsB,EAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,MAA2B;QAClD,IAAI,CAAC,IAAA,2CAAyB,EAAC,MAAM,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,wCAA+B,CACvC
|
|
1
|
+
{"version":3,"file":"fieldRedactor.js","sourceRoot":"","sources":["../../src/api/fieldRedactor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAgF;AAChF,2DAAgF;AAUhF,6CAA2E;AAC3E,gDAAwB;AACxB,+DAAmG;AAEnG;;;;;;GAMG;AACH,MAAa,aAAa;IAOxB,YAAY,MAA4B;;QANvB,aAAQ,GAAG,IAAA,cAAI,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAO/D,IAAI,CAAC,cAAc,GAAG,IAAA,6CAA2B,EAAC,MAAM,CAAC,CAAC;QAC1D,KAAK,MAAM,OAAO,I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AE,CAAC;YACvC,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;YACxB,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;gBAC9B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;oBACrC,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,KAAc;QACzC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,IAAI,2BAAkB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEO,sBAAsB,CAAC,KAAsB;QACnD,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,IAAI,CAAC;IACtE,CAAC;CACF;AA7KD,sCA6KC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configValidator.d.ts","sourceRoot":"","sources":["../../src/config/configValidator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAC;AAgE7E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,YAAa,mBAAmB,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"configValidator.d.ts","sourceRoot":"","sources":["../../src/config/configValidator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAC;AAgE7E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,YAAa,mBAAmB,KAAG,MAAM,EAmBhF,CAAC"}
|
|
@@ -59,9 +59,11 @@ const collectSchemaWarnings = (customObjects) => {
|
|
|
59
59
|
*/
|
|
60
60
|
const validateFieldRedactorConfig = (config) => {
|
|
61
61
|
var _a, _b;
|
|
62
|
+
const legacyNamingWarnings = collectLegacyNamingWarnings(config);
|
|
62
63
|
const resolved = (_a = (0, redactionRules_1.normalizeFieldRedactorConfig)(config)) !== null && _a !== void 0 ? _a : {};
|
|
63
64
|
(0, customObjectSchemas_1.assertNoIdenticalCustomObjectSchemas)(resolved.customObjects);
|
|
64
65
|
const warnings = [
|
|
66
|
+
...legacyNamingWarnings,
|
|
65
67
|
...(!(0, redactionRules_1.hasExplicitRedactionRules)(resolved)
|
|
66
68
|
? ['All values will be redacted. Did you mean to set `secretKeys` or use `FieldRedactor.createSafe()`?']
|
|
67
69
|
: []),
|
|
@@ -74,4 +76,18 @@ const validateFieldRedactorConfig = (config) => {
|
|
|
74
76
|
return warnings;
|
|
75
77
|
};
|
|
76
78
|
exports.validateFieldRedactorConfig = validateFieldRedactorConfig;
|
|
79
|
+
const collectLegacyNamingWarnings = (config) => {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
if (!config) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
const warnings = [];
|
|
85
|
+
if ((_a = config.fullSecretKeys) === null || _a === void 0 ? void 0 : _a.length) {
|
|
86
|
+
warnings.push('`fullSecretKeys` is deprecated; prefer `opaqueSecretKeys` (same behavior). Legacy input remains supported in 1.x.');
|
|
87
|
+
}
|
|
88
|
+
if ((_b = config.deleteSecretKeys) === null || _b === void 0 ? void 0 : _b.length) {
|
|
89
|
+
warnings.push('`deleteSecretKeys` is deprecated; prefer `removeSecretKeys` (same behavior). Legacy input remains supported in 1.x.');
|
|
90
|
+
}
|
|
91
|
+
return warnings;
|
|
92
|
+
};
|
|
77
93
|
//# sourceMappingURL=configValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configValidator.js","sourceRoot":"","sources":["../../src/config/configValidator.ts"],"names":[],"mappings":";;;AAAA,sCAA4D;AAC5D,mDAAiE;AACjE,qDAA2I;AAC3I,+DAAiG;AAGjG,mDAA6D;AAApD,2HAAA,yBAAyB,OAAA;AAClC,6DAA6E;AAApE,2IAAA,oCAAoC,OAAA;AAE7C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS,oCAAmB,CAAC,CAAC;AAE7D,MAAM,oBAAoB,GAAG,CAAC,MAA2B,EAAY,EAAE;IACrE,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEpD,KAAK,MAAM,KAAK,IAAI,0CAAyB,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjB,QAAQ,CAAC,IAAI,CACX,gBAAgB,IAAA,yBAAY,EAAC,KAAK,CAAC,SAAS,KAAK,uEAAuE,CACzH,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,SAAS;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,CAAC;YACtC,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,KAAK,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC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AC;QACP,GAAG,oBAAoB,CAAC,QAAQ,CAAC;QACjC,GAAG,qBAAqB,CAAC,MAAA,QAAQ,CAAC,aAAa,mCAAI,EAAE,CAAC;KACvD,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,wCAA+B,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAnBW,QAAA,2BAA2B,+BAmBtC;AAEF,MAAM,2BAA2B,GAAG,CAAC,MAA4B,EAAY,EAAE;;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,MAAA,MAAM,CAAC,cAAc,0CAAE,MAAM,EAAE,CAAC;QAClC,QAAQ,CAAC,IAAI,CACX,mHAAmH,CACpH,CAAC;IACJ,CAAC;IACD,IAAI,MAAA,MAAM,CAAC,gBAAgB,0CAAE,MAAM,EAAE,CAAC;QACpC,QAAQ,CAAC,IAAI,CACX,qHAAqH,CACtH,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
/** JSON-compatible primitive. */
|
|
1
|
+
/** JSON-compatible primitive. Useful when typing redactor inputs and report values. */
|
|
2
2
|
export type JsonPrimitive = string | number | boolean | null;
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Function values encountered during traversal are left unchanged.
|
|
5
|
+
* @internal Primarily for engine typing; consumers rarely need this directly.
|
|
6
|
+
*/
|
|
4
7
|
export type JsonFunction = (...args: never[]) => unknown;
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Scalar values that may appear in JSON-like structures during redaction.
|
|
10
|
+
* @internal Prefer {@link JsonPrimitive} or {@link JsonValue} in application code.
|
|
11
|
+
*/
|
|
6
12
|
export type JsonLeafValue = JsonPrimitive | Date | JsonFunction;
|
|
7
|
-
/** JSON-compatible object. */
|
|
13
|
+
/** JSON-compatible object. Useful when typing nested payloads. */
|
|
8
14
|
export type JsonObject = {
|
|
9
15
|
[key: string]: JsonValue | undefined;
|
|
10
16
|
};
|
|
11
17
|
/** JSON-compatible array. */
|
|
12
18
|
export type JsonArray = Array<JsonValue | undefined>;
|
|
13
|
-
/** JSON-compatible value. */
|
|
19
|
+
/** JSON-compatible value. Useful when typing redactor inputs. */
|
|
14
20
|
export type JsonValue = JsonLeafValue | JsonObject | JsonArray;
|
|
15
21
|
/**
|
|
16
22
|
* Values accepted by {@link FieldRedactor.redact} and {@link FieldRedactor.redactInPlace}.
|
|
@@ -19,13 +25,20 @@ export type JsonValue = JsonLeafValue | JsonObject | JsonArray;
|
|
|
19
25
|
export type RedactableInput = JsonValue | undefined;
|
|
20
26
|
/** Primitive values that may be passed to a custom {@link Redactor} function. */
|
|
21
27
|
export type RedactorInput = JsonPrimitive | undefined;
|
|
22
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Primitive values processed by {@link PrimitiveRedactor}.
|
|
30
|
+
* @internal Alias of {@link RedactorInput}; prefer RedactorInput in application code.
|
|
31
|
+
*/
|
|
23
32
|
export type RedactablePrimitive = RedactorInput;
|
|
24
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Result of redacting a primitive value.
|
|
35
|
+
* @internal Engine typing detail; prefer `string` for custom redactor return types.
|
|
36
|
+
*/
|
|
25
37
|
export type RedactedPrimitive = string | boolean | null | undefined | 0;
|
|
26
38
|
/**
|
|
27
39
|
* Sibling field value used to resolve secret specifiers in custom object schemas
|
|
28
40
|
* (for example, the string `"email"` in a `{ name, value }` metadata entry).
|
|
41
|
+
* @internal Prefer string | number | boolean in application schemas.
|
|
29
42
|
*/
|
|
30
43
|
export type SecretSpecifierValue = string | number | boolean;
|
|
31
44
|
export type Redactor = (value: RedactorInput) => Promise<string>;
|
|
@@ -157,9 +170,14 @@ export type DryRunResult<T> = {
|
|
|
157
170
|
result: T;
|
|
158
171
|
report: DryRunReport;
|
|
159
172
|
};
|
|
160
|
-
/** JSON object or array traversed during in-place redaction.
|
|
173
|
+
/** JSON object or array traversed during in-place redaction.
|
|
174
|
+
* @internal Engine typing; prefer {@link JsonObject} / {@link JsonArray} / {@link RedactableInput}.
|
|
175
|
+
*/
|
|
161
176
|
export type TraversableJson = JsonObject | JsonArray;
|
|
162
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* Mutable key/value map used while traversing JSON object or array keys in place.
|
|
179
|
+
* @internal Not part of the supported public API.
|
|
180
|
+
*/
|
|
163
181
|
export type JsonRecord = Record<string, JsonValue | undefined>;
|
|
164
182
|
export declare const isJsonObject: (value: JsonValue | undefined) => value is JsonObject;
|
|
165
183
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,IAAI,GAAG,YAAY,CAAC;AAEhE,kEAAkE;AAClE,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CAAE,CAAC;AAElE,6BAA6B;AAC7B,MAAM,MAAM,SAAS,GAAG,KAAK,CA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C"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAyDA;;;;GAIG;AACH,IAAY,qBAaX;AAbD,WAAY,qBAAqB;IAC/B,6CAA6C;IAC7C,qEAAU,CAAA;IACV,+DAA+D;IAC/D,qEAAU,CAAA;IACV,wDAAwD;IACxD,qEAAU,CAAA;IACV,+DAA+D;IAC/D,iEAAQ,CAAA;IACR,iEAAQ,CAAA;IACR,uEAAW,CAAA;IACX,iEAAQ,CAAA;IACR,qEAAU,CAAA;AACZ,CAAC,EAbW,qBAAqB,qCAArB,qBAAqB,QAahC;AAyIM,MAAM,YAAY,GAAG,CAAC,KAA4B,EAAuB,EAAE,CAChF,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAD/E,QAAA,YAAY,gBACmE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Migration: npm 1.5.x → 1.6.x
|
|
2
2
|
|
|
3
|
-
**1.6.0** is a minor release: new features and aliases with no required config changes for typical upgrades from **1.5.0**. **1.6.1
|
|
3
|
+
**1.6.0** is a minor release: new features and aliases with no required config changes for typical upgrades from **1.5.0**. **1.6.1**–**1.6.3** are patches (install only; see [v1.6.1](../release-notes/v1.6.1.md), [v1.6.2](../release-notes/v1.6.2.md), [v1.6.3](../release-notes/v1.6.3.md)).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install field-redactor@1.6.
|
|
8
|
+
npm install field-redactor@1.6.3
|
|
9
9
|
# or
|
|
10
|
-
yarn add field-redactor@1.6.
|
|
10
|
+
yarn add field-redactor@1.6.3
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## What you can adopt (optional)
|
|
@@ -52,6 +52,7 @@ Source files were reorganized under `api/`, `engine/`, `rules/`, etc. That affec
|
|
|
52
52
|
|
|
53
53
|
## Links
|
|
54
54
|
|
|
55
|
+
- [Release notes v1.6.3](../release-notes/v1.6.3.md)
|
|
55
56
|
- [Release notes v1.6.2](../release-notes/v1.6.2.md)
|
|
56
57
|
- [Release notes v1.6.1](../release-notes/v1.6.1.md)
|
|
57
58
|
- [Release notes v1.6.0](../release-notes/v1.6.0.md)
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Release notes index
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Publishing
|
|
4
|
+
|
|
5
|
+
npm versions use the same `v1.x.x` git tags. Pushing a version tag runs [`.github/workflows/publish.yml`](../../.github/workflows/publish.yml) (build, test, `npm publish` via OIDC trusted publishing). Configure a Trusted Publisher on npm for `mologna/field-redactor` with workflow filename `publish.yml` — see [CONTRIBUTING.md](../../CONTRIBUTING.md#publishing).
|
|
4
6
|
|
|
5
7
|
| Version | npm | Notes |
|
|
6
8
|
| --- | --- | --- |
|
|
9
|
+
| **v1.6.3** | Yes | [v1.6.3.md](v1.6.3.md) — examples, OIDC publish, legacy naming warnings |
|
|
7
10
|
| **v1.6.2** | Yes | [v1.6.2.md](v1.6.2.md) — canonical opaque/remove naming; drop ObjectRedactor façade |
|
|
8
11
|
| **v1.6.1** | Yes | [v1.6.1.md](v1.6.1.md) — internal simplification / layering cleanup |
|
|
9
12
|
| **v1.6.0** | Yes | [v1.6.0.md](v1.6.0.md) — path rules, passKeys, naming aliases, architecture |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Release notes — v1.6.3
|
|
2
|
+
|
|
3
|
+
Field Redactor **1.6.3** is a patch release focused on DX and release hygiene after **1.6.2**. Redaction behavior is unchanged for typical consumers.
|
|
4
|
+
|
|
5
|
+
**Upgrade from 1.6.2:** Install `1.6.3`. If you still pass `fullSecretKeys` / `deleteSecretKeys`, you will see deprecation warnings at construction — migrate to `opaqueSecretKeys` / `removeSecretKeys` when convenient (legacy fields still work).
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
| Area | What changed |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| **Examples** | Copy-paste recipes under [`examples/`](../../examples/) |
|
|
12
|
+
| **Publishing** | Tag → OIDC Trusted Publishing workflow (no `NPM_TOKEN`) |
|
|
13
|
+
| **Naming** | Deprecation warnings for legacy `full` / `delete` config fields |
|
|
14
|
+
| **Types** | Incidental exports marked `@internal` in JSDoc |
|
|
15
|
+
|
|
16
|
+
## Publishing note
|
|
17
|
+
|
|
18
|
+
Configure npm Trusted Publisher for `mologna/field-redactor` with workflow filename `publish.yml` before relying on the new publish Action. See [CONTRIBUTING.md](../../CONTRIBUTING.md#publishing).
|
|
19
|
+
|
|
20
|
+
## Links
|
|
21
|
+
|
|
22
|
+
- [CHANGELOG](../../CHANGELOG.md)
|
|
23
|
+
- [Release notes v1.6.2](v1.6.2.md)
|
|
24
|
+
- [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
|
|
25
|
+
- [Examples](../../examples/README.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Copy-paste recipes for common Field Redactor setups. Run with:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx ts-node examples/logging-metadata.ts
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| File | Covers |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| [logging-metadata.ts](logging-metadata.ts) | Schema sibling-key redaction + auth key removal |
|
|
12
|
+
| [path-rules.ts](path-rules.ts) | Path patterns, modes, and pass keys |
|
|
13
|
+
| [value-patterns.ts](value-patterns.ts) | Value-pattern redaction regardless of key name |
|
|
14
|
+
| [dry-run.ts](dry-run.ts) | Preview redactions/deletes with attribution |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dryRun: preview redacted output plus path attribution without guessing rules by hand.
|
|
3
|
+
*/
|
|
4
|
+
import { FieldRedactorConfigBuilder } from '../src';
|
|
5
|
+
|
|
6
|
+
const redactor = FieldRedactorConfigBuilder.create()
|
|
7
|
+
.shallow(/email/i)
|
|
8
|
+
.remove(/authKey/i)
|
|
9
|
+
.opaque(/rawPayload/i)
|
|
10
|
+
.buildSafeRedactor();
|
|
11
|
+
|
|
12
|
+
const input = {
|
|
13
|
+
email: 'alice@example.com',
|
|
14
|
+
authKey: 'secret',
|
|
15
|
+
rawPayload: { token: 'x' },
|
|
16
|
+
note: 'ok'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const { result, report } = redactor.dryRunSync(input);
|
|
20
|
+
console.log('result', JSON.stringify(result, null, 2));
|
|
21
|
+
console.log('report', JSON.stringify(report, null, 2));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging metadata: `{ name, type, value }` schemas + auth key removal.
|
|
3
|
+
*/
|
|
4
|
+
import { FieldRedactor, FieldRedactorConfigBuilder, presets } from '../src';
|
|
5
|
+
|
|
6
|
+
const redactor = FieldRedactorConfigBuilder.create()
|
|
7
|
+
.usePreset(presets.applicationLogging())
|
|
8
|
+
.buildSafeRedactor();
|
|
9
|
+
|
|
10
|
+
const input = {
|
|
11
|
+
email: 'alice@example.com',
|
|
12
|
+
authKey: 'secret-token',
|
|
13
|
+
events: [{ name: 'email', value: 'bob@example.com' }]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const result = redactor.redactSync(input);
|
|
17
|
+
console.log(JSON.stringify(result, null, 2));
|
|
18
|
+
// authKey removed; email / events[0].value redacted
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path rules and pass-key allowlists under deep parents.
|
|
3
|
+
*/
|
|
4
|
+
import { FieldRedactorConfigBuilder } from '../src';
|
|
5
|
+
|
|
6
|
+
const redactor = FieldRedactorConfigBuilder.create()
|
|
7
|
+
.pathRule('session.token', 'remove')
|
|
8
|
+
.pathRule('logs.*.message', 'deep')
|
|
9
|
+
.deep(/accountInfo/)
|
|
10
|
+
.passKey(/^id$/, /^profile$/)
|
|
11
|
+
.buildSafeRedactor();
|
|
12
|
+
|
|
13
|
+
const input = {
|
|
14
|
+
session: { token: 'abc', id: '1' },
|
|
15
|
+
logs: [{ message: 'secret', meta: { note: 'nested' } }],
|
|
16
|
+
accountInfo: {
|
|
17
|
+
id: 'user-1',
|
|
18
|
+
profile: { displayName: 'Alice' },
|
|
19
|
+
ssn: '111-22-3333'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
console.log(JSON.stringify(redactor.redactSync(input), null, 2));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value-pattern redaction: match scalar string forms regardless of key name.
|
|
3
|
+
*/
|
|
4
|
+
import { FieldRedactor } from '../src';
|
|
5
|
+
|
|
6
|
+
const redactor = FieldRedactor.createSafe({
|
|
7
|
+
secretKeys: [],
|
|
8
|
+
valuePatterns: [/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/, /\d{3}-\d{2}-\d{4}/]
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const input = {
|
|
12
|
+
note: 'Contact alice@example.com or SSN 111-22-3333',
|
|
13
|
+
label: 'safe'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
console.log(JSON.stringify(redactor.redactSync(input), null, 2));
|
package/package.json
CHANGED
package/dist/arrayRedaction.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { JsonArray, JsonObject } from './types';
|
|
2
|
-
import { ContainerMutation } from './objectRedactorMutation';
|
|
3
|
-
import { MaybeAsync } from './maybeAsync';
|
|
4
|
-
import { TraversalServices } from './traversalServices';
|
|
5
|
-
export declare class ArrayRedactor {
|
|
6
|
-
private readonly services;
|
|
7
|
-
constructor(services: TraversalServices);
|
|
8
|
-
redactArrayInObject(array: JsonArray, key: string, forceDeepRedaction: boolean, parent: ContainerMutation<JsonObject | JsonArray>, pathSegments: Array<string | number>): MaybeAsync<void>;
|
|
9
|
-
redactObjectsInArray(array: JsonArray, copyOnWrite: boolean, pathSegments: Array<string | number>): MaybeAsync<JsonArray>;
|
|
10
|
-
redactAllArrayValues(array: JsonArray, forceDeepRedaction: boolean, copyOnWrite: boolean, pathSegments: Array<string | number>): MaybeAsync<JsonArray>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=arrayRedaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrayRedaction.d.ts","sourceRoot":"","sources":["../src/arrayRedaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAA2B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAsB,UAAU,EAAiB,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,iBAAiB;IAExD,mBAAmB,CACjB,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,OAAO,EAC3B,MAAM,EAAE,iBAAiB,CAAC,UAAU,GAAG,SAAS,CAAC,EACjD,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GACnC,UAAU,CAAC,IAAI,CAAC;IAmBnB,oBAAoB,CAClB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GACnC,UAAU,CAAC,SAAS,CAAC;IA6BxB,oBAAoB,CAClB,KAAK,EAAE,SAAS,EAChB,kBAAkB,EAAE,OAAO,EAC3B,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GACnC,UAAU,CAAC,SAAS,CAAC;CA0CzB"}
|
package/dist/arrayRedaction.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayRedactor = void 0;
|
|
4
|
-
const types_1 = require("./types");
|
|
5
|
-
const objectRedactorMutation_1 = require("./objectRedactorMutation");
|
|
6
|
-
const maybeAsync_1 = require("./maybeAsync");
|
|
7
|
-
const objectRedactorHelpers_1 = require("./objectRedactorHelpers");
|
|
8
|
-
class ArrayRedactor {
|
|
9
|
-
constructor(services) {
|
|
10
|
-
this.services = services;
|
|
11
|
-
}
|
|
12
|
-
redactArrayInObject(array, key, forceDeepRedaction, parent, pathSegments) {
|
|
13
|
-
const redacted = this.services.ruleResolver.shouldTraverseContainerByKey(key, forceDeepRedaction)
|
|
14
|
-
? this.redactAllArrayValues(array, this.services.ruleResolver.containerForceDeepRedaction(key, forceDeepRedaction), parent.copyOnWrite, pathSegments)
|
|
15
|
-
: this.redactObjectsInArray(array, parent.copyOnWrite, pathSegments);
|
|
16
|
-
if (redacted instanceof Promise) {
|
|
17
|
-
return redacted.then((result) => {
|
|
18
|
-
parent.set(key, result);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
parent.set(key, redacted);
|
|
22
|
-
}
|
|
23
|
-
redactObjectsInArray(array, copyOnWrite, pathSegments) {
|
|
24
|
-
const container = (0, objectRedactorMutation_1.createContainerMutation)(array, copyOnWrite);
|
|
25
|
-
const work = (0, maybeAsync_1.runSequential)(array, (item, index) => {
|
|
26
|
-
if (!(0, types_1.isJsonObject)(item)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const customObject = this.services.ruleResolver.getMatchingSchema(item);
|
|
30
|
-
const child = (0, objectRedactorMutation_1.createContainerMutation)(item, copyOnWrite);
|
|
31
|
-
const itemPath = [...pathSegments, index];
|
|
32
|
-
return (0, maybeAsync_1.finalizeMaybeAsync)(customObject
|
|
33
|
-
? this.services.handleCustomObject(child, customObject)
|
|
34
|
-
: this.services.redactSecretFields(child, false, itemPath), () => {
|
|
35
|
-
container.set(String(index), child.result());
|
|
36
|
-
}, this.services.asyncMode);
|
|
37
|
-
}, this.services.asyncMode);
|
|
38
|
-
return (0, maybeAsync_1.finalizeMaybeAsync)(work, () => container.result(), this.services.asyncMode);
|
|
39
|
-
}
|
|
40
|
-
redactAllArrayValues(array, forceDeepRedaction, copyOnWrite, pathSegments) {
|
|
41
|
-
const container = (0, objectRedactorMutation_1.createContainerMutation)(array, copyOnWrite);
|
|
42
|
-
const work = (0, maybeAsync_1.runSequential)(array, (item, index) => {
|
|
43
|
-
const key = String(index);
|
|
44
|
-
const itemPath = [...pathSegments, index];
|
|
45
|
-
if (Array.isArray(item)) {
|
|
46
|
-
const nested = this.redactAllArrayValues(item, forceDeepRedaction, copyOnWrite, itemPath);
|
|
47
|
-
if (nested instanceof Promise) {
|
|
48
|
-
return nested.then((result) => {
|
|
49
|
-
container.set(key, result);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
container.set(key, nested);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (!(0, types_1.isJsonObject)(item)) {
|
|
56
|
-
return this.services.setPrimitive(container, key, (0, objectRedactorHelpers_1.toRedactablePrimitive)(item));
|
|
57
|
-
}
|
|
58
|
-
const customObject = this.services.ruleResolver.getMatchingSchema(item);
|
|
59
|
-
const child = (0, objectRedactorMutation_1.createContainerMutation)(item, copyOnWrite);
|
|
60
|
-
return (0, maybeAsync_1.finalizeMaybeAsync)(customObject
|
|
61
|
-
? this.services.handleCustomObject(child, customObject)
|
|
62
|
-
: this.services.redactSecretFields(child, forceDeepRedaction, itemPath), () => {
|
|
63
|
-
container.set(key, child.result());
|
|
64
|
-
}, this.services.asyncMode);
|
|
65
|
-
}, this.services.asyncMode);
|
|
66
|
-
return (0, maybeAsync_1.finalizeMaybeAsync)(work, () => container.result(), this.services.asyncMode);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.ArrayRedactor = ArrayRedactor;
|
|
70
|
-
//# sourceMappingURL=arrayRedaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrayRedaction.js","sourceRoot":"","sources":["../src/arrayRedaction.ts"],"names":[],"mappings":";;;AAAA,mCAA8D;AAC9D,qEAAsF;AACtF,6CAA6E;AAC7E,mEAAgE;AAGhE,MAAa,aAAa;IACxB,YAA6B,QAA2B;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAG,CAAC;IAE5D,mBAAmB,CACjB,KAAgB,EAChB,GAAW,EACX,kBAA2B,EAC3B,MAAiD,EACjD,YAAoC;QAEpC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,4BAA4B,CAAC,GAAG,EAAE,kBAAkB,CAAC;YAC/F,CAAC,CAAC,IAAI,CAAC,oBAAoB,CACvB,KAAK,EACL,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,2BAA2B,CAAC,GAAG,EAAE,kBAAkB,CAAC,EAC/E,MAAM,CAAC,WAAW,EAClB,YAAY,CACb;YACH,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAEvE,IAAI,QAAQ,YAAY,OAAO,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5B,C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C,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EACzE,GAAG,EAAE;gBACH,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YACrC,CAAC,EACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CACxB,CAAC;QACJ,CAAC,EACD,IAAI,CAAC,QAAQ,CAAC,SAAS,CACxB,CAAC;QAEF,OAAO,IAAA,+BAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACrF,CAAC;CACF;AA5GD,sCA4GC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FieldRedactorConfig } from './types';
|
|
2
|
-
export { hasExplicitRedactionRules } from './redactionRules';
|
|
3
|
-
export { assertNoIdenticalCustomObjectSchemas } from './customObjectSchemas';
|
|
4
|
-
/**
|
|
5
|
-
* Returns non-fatal configuration warnings. Throws {@link FieldRedactorConfigurationError} for
|
|
6
|
-
* invalid custom object duplicates and when `strict` is true on any warning.
|
|
7
|
-
*/
|
|
8
|
-
export declare const validateFieldRedactorConfig: (config?: FieldRedactorConfig) => string[];
|
|
9
|
-
//# sourceMappingURL=configValidator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configValidator.d.ts","sourceRoot":"","sources":["../src/configValidator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAC;AAgE7E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,YAAa,mBAAmB,KAAG,MAAM,EAiBhF,CAAC"}
|