@redact-secret/adapter-otel-trace 0.1.3 → 0.1.5
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 +18 -0
- package/README.md +4 -3
- package/dist/index.js +2 -2
- package/dist/span-processor.js +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -25,6 +25,24 @@ version numbers start again here, at `0.1.0`, and do not follow the old name's.
|
|
|
25
25
|
|
|
26
26
|
## [Unreleased]
|
|
27
27
|
|
|
28
|
+
## [0.1.5] - 2026-10-07
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **Breaking for consumers on Node 20: Node 20 is no longer supported.** `engines.node` is now `22.x || 24.x` (was `20.x || 22.x || 24.x`) and CI no longer runs Node 20. The code is unchanged, but a Node 20 install now warns (an error under `engine-strict`) and is not tested; stay on the previous release if you must run Node 20. Shipped in a patch release at the maintainer's decision, although it is a breaking engines change.
|
|
33
|
+
|
|
34
|
+
## [0.1.4] - 2026-10-07
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Requires `@redact-secret/adapter` `^0.1.9` (was `^0.1.7`) for `actionPolicy`, `scanConfigOf` and the scan-config conflict contract. Backed by the live tests of this package and CI's `published-combination` job.
|
|
39
|
+
- Verified against `@redact-secret/core` 0.1.0-beta.14. The declared core range is unchanged.
|
|
40
|
+
- `createRedactingSpanProcessor`: an injected `scanConfig` beside any loose scan option (`policy`, `actionPolicy`, `scanLimits`, `ruleset`, `placeholderFormatter`) is rejected with a fixed `TypeError` before the core is loaded, instead of the config silently winning; the injected configuration is the one verified against the core (redact-secret-adapters#213). Needs `@redact-secret/adapter` with `scanConfigOf`. Test: `test/injected-scan-config-live.test.ts`.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- `actionPolicy` on `createRedactingSpanProcessor`, applied to every string of a span (name, attributes, events, links), with the shared snapshot, callback-conflict and capability checks of `@redact-secret/adapter` (redact-secret-adapters#217). Needs `@redact-secret/core` 0.1.0-beta.14 or later (the first published release that accepts it); an older core is rejected by name with `CoreOptionsError` (`CORE_OPTION_UNSUPPORTED`) and every other option keeps working on the declared floor. The package range is unchanged; the new tests in `compatibility.json` run at both endpoints (the option applies at the upper one, is rejected at the lower one). Test: `test/action-policy-live.test.ts` (the exported span for each action).
|
|
45
|
+
|
|
28
46
|
## [0.1.3] - 2026-10-03
|
|
29
47
|
### Changed
|
|
30
48
|
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ core, which does the detection.
|
|
|
22
22
|
npm install @redact-secret/core @redact-secret/adapter-otel-trace @opentelemetry/sdk-trace-base
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Needs Node.js
|
|
25
|
+
Needs Node.js 22 or 24 and `@opentelemetry/sdk-trace-base ^2.0.0`. ESM only.
|
|
26
26
|
|
|
27
27
|
## Quick start
|
|
28
28
|
|
|
@@ -92,7 +92,7 @@ Attribute names are not allowlisted, so OpenInference (`llm.input_messages`,
|
|
|
92
92
|
**This is a trace processor only.** A `LogRecord` never passes through it and
|
|
93
93
|
reaches its exporter as it was written. For logs use
|
|
94
94
|
[`@redact-secret/adapter-otel-logs`](https://github.com/redact-secret/redact-secret-adapters/tree/main/packages/adapter-otel-logs),
|
|
95
|
-
a separate package currently published as a beta (`0.1.0-beta.
|
|
95
|
+
a separate package currently published as a beta (`0.1.0-beta.4`, dist-tag `beta`).
|
|
96
96
|
|
|
97
97
|
When a value cannot be scanned, a fixed marker replaces it. See
|
|
98
98
|
[`@redact-secret/adapter`](https://github.com/redact-secret/redact-secret-adapters/tree/main/packages/adapter#fail-closed-markers)
|
|
@@ -117,7 +117,7 @@ assertion is not optional.
|
|
|
117
117
|
## Options
|
|
118
118
|
|
|
119
119
|
```js
|
|
120
|
-
await createRedactingSpanProcessor(next, { pii, onOutcome, policy, maxStringLength, operationLimits, scanLimits, ruleset, placeholderFormatter });
|
|
120
|
+
await createRedactingSpanProcessor(next, { pii, onOutcome, policy, maxStringLength, operationLimits, scanLimits, ruleset, placeholderFormatter, actionPolicy });
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
| Option | What it does |
|
|
@@ -128,6 +128,7 @@ await createRedactingSpanProcessor(next, { pii, onOutcome, policy, maxStringLeng
|
|
|
128
128
|
| `scanLimits` | The core's whole-input limits, `{ maxInputBytes, maxFindings }`, for every scan. See [Core scan options](https://github.com/redact-secret/redact-secret-adapters/tree/main/packages/adapter#core-scan-options) |
|
|
129
129
|
| `ruleset` | A declarative detector ruleset (text or bytes) |
|
|
130
130
|
| `placeholderFormatter` | The core's placeholder formatter |
|
|
131
|
+
| `actionPolicy` | The core's declarative action policy (object, JSON text or bytes), for every string of a span. Mutually exclusive with `policy`; needs core `0.1.0-beta.14` or later, else construction rejects with `CoreOptionsError`. See [Declarative `actionPolicy`](https://github.com/redact-secret/redact-secret-adapters/tree/main/packages/adapter#declarative-actionpolicy) |
|
|
131
132
|
| `maxStringLength` | Strings longer than this become `[REDACTED:LIMIT_EXCEEDED]` unscanned |
|
|
132
133
|
| `operationLimits` | Override the aggregate budget of **one span**. See below |
|
|
133
134
|
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* PII off. See `@redact-secret/adapter`'s `activateCore` for the whole rule,
|
|
28
28
|
* including why activation is not the same as masking every PII value.
|
|
29
29
|
*/
|
|
30
|
-
import { activateCore,
|
|
30
|
+
import { activateCore, scanConfigOf, verifyScanOptions } from "@redact-secret/adapter";
|
|
31
31
|
import { RedactingSpanProcessorWith } from "./span-processor.js";
|
|
32
32
|
export { RedactingSpanProcessorWith, redactAttributesWith, } from "./span-processor.js";
|
|
33
33
|
/**
|
|
@@ -46,7 +46,7 @@ export async function createRedactingSpanProcessor(next, options = {}) {
|
|
|
46
46
|
const activation = options.pii === undefined ? {} : { pii: options.pii };
|
|
47
47
|
// Validated before the core is touched; then the installed core must honor
|
|
48
48
|
// any requested scan option or this rejects with a fixed `CoreOptionsError`.
|
|
49
|
-
const config =
|
|
49
|
+
const config = scanConfigOf(options);
|
|
50
50
|
const loaded = await import("@redact-secret/core");
|
|
51
51
|
await activateCore(loaded, activation);
|
|
52
52
|
verifyScanOptions(loaded, config);
|
package/dist/span-processor.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* wrapping one needs no dependency, and this module is testable with a
|
|
26
26
|
* plain object.
|
|
27
27
|
*/
|
|
28
|
-
import { countLeaf, createOperationBudget, createOutcomeCounter, ERROR_MARKER, LIMIT_MARKER, maskLeafOutcomeWith, notify,
|
|
28
|
+
import { bindScanConfig, countLeaf, createOperationBudget, createOutcomeCounter, ERROR_MARKER, LIMIT_MARKER, maskLeafOutcomeWith, notify, toValueCounts, } from "@redact-secret/adapter";
|
|
29
29
|
/** A span field that did not take a masked write. The message names the field, never its value. */
|
|
30
30
|
class UnredactableFieldError extends Error {
|
|
31
31
|
}
|
|
@@ -106,7 +106,7 @@ function redactBag(mask, budget, bag, field) {
|
|
|
106
106
|
export function redactAttributesWith(scanAndRedact, attributes, options = {}) {
|
|
107
107
|
const { operationLimits, ...leafOptions } = options;
|
|
108
108
|
const budget = createOperationBudget(operationLimits);
|
|
109
|
-
const resolved =
|
|
109
|
+
const resolved = bindScanConfig(leafOptions);
|
|
110
110
|
try {
|
|
111
111
|
redactBag(maskerFor(scanAndRedact, resolved, () => ({ counter: undefined, budget })), budget, attributes, "attributes");
|
|
112
112
|
}
|
|
@@ -167,7 +167,7 @@ export class RedactingSpanProcessorWith {
|
|
|
167
167
|
// Validated and snapshotted once, here: a malformed scan option is a
|
|
168
168
|
// programming error at construction, and every leaf is scanned with the
|
|
169
169
|
// one snapshot.
|
|
170
|
-
const maskOptions =
|
|
170
|
+
const maskOptions = bindScanConfig(rawOptions);
|
|
171
171
|
if (onOutcome !== undefined && typeof onOutcome !== "function") {
|
|
172
172
|
throw new TypeError("RedactingSpanProcessorWith: onOutcome must be a function");
|
|
173
173
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redact-secret/adapter-otel-trace",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "A redacting OpenTelemetry JS SpanProcessor (traces only) over the Redact Secret core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": "
|
|
22
|
+
"node": "22.x || 24.x"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@redact-secret/adapter": "^0.1.
|
|
38
|
+
"@redact-secret/adapter": "^0.1.9"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|