@dx-do/util 6.3.4 → 6.4.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/dist/index.cjs.js +95 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +94 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/security/redact.d.ts +28 -0
- package/dist/src/lib/security/redact.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export * from "./lib/map/non-overwriting-map";
|
|
|
12
12
|
export * from "./lib/map/set-map";
|
|
13
13
|
export * from "./lib/map/strict-map";
|
|
14
14
|
export * from "./lib/map/stringify-map-support";
|
|
15
|
+
export * from "./lib/security/redact";
|
|
15
16
|
export * from "./lib/stream/filter-empty.transform";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction helpers for keeping auth tokens and other secrets out of logs.
|
|
3
|
+
*
|
|
4
|
+
* Auth tokens live in axios `error.config.headers` — e.g. `Authorization: Bearer
|
|
5
|
+
* <userToken>` and `X-Asm-Auth: <dxASMToken>`. Anything that serializes a whole
|
|
6
|
+
* error / config / headers object (`JSON.stringify`, an AxiosError's `.toJSON()`,
|
|
7
|
+
* `console.log(err)`, or a logger that deep-prints its argument) will spill them.
|
|
8
|
+
* These helpers strip the secrets before anything is logged or re-thrown.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Returns a deep copy of `value` with sensitive object keys masked and any
|
|
12
|
+
* `Bearer <token>` substrings scrubbed. Safe to pass anything: it is
|
|
13
|
+
* circular-reference safe (axios errors are circular), and `Error` instances are
|
|
14
|
+
* reduced to `{ name, message, stack }` (all scrubbed) so their token-bearing
|
|
15
|
+
* `config`/`request`/`response` are dropped entirely.
|
|
16
|
+
*/
|
|
17
|
+
export declare function redactValue(value: unknown, seen?: WeakSet<object>): unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Strips auth tokens from an (possibly Axios) error IN PLACE and returns it, so it
|
|
20
|
+
* stays a throwable `Error` with its stack intact but no longer carries the token
|
|
21
|
+
* in `config.headers`, `response.config.headers`, or the raw request header string.
|
|
22
|
+
* Non-error / non-axios values are returned unchanged.
|
|
23
|
+
*
|
|
24
|
+
* Use this at the axios boundary (a response error interceptor) so every catch,
|
|
25
|
+
* re-throw, and top-level handler downstream sees a token-free error.
|
|
26
|
+
*/
|
|
27
|
+
export declare function sanitizeAxiosError(err: unknown): unknown;
|
|
28
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../../src/lib/security/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6BH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,kBAAwB,GAAG,OAAO,CAyBjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAoBxD"}
|