@jini-ai/diagnostics 0.6.19 → 0.7.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/CHANGELOG.md +17 -0
- package/dist/core/secrets-only.js +22 -10
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @jini-ai/diagnostics
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8fe045b]
|
|
8
|
+
- Updated dependencies [41ff2ff]
|
|
9
|
+
- Updated dependencies [a266ba8]
|
|
10
|
+
- Updated dependencies [27063ef]
|
|
11
|
+
- Updated dependencies [6ab1d81]
|
|
12
|
+
- Updated dependencies [699b478]
|
|
13
|
+
- Updated dependencies [39cf677]
|
|
14
|
+
- @jini-ai/core@0.7.0
|
|
15
|
+
|
|
16
|
+
## 0.6.22
|
|
17
|
+
|
|
18
|
+
- Secret scrubbing: scheme names with no value are no longer treated as credentials; multi-word and prefixed labels are covered, Markdown code boundaries are kept.
|
|
19
|
+
|
|
3
20
|
## 0.6.17
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -23,13 +23,13 @@ const LABELED_SECRET_LABELS = "password|passwd|pwd|secret|client_secret|api_key|
|
|
|
23
23
|
// longer backtrack against each other across long whitespace.
|
|
24
24
|
const AUTH_HEADER_NAMES = "(?:proxy-)?authorization|x-api-key|api-key|x-goog-api-key|x-auth-token";
|
|
25
25
|
const AUTH_SCHEMES = "Bearer|Basic|Token|Digest|ApiKey";
|
|
26
|
-
const AUTH_VALUE = String.raw `(?!\[REDACTED)[^\s"'),;]+`;
|
|
26
|
+
const AUTH_VALUE = String.raw `(?!\[REDACTED)(?:(?!\x60(?=[\s"'.,);]|$))[^\s"'),;])+`;
|
|
27
27
|
const AUTH_HEADER_VALUE_RE = new RegExp(String.raw `(?<![a-z0-9-])(${AUTH_HEADER_NAMES})(\s*(?:["']\s*)?[:=]\s*["']?)` +
|
|
28
|
-
String.raw `(?:((?:${AUTH_SCHEMES})\s+)${AUTH_VALUE}|(?!(?:${AUTH_SCHEMES})\
|
|
28
|
+
String.raw `(?:((?:${AUTH_SCHEMES})\s+)${AUTH_VALUE}|(?!(?:${AUTH_SCHEMES})(?:\s|["'\x60),;]|$))${AUTH_VALUE})`, "gi");
|
|
29
29
|
/**
|
|
30
30
|
* Every rule this module applies, in order. Order matters: `private_key` must run before the
|
|
31
|
-
* reused
|
|
32
|
-
*
|
|
31
|
+
* reused PEM pattern (inside {@link REUSED_CREDENTIAL_RULES}) so a full block keeps this
|
|
32
|
+
* policy's private_key marker rather than the generic credential marker; `auth_header` must run
|
|
33
33
|
* before the bare `bearer_token` rule so a header's own scheme+token is not ALSO caught by the
|
|
34
34
|
* looser bare-token rule.
|
|
35
35
|
*/
|
|
@@ -53,9 +53,11 @@ const REDACTION_RULES = [
|
|
|
53
53
|
// already-redacted text (`Authorization: Bearer [REDACTED:auth_header]`) would fail the
|
|
54
54
|
// `(?!\[REDACTED)` lookahead on the "with scheme" attempt, backtrack the optional group away,
|
|
55
55
|
// and then match the bare word "Bearer" itself as the "value" — corrupting already-redacted
|
|
56
|
-
// text. The second alternative
|
|
57
|
-
//
|
|
56
|
+
// text. The second alternative explicitly refuses a scheme keyword followed by whitespace
|
|
57
|
+
// or a value terminator, so when the first alternative's lookahead fails there is no fallback left to
|
|
58
58
|
// backtrack into, and the whole rule correctly finds no match on a second pass.
|
|
59
|
+
// Scheme names without a following value (including Markdown's `Authorization: Bearer`)
|
|
60
|
+
// describe a header; they are not themselves credentials.
|
|
59
61
|
pattern: AUTH_HEADER_VALUE_RE,
|
|
60
62
|
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[3] ?? ""}[REDACTED:auth_header]`,
|
|
61
63
|
},
|
|
@@ -71,8 +73,11 @@ const REDACTION_RULES = [
|
|
|
71
73
|
// review): a password that was never percent-encoded — `postgres://u:p@ss4@host/db` — otherwise
|
|
72
74
|
// matched only up to its FIRST `@`, leaving the tail (`ss4`) of the password in the output.
|
|
73
75
|
// `?` is excluded so a query string's own `@` cannot drag the match past the authority.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
// Find the delimiter before checking the original scheme grammar. Starting at each word
|
|
77
|
+
// boundary rescans long dashed runs quadratically; delimiter-first checks disjoint runs once.
|
|
78
|
+
// The scheme stays outside the replacement, including suffixes after malformed prefixes.
|
|
79
|
+
pattern: /:\/\/(?<=\b[a-z][a-z0-9+.-]*:\/\/)(?!\[REDACTED)[^\s/@:]+:[^\s/?]+@/gi,
|
|
80
|
+
replacement: () => "://[REDACTED:url_credentials]@",
|
|
76
81
|
},
|
|
77
82
|
...REUSED_CREDENTIAL_RULES,
|
|
78
83
|
{
|
|
@@ -140,6 +145,12 @@ const REDACTION_RULES = [
|
|
|
140
145
|
pattern: new RegExp(`"(${LABELED_SECRET_LABELS})"(\\s*:\\s*)"(?!\\[REDACTED)[^"]+"`, "gi"),
|
|
141
146
|
replacement: ({ match: m }) => `"${m[1]}"${m[2]}"[REDACTED:labeled_secret]"`,
|
|
142
147
|
},
|
|
148
|
+
{
|
|
149
|
+
kind: "labeled_secret",
|
|
150
|
+
// Multi-word quoted keys can hold credentials too; translated phrases with spaces stay prose.
|
|
151
|
+
pattern: new RegExp(String.raw `(["'])((?:[A-Za-z0-9_-]{1,32}[ \t]+){1,6}(?:${LABELED_SECRET_LABELS}))\1(\s*:\s*)(["'])(?!\[REDACTED)[^\s"'\\]{12,}\4`, "gi"),
|
|
152
|
+
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[1]}${m[3]}${m[4]}[REDACTED:labeled_secret]${m[4]}`,
|
|
153
|
+
},
|
|
143
154
|
{
|
|
144
155
|
kind: "labeled_secret",
|
|
145
156
|
// Colon form: `api_key: <value>`, `{ api_key: 'value' }`, `\"api_key\":\"value\"` (2026-09-16
|
|
@@ -152,8 +163,9 @@ const REDACTION_RULES = [
|
|
|
152
163
|
// always taken, an unquoted one only when it is a single ≥12-character token. That is what keeps
|
|
153
164
|
// this file's Must NOT change list intact — `password: must be at least 8 characters` stops at
|
|
154
165
|
// the 4-character `must`, and `token expired at ...` has no colon at all.
|
|
155
|
-
|
|
156
|
-
|
|
166
|
+
// Match the whole key; multi-word labels above additionally require an opaque value.
|
|
167
|
+
pattern: new RegExp(`(?<![A-Za-z0-9])((?:\\\\?["'])?)((?:[A-Za-z0-9]{1,32}[_-]){0,6}(?:${LABELED_SECRET_LABELS}))\\1(\\s*:\\s*)(?:(\\\\?["'])(?!\\[REDACTED)[^"'\\\\\\r\\n]+\\4|(?!\\[REDACTED)[^\\s"',;}]{12,})`, "gi"),
|
|
168
|
+
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[1]}${m[3]}${m[4] ?? ""}[REDACTED:labeled_secret]${m[4] ?? ""}`,
|
|
157
169
|
},
|
|
158
170
|
{
|
|
159
171
|
kind: "labeled_secret",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/diagnostics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Diagnostics-bundle tooling: JSON/text secret redaction, log-source collection, manifest building, and zip packaging for support exports.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@vitest/coverage-v8": "^2.1.9",
|
|
84
84
|
"jszip": "^3.10.1",
|
|
85
|
-
"@jini-ai/
|
|
86
|
-
"@jini-ai/
|
|
85
|
+
"@jini-ai/analytics": "^0.7.0",
|
|
86
|
+
"@jini-ai/core": "^0.7.0"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"js-tokens": "^9.0.1",
|
|
90
90
|
"jszip": "^3.10.1",
|
|
91
|
-
"@jini-ai/core": "^0.
|
|
91
|
+
"@jini-ai/core": "^0.7.0"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"build": "tsc -p tsconfig.json",
|