@jini-ai/diagnostics 0.6.19 → 0.6.22
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 +4 -0
- package/dist/core/secrets-only.js +17 -8
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -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
|
},
|
|
@@ -140,6 +142,12 @@ const REDACTION_RULES = [
|
|
|
140
142
|
pattern: new RegExp(`"(${LABELED_SECRET_LABELS})"(\\s*:\\s*)"(?!\\[REDACTED)[^"]+"`, "gi"),
|
|
141
143
|
replacement: ({ match: m }) => `"${m[1]}"${m[2]}"[REDACTED:labeled_secret]"`,
|
|
142
144
|
},
|
|
145
|
+
{
|
|
146
|
+
kind: "labeled_secret",
|
|
147
|
+
// Multi-word quoted keys can hold credentials too; translated phrases with spaces stay prose.
|
|
148
|
+
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"),
|
|
149
|
+
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[1]}${m[3]}${m[4]}[REDACTED:labeled_secret]${m[4]}`,
|
|
150
|
+
},
|
|
143
151
|
{
|
|
144
152
|
kind: "labeled_secret",
|
|
145
153
|
// Colon form: `api_key: <value>`, `{ api_key: 'value' }`, `\"api_key\":\"value\"` (2026-09-16
|
|
@@ -152,8 +160,9 @@ const REDACTION_RULES = [
|
|
|
152
160
|
// always taken, an unquoted one only when it is a single ≥12-character token. That is what keeps
|
|
153
161
|
// this file's Must NOT change list intact — `password: must be at least 8 characters` stops at
|
|
154
162
|
// the 4-character `must`, and `token expired at ...` has no colon at all.
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
// Match the whole key; multi-word labels above additionally require an opaque value.
|
|
164
|
+
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"),
|
|
165
|
+
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[1]}${m[3]}${m[4] ?? ""}[REDACTED:labeled_secret]${m[4] ?? ""}`,
|
|
157
166
|
},
|
|
158
167
|
{
|
|
159
168
|
kind: "labeled_secret",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/diagnostics",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
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/core": "^0.6.
|
|
86
|
-
"@jini-ai/analytics": "^0.6.
|
|
85
|
+
"@jini-ai/core": "^0.6.22",
|
|
86
|
+
"@jini-ai/analytics": "^0.6.22"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"js-tokens": "^9.0.1",
|
|
90
90
|
"jszip": "^3.10.1",
|
|
91
|
-
"@jini-ai/core": "^0.6.
|
|
91
|
+
"@jini-ai/core": "^0.6.22"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"build": "tsc -p tsconfig.json",
|