@jini-ai/diagnostics 0.7.3-next.3 → 0.7.4
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 +7 -0
- package/dist/browser-diagnostics.js +1 -1
- package/dist/core/secrets-only.d.ts +2 -1
- package/dist/core/secrets-only.js +13 -4
- package/dist/redaction/secret-scan.js +2 -4
- package/dist/web-evidence/page-performance-script.js +3 -3
- package/dist/web-evidence/web-screenshot/tool-registrations.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @jini-ai/diagnostics
|
|
2
2
|
|
|
3
|
+
## 0.7.4
|
|
4
|
+
|
|
5
|
+
### Changes
|
|
6
|
+
|
|
7
|
+
- Add page capture, live-URL inspection, DNS, server-log tools, and bounded redacted output retention.
|
|
8
|
+
- Skip undecodable tool-gap rows without consuming the result limit.
|
|
9
|
+
|
|
3
10
|
## 0.7.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -18,7 +18,7 @@ export async function browserDiagnosticsEnabled({ observability, consentSetting
|
|
|
18
18
|
export async function receiveBrowserDiagnostics({ body, contentType }, { deps }) {
|
|
19
19
|
if (!(await browserDiagnosticsEnabled({ observability: deps.observability, consentSetting: deps.consentSetting }, deps)))
|
|
20
20
|
return { status: 404, body: '' };
|
|
21
|
-
if (
|
|
21
|
+
if (contentType.replace(/;[\s\S]*$/, '').trim().toLowerCase() !== 'application/json')
|
|
22
22
|
return { status: 415, body: '' };
|
|
23
23
|
if (body.byteLength > 256)
|
|
24
24
|
return { status: 413, body: '' };
|
|
@@ -46,5 +46,6 @@ export declare function redactSecretShapes({ text, policy }: {
|
|
|
46
46
|
text: string;
|
|
47
47
|
policy: RedactionPolicy;
|
|
48
48
|
}): SecretRedaction;
|
|
49
|
-
export { SECRET_SHAPE_PATTERNS as SECRET_PATTERNS, PEM_PATTERN_NAME
|
|
49
|
+
export { SECRET_SHAPE_PATTERNS as SECRET_PATTERNS, PEM_PATTERN_NAME } from "@jini-ai/core/redaction";
|
|
50
|
+
export type { SecretShapePattern as SecretPattern } from "@jini-ai/core";
|
|
50
51
|
//# sourceMappingURL=secrets-only.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SECRET_SHAPE_PATTERNS } from "@jini-ai/core";
|
|
1
|
+
import { SECRET_SHAPE_PATTERNS } from "@jini-ai/core/redaction";
|
|
2
2
|
import jsTokens, {} from "js-tokens";
|
|
3
3
|
/** Adds the `g` flag when a source pattern (e.g. one of {@link SECRET_SHAPE_PATTERNS}, authored for a
|
|
4
4
|
* single `RegExp.exec` caller) does not already carry it — `String.replace` only replaces every
|
|
@@ -21,9 +21,11 @@ const LABELED_SECRET_LABELS = "password|passwd|pwd|secret|client_secret|api_key|
|
|
|
21
21
|
// Parts of the auth-header rule below. The separator's optional quote now carries its own trailing
|
|
22
22
|
// space run (`\s*(?:["']\s*)?` matches exactly what `\s*["']?\s*` did) so two adjacent `\s*` runs no
|
|
23
23
|
// longer backtrack against each other across long whitespace.
|
|
24
|
-
const AUTH_HEADER_NAMES = "(?:proxy-)?authorization|
|
|
24
|
+
const AUTH_HEADER_NAMES = "(?:proxy-)?authorization|api-key|x-(?:[a-z0-9]+-)*(?:auth(?:orization)?|key|token|secret|credential)";
|
|
25
25
|
const AUTH_SCHEMES = "Bearer|Basic|Token|Digest|ApiKey";
|
|
26
26
|
const AUTH_VALUE = String.raw `(?!\[REDACTED)(?:(?!\x60(?=[\s"'.,);]|$))[^\s"'),;])+`;
|
|
27
|
+
const DIGEST_PARAMETER = String.raw `[\w-]+[ \t]*=[ \t]*(?:"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'|[^\s"',;}]+)`;
|
|
28
|
+
const DIGEST_AUTH_HEADER_RE = new RegExp(String.raw `(?<![a-z0-9-])(${AUTH_HEADER_NAMES})(\s*(?:["']\s*)?[:=]\s*["']?)(Digest[ \t]+)${DIGEST_PARAMETER}(?:,[ \t]*${DIGEST_PARAMETER})*`, 'gi');
|
|
27
29
|
const AUTH_HEADER_VALUE_RE = new RegExp(String.raw `(?<![a-z0-9-])(${AUTH_HEADER_NAMES})(\s*(?:["']\s*)?[:=]\s*["']?)` +
|
|
28
30
|
String.raw `(?:((?:${AUTH_SCHEMES})\s+)${AUTH_VALUE}|(?!(?:${AUTH_SCHEMES})(?:\s|["'\x60),;]|$))${AUTH_VALUE})`, "gi");
|
|
29
31
|
/**
|
|
@@ -42,6 +44,13 @@ const REDACTION_RULES = [
|
|
|
42
44
|
pattern: /-----BEGIN ([A-Z ]*)PRIVATE KEY-----[\s\S]*?(?:-----END \1PRIVATE KEY-----|$)/g,
|
|
43
45
|
replacement: () => "[REDACTED:private_key]",
|
|
44
46
|
},
|
|
47
|
+
{
|
|
48
|
+
kind: "auth_header",
|
|
49
|
+
// Digest carries several quoted credentials; consume the complete list before the one-token
|
|
50
|
+
// header rule can replace its prefix and leave the remaining parameters in chat or errors.
|
|
51
|
+
pattern: DIGEST_AUTH_HEADER_RE,
|
|
52
|
+
replacement: ({ match: m }) => `${m[1]}${m[2]}${m[3]}[REDACTED:auth_header]`,
|
|
53
|
+
},
|
|
45
54
|
{
|
|
46
55
|
kind: "auth_header",
|
|
47
56
|
// The value is ONE token after an optional known scheme, never the rest of the line — a
|
|
@@ -170,7 +179,7 @@ const REDACTION_RULES = [
|
|
|
170
179
|
{
|
|
171
180
|
kind: "labeled_secret",
|
|
172
181
|
// Query-string form: `?key=value` / `&token=value`.
|
|
173
|
-
pattern: /([?&](?:key|api_key|api-key|token|access_token|sig|signature)=)(?!\[REDACTED)[^&#\s"']+/gi,
|
|
182
|
+
pattern: /([?&](?:key|api_key|api-key|token|access_token|sig|signature|(?:(?:activation|authorization|auth|device|user|recovery)[._-])?code)=)(?!\[REDACTED)[^&#\s"']+/gi,
|
|
174
183
|
replacement: ({ match: m }) => `${m[1]}[REDACTED:labeled_secret]`,
|
|
175
184
|
},
|
|
176
185
|
];
|
|
@@ -373,5 +382,5 @@ export function redactSecretShapes({ text, policy }) {
|
|
|
373
382
|
return applyRedactionRules({ text, rules });
|
|
374
383
|
}
|
|
375
384
|
// Preserve the public scanner vocabulary while core owns the single pattern catalog.
|
|
376
|
-
export { SECRET_SHAPE_PATTERNS as SECRET_PATTERNS, PEM_PATTERN_NAME } from "@jini-ai/core";
|
|
385
|
+
export { SECRET_SHAPE_PATTERNS as SECRET_PATTERNS, PEM_PATTERN_NAME } from "@jini-ai/core/redaction";
|
|
377
386
|
//# sourceMappingURL=secrets-only.js.map
|
|
@@ -4,13 +4,11 @@ import { SECRET_PATTERNS } from "../core/secrets-only.js";
|
|
|
4
4
|
export function scanTextForSecrets({ text }, _optional = {}) {
|
|
5
5
|
const hits = [];
|
|
6
6
|
for (const { name, pattern } of SECRET_PATTERNS) {
|
|
7
|
-
|
|
8
|
-
const re = new RegExp(pattern.source, flags);
|
|
7
|
+
// The fixed secret vocabulary has no global flags or empty matches.
|
|
8
|
+
const re = new RegExp(pattern.source, `${pattern.flags}g`);
|
|
9
9
|
let match;
|
|
10
10
|
while ((match = re.exec(text)) !== null) {
|
|
11
11
|
hits.push({ patternName: name, index: match.index, value: match[0] });
|
|
12
|
-
if (match[0].length === 0)
|
|
13
|
-
re.lastIndex += 1; // guard against zero-length matches looping
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
return hits;
|
|
@@ -24,15 +24,15 @@ export async function collectPagePerformance(_required, _options = {}) {
|
|
|
24
24
|
counts.hiddenPreTextChars += node.textContent?.length ?? 0; };
|
|
25
25
|
const walker = document.createTreeWalker(document, NodeFilter.SHOW_ALL);
|
|
26
26
|
let domNodes = 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return { domNodes, domTruncated: node !== null, ...counts };
|
|
27
|
+
let node = walker.nextNode();
|
|
28
|
+
for (; node !== null && domNodes < 100_000; node = walker.nextNode()) {
|
|
30
29
|
domNodes++;
|
|
31
30
|
if (node.nodeType === Node.ELEMENT_NODE)
|
|
32
31
|
countElement(node);
|
|
33
32
|
else if (node.nodeType === Node.TEXT_NODE)
|
|
34
33
|
countText(node);
|
|
35
34
|
}
|
|
35
|
+
return { domNodes, domTruncated: node !== null, ...counts };
|
|
36
36
|
}
|
|
37
37
|
async function sampleLongTasks() {
|
|
38
38
|
const longTasks = { supported: false, count: 0, totalMs: 0, maxMs: 0, truncated: false };
|
|
@@ -21,7 +21,7 @@ export function buildWebScreenshotRegistrations({ routeDeps, service, catalog, p
|
|
|
21
21
|
["web_screenshot_page"]: async (ctx) => {
|
|
22
22
|
const input = readInput({ input: requireInputRecord({ input: ctx.input }) });
|
|
23
23
|
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: routeDeps.authorize }), workspaceId: routeDeps.workspaceId, principalId: ctx.principal.id, permission }, { entityType: "web-page" });
|
|
24
|
-
return service.screenshot({ input, ...(openOwnSite ? { openOwnSite } : {}), ...(saveCaptureFiles ? { saveCaptureFiles } : {}) },
|
|
24
|
+
return service.screenshot({ input, ...(openOwnSite ? { openOwnSite } : {}), ...(saveCaptureFiles ? { saveCaptureFiles } : {}) }, { signal: ctx.signal });
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
return buildDomainRegistrations({ metadata: toolMetadata, domain: DOMAIN, catalogModule: "features/web-screenshot/agent-tools.ts", catalog: indexCatalogById({ catalog }), handlers, derivedRisk: webScreenshotDerivedRisk });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/diagnostics",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
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": {
|
|
@@ -226,13 +226,13 @@
|
|
|
226
226
|
"jszip": "^3.10.1",
|
|
227
227
|
"kysely": "^0.29.6",
|
|
228
228
|
"parse5": "7.3.0",
|
|
229
|
-
"@jini-ai/analytics": "^0.7.
|
|
230
|
-
"@jini-ai/core": "^0.7.
|
|
229
|
+
"@jini-ai/analytics": "^0.7.4",
|
|
230
|
+
"@jini-ai/core": "^0.7.4"
|
|
231
231
|
},
|
|
232
232
|
"dependencies": {
|
|
233
233
|
"js-tokens": "^9.0.1",
|
|
234
234
|
"jszip": "^3.10.1",
|
|
235
|
-
"@jini-ai/core": "^0.7.
|
|
235
|
+
"@jini-ai/core": "^0.7.4"
|
|
236
236
|
},
|
|
237
237
|
"peerDependencies": {
|
|
238
238
|
"kysely": "^0.29.6",
|