field-redactor 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/CONTRIBUTING.md +5 -3
- package/README.md +2 -2
- package/dist/api/fieldRedactor.d.ts +3 -5
- package/dist/api/fieldRedactor.d.ts.map +1 -1
- package/dist/api/fieldRedactor.js +7 -11
- package/dist/api/fieldRedactor.js.map +1 -1
- package/dist/api/fieldRedactorConfigBuilder.d.ts +3 -3
- package/dist/api/fieldRedactorConfigBuilder.d.ts.map +1 -1
- package/dist/api/fieldRedactorConfigBuilder.js +7 -9
- package/dist/api/fieldRedactorConfigBuilder.js.map +1 -1
- package/dist/api/fieldRedactorDeps.d.ts +2 -2
- package/dist/api/fieldRedactorDeps.d.ts.map +1 -1
- package/dist/api/fieldRedactorDeps.js +6 -6
- package/dist/api/fieldRedactorDeps.js.map +1 -1
- package/dist/config/presets.d.ts +2 -2
- package/dist/config/presets.js +1 -1
- package/dist/config/redactionRules.d.ts +13 -7
- package/dist/config/redactionRules.d.ts.map +1 -1
- package/dist/config/redactionRules.js +20 -16
- package/dist/config/redactionRules.js.map +1 -1
- package/dist/dryrun/dryRun.d.ts.map +1 -1
- package/dist/dryrun/dryRun.js +2 -2
- package/dist/dryrun/dryRun.js.map +1 -1
- package/dist/engine/arrayRedaction.js +1 -1
- package/dist/engine/arrayRedaction.js.map +1 -1
- package/dist/engine/customObjectFieldHandler.d.ts +4 -9
- package/dist/engine/customObjectFieldHandler.d.ts.map +1 -1
- package/dist/engine/customObjectFieldHandler.js +90 -108
- package/dist/engine/customObjectFieldHandler.js.map +1 -1
- package/dist/engine/objectRedactorCustomObject.d.ts +8 -23
- package/dist/engine/objectRedactorCustomObject.d.ts.map +1 -1
- package/dist/engine/objectRedactorCustomObject.js +8 -40
- package/dist/engine/objectRedactorCustomObject.js.map +1 -1
- package/dist/engine/objectRedactorHelpers.d.ts +3 -4
- package/dist/engine/objectRedactorHelpers.d.ts.map +1 -1
- package/dist/engine/objectRedactorHelpers.js +12 -38
- package/dist/engine/objectRedactorHelpers.js.map +1 -1
- package/dist/engine/objectRedactorTraversal.d.ts +1 -0
- package/dist/engine/objectRedactorTraversal.d.ts.map +1 -1
- package/dist/engine/objectRedactorTraversal.js +2 -1
- package/dist/engine/objectRedactorTraversal.js.map +1 -1
- package/dist/rules/ruleResolver.d.ts +3 -5
- package/dist/rules/ruleResolver.d.ts.map +1 -1
- package/dist/rules/ruleResolver.js +17 -23
- package/dist/rules/ruleResolver.js.map +1 -1
- package/dist/rules/schemaSiblingKey.d.ts +4 -0
- package/dist/rules/schemaSiblingKey.d.ts.map +1 -0
- package/dist/rules/schemaSiblingKey.js +19 -0
- package/dist/rules/schemaSiblingKey.js.map +1 -0
- package/dist/rules/secretManager.d.ts +6 -7
- package/dist/rules/secretManager.d.ts.map +1 -1
- package/dist/rules/secretManager.js +13 -8
- package/dist/rules/secretManager.js.map +1 -1
- package/dist/types.d.ts +12 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -4
- package/dist/types.js.map +1 -1
- package/dist/util/maybeAsync.d.ts +0 -1
- package/dist/util/maybeAsync.d.ts.map +1 -1
- package/dist/util/maybeAsync.js +1 -3
- package/dist/util/maybeAsync.js.map +1 -1
- package/dist/util/primitiveCoercion.d.ts +4 -0
- package/dist/util/primitiveCoercion.d.ts.map +1 -0
- package/dist/util/primitiveCoercion.js +21 -0
- package/dist/util/primitiveCoercion.js.map +1 -0
- package/docs/guides/anti-patterns.md +1 -1
- package/docs/guides/metadata-redaction.md +2 -2
- package/docs/guides/migration-1.5-to-1.6.md +7 -5
- package/docs/guides/secret-key-modes.md +9 -14
- package/docs/reference/config.md +2 -2
- package/docs/release-notes/README.md +3 -1
- package/docs/release-notes/v1.6.1.md +24 -0
- package/docs/release-notes/v1.6.2.md +26 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Secret key modes
|
|
2
2
|
|
|
3
|
-
FieldRedactor applies **Shallow**, **Deep**, **Opaque**, and **Remove** rules via regex key matching. Throughout the docs, these are the conceptual names; the config fields are `secretKeys`, `deepSecretKeys`, `
|
|
3
|
+
FieldRedactor applies **Shallow**, **Deep**, **Opaque**, and **Remove** rules via regex key matching. Throughout the docs, these are the conceptual names; the config fields are `secretKeys`, `deepSecretKeys`, `opaqueSecretKeys`, and `removeSecretKeys` (legacy aliases `fullSecretKeys` / `deleteSecretKeys` still work).
|
|
4
4
|
|
|
5
5
|
**Precedence** (highest wins): Schema (`customObjects`) → Opaque → Deep → Remove → Shallow → Value-pattern (`valuePatterns`)
|
|
6
6
|
|
|
@@ -20,8 +20,8 @@ Same input for every row:
|
|
|
20
20
|
| --- | --- | --- | --- |
|
|
21
21
|
| **Shallow** | `secretKeys` | `[/email/]` | `contactInfo.email` → `"REDACTED"`; `city`, `username` unchanged |
|
|
22
22
|
| **Deep** | `deepSecretKeys` | `[/contactInfo/]` | All primitives inside `contactInfo` redacted |
|
|
23
|
-
| **Opaque** | `
|
|
24
|
-
| **Remove** | `
|
|
23
|
+
| **Opaque** | `opaqueSecretKeys` | `[/contactInfo/]` | Entire `contactInfo` replaced with `"REDACTED"` |
|
|
24
|
+
| **Remove** | `removeSecretKeys` | `[/authKey/]` | `authKey` key removed from output |
|
|
25
25
|
|
|
26
26
|
### Builder API
|
|
27
27
|
|
|
@@ -74,13 +74,13 @@ await fieldRedactor.redact({
|
|
|
74
74
|
// → email, id, and other primitives under contactInfo are redacted
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
## Opaque (`
|
|
77
|
+
## Opaque (`opaqueSecretKeys`)
|
|
78
78
|
|
|
79
79
|
Stringify the entire value at matching keys, then redact. Typical for objects and arrays you want to hide completely.
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
82
|
const fieldRedactor = new FieldRedactor({
|
|
83
|
-
|
|
83
|
+
opaqueSecretKeys: [/contactInfo/i]
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
await fieldRedactor.redact({
|
|
@@ -89,20 +89,15 @@ await fieldRedactor.redact({
|
|
|
89
89
|
// → { contactInfo: "REDACTED" }
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
## Remove (`
|
|
92
|
+
## Remove (`removeSecretKeys`)
|
|
93
93
|
|
|
94
94
|
Delete matching keys from the output.
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
97
|
const fieldRedactor = new FieldRedactor({
|
|
98
|
-
|
|
98
|
+
removeSecretKeys: [/authKey/i]
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
await fieldRedactor.redact({
|
|
102
|
-
// → {
|
|
101
|
+
await fieldRedactor.redact({ authKey: 'secret-token', username: 'alice' });
|
|
102
|
+
// → { username: 'alice' }
|
|
103
103
|
```
|
|
104
|
-
|
|
105
|
-
## Related
|
|
106
|
-
|
|
107
|
-
- [Metadata redaction](metadata-redaction.md) — when sensitivity depends on sibling fields
|
|
108
|
-
- [Configuration reference](../reference/config.md) — all options and API details
|
package/docs/reference/config.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
| — | `syncRedactor` | `(val) => string` | `"REDACTED"` sync | Sync redactor; enables `redactSync()` without per-field Promises |
|
|
9
9
|
| **Shallow** | `secretKeys` | `RegExp[]` | `null` | Redact matching scalar values; if no rules at all, everything matches |
|
|
10
10
|
| **Deep** | `deepSecretKeys` | `RegExp[]` | `[]` | Deeply redact all primitives under matching keys |
|
|
11
|
-
| **Opaque** | `
|
|
12
|
-
| **Remove** | `
|
|
11
|
+
| **Opaque** | `opaqueSecretKeys` | `RegExp[]` | `[]` | Stringify and redact entire values (legacy alias: `fullSecretKeys`) |
|
|
12
|
+
| **Remove** | `removeSecretKeys` | `RegExp[]` | `[]` | Delete matching keys (legacy alias: `deleteSecretKeys`) |
|
|
13
13
|
| **Schema** | `customObjects` | `CustomObject[]` | `[]` | Per-shape rules; see [metadata guide](../guides/metadata-redaction.md) |
|
|
14
14
|
| **Value-pattern** | `valuePatterns` | `RegExp[]` | `[]` | Opt-in: redact scalars whose string form matches a pattern |
|
|
15
15
|
| **Path rule** | `pathRules` | `PathRule[]` | `[]` | Apply a mode at a JSON path (`metadata.*.value`) |
|
|
@@ -4,6 +4,8 @@ Per-version release notes for published **field-redactor** git tags. npm release
|
|
|
4
4
|
|
|
5
5
|
| Version | npm | Notes |
|
|
6
6
|
| --- | --- | --- |
|
|
7
|
+
| **v1.6.2** | Yes | [v1.6.2.md](v1.6.2.md) — canonical opaque/remove naming; drop ObjectRedactor façade |
|
|
8
|
+
| **v1.6.1** | Yes | [v1.6.1.md](v1.6.1.md) — internal simplification / layering cleanup |
|
|
7
9
|
| **v1.6.0** | Yes | [v1.6.0.md](v1.6.0.md) — path rules, passKeys, naming aliases, architecture |
|
|
8
10
|
| **v1.5.0** | Yes | [v1.5.0.md](v1.5.0.md) — DX polish, value patterns, unified traversal |
|
|
9
11
|
| v1.3.0 | No (superseded by 1.5.0) | [v1.3.0.md](v1.3.0.md) — sync API, COW, builder, dryRun, presets |
|
|
@@ -15,7 +17,7 @@ Per-version release notes for published **field-redactor** git tags. npm release
|
|
|
15
17
|
|
|
16
18
|
## Migration
|
|
17
19
|
|
|
18
|
-
- [1.5.x → 1.6.
|
|
20
|
+
- [1.5.x → 1.6.x](../guides/migration-1.5-to-1.6.md) — path rules, naming aliases, package exports
|
|
19
21
|
- [1.2.x → 1.5.0](../guides/migration-1.2-to-1.5.md) — upgrade path from the previous npm line
|
|
20
22
|
|
|
21
23
|
## Internal milestones (removed)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Release notes — v1.6.1
|
|
2
|
+
|
|
3
|
+
Field Redactor **1.6.1** is a patch release focused on internal simplification after **1.6.0**. Behavior and the documented public API are unchanged for typical `import { … } from 'field-redactor'` consumers.
|
|
4
|
+
|
|
5
|
+
**Upgrade from 1.6.0:** Install `1.6.1`. No config or call-site changes required unless you relied on the undocumented convenience alias `FieldRedactor.fromConfig()` (use `new FieldRedactor(config)` or `create` / `createSafe` instead).
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
| Area | What changed |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| **Custom objects** | One `handleField` path; single match-type dispatcher |
|
|
12
|
+
| **Layering** | Sibling-key + primitive helpers live under `rules/` / `util/` (rules no longer import engine) |
|
|
13
|
+
| **Config** | Alias normalize once on construct; shared `forceDeepForKey` / path-mode map |
|
|
14
|
+
| **Dead code** | Removed unused re-export shims and dry-run attribution wrappers |
|
|
15
|
+
|
|
16
|
+
## Removed
|
|
17
|
+
|
|
18
|
+
- `FieldRedactor.fromConfig(config)` — was identical to `new FieldRedactor(config)` and unused in-repo.
|
|
19
|
+
|
|
20
|
+
## Links
|
|
21
|
+
|
|
22
|
+
- [CHANGELOG](../../CHANGELOG.md)
|
|
23
|
+
- [Release notes v1.6.0](v1.6.0.md)
|
|
24
|
+
- [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Release notes — v1.6.2
|
|
2
|
+
|
|
3
|
+
Field Redactor **1.6.2** folds two internal cleanups onto **1.6.1**: Opaque/Remove as the canonical config and runtime vocabulary, and removal of the thin `ObjectRedactor` orchestrator. Typical `import { … } from 'field-redactor'` consumers need no call-site changes.
|
|
4
|
+
|
|
5
|
+
**Upgrade from 1.6.1:** Install `1.6.2`. Prefer `opaqueSecretKeys` / `removeSecretKeys` and `CustomObjectMatchType.Opaque` / `Remove` in new config; legacy `fullSecretKeys` / `deleteSecretKeys` and `Full` / `Delete` still work.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
| Area | What changed |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| **Naming** | Canonical storage and matching use opaque/remove; full/delete are input-only aliases |
|
|
12
|
+
| **SecretManager** | `isOpaqueSecretKey` / `isRemoveSecretKey` (legacy config keys still accepted) |
|
|
13
|
+
| **Builder / presets** | Write preferred field names |
|
|
14
|
+
| **Engine** | `FieldRedactor` → `ObjectRedactorTraversal` directly; builder uses a static import |
|
|
15
|
+
|
|
16
|
+
## Compatibility
|
|
17
|
+
|
|
18
|
+
- Public root API unchanged for normal usage
|
|
19
|
+
- `FieldRedactorConfigBuilder.buildRedactor()` / `buildSafeRedactor()` behavior unchanged
|
|
20
|
+
- Docs and presets lead with Opaque/Remove vocabulary
|
|
21
|
+
|
|
22
|
+
## Links
|
|
23
|
+
|
|
24
|
+
- [CHANGELOG](../../CHANGELOG.md)
|
|
25
|
+
- [Release notes v1.6.1](v1.6.1.md)
|
|
26
|
+
- [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
|