@hasna/logs 0.3.28 → 0.3.29
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/cli/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
runJob,
|
|
9
9
|
structuredLogToEntry,
|
|
10
10
|
validateStructuredLogReferences
|
|
11
|
-
} from "../index-
|
|
11
|
+
} from "../index-89jb7jg9.js";
|
|
12
12
|
import {
|
|
13
13
|
PACKAGE_VERSION,
|
|
14
14
|
createPage,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
searchTestReports,
|
|
31
31
|
summarizeLogs,
|
|
32
32
|
validateUniversalEventInput
|
|
33
|
-
} from "../index-
|
|
33
|
+
} from "../index-dbhpykkz.js";
|
|
34
34
|
import {
|
|
35
35
|
getStorageStatus,
|
|
36
36
|
storagePull,
|
|
@@ -508,9 +508,9 @@ function readPositiveInt(name, fallback) {
|
|
|
508
508
|
|
|
509
509
|
// src/lib/redaction.ts
|
|
510
510
|
var REDACTED = "[REDACTED]";
|
|
511
|
-
var SENSITIVE_KEY = /(?:authorization|cookie|set-cookie|api[_-]?key|token|secret|password|passwd|pwd|private[_-]?key|access[_-]?token|refresh[_-]?token|session[_-]?secret|client[_-]?secret)/i;
|
|
512
|
-
var SENSITIVE_FLAG = /^(?:authorization|auth|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?secret)$/i;
|
|
513
|
-
var SENSITIVE_FLAG_NAME = /(?:authorization|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?secret)/i;
|
|
511
|
+
var SENSITIVE_KEY = /(?:authorization|cookie|set-cookie|credentials?\b|api[_-]?key|token|secret|password|passwd|pwd|private[_-]?key|access[_-]?token|refresh[_-]?token|session[_-]?secret|client[_-]?(?:secret|credentials?))/i;
|
|
512
|
+
var SENSITIVE_FLAG = /^(?:authorization|auth|credentials?|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?(?:secret|credentials?))$/i;
|
|
513
|
+
var SENSITIVE_FLAG_NAME = /(?:authorization|credentials?\b|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?(?:secret|credentials?))/i;
|
|
514
514
|
var STRING_PATTERNS = [
|
|
515
515
|
{
|
|
516
516
|
label: "openlogs_canary",
|
|
@@ -564,12 +564,12 @@ var STRING_PATTERNS = [
|
|
|
564
564
|
},
|
|
565
565
|
{
|
|
566
566
|
label: "secret_assignment",
|
|
567
|
-
pattern:
|
|
568
|
-
replacement: (
|
|
567
|
+
pattern: /(?<![?&])\b(credentials?|api[_-]?key|token|secret|password|passwd|pwd|access[_-]?token|refresh[_-]?token|client[_-]?(?:secret|credentials?))\s*[:=]\s*("[^"]*"|'[^']*'|[^\s,;&}]+)/gi,
|
|
568
|
+
replacement: (match, key, value) => isKnownNonSecretCredentialAssignment(key, value) ? match : `${key}=${REDACTED}`
|
|
569
569
|
},
|
|
570
570
|
{
|
|
571
571
|
label: "secret_flag_argument",
|
|
572
|
-
pattern: /(--[A-Za-z0-9._-]*(?:authorization|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?secret)[A-Za-z0-9._-]*\s+)(?:"[^"]*"|'[^']*'|[^\s,;&}]+)/gi,
|
|
572
|
+
pattern: /(--[A-Za-z0-9._-]*(?:authorization|credentials?(?!ed)|api[-_]?key|token|secret|password|passwd|pwd|private[-_]?key|access[-_]?token|refresh[-_]?token|session[-_]?secret|client[-_]?(?:secret|credentials?(?!ed)))[A-Za-z0-9._-]*\s+)(?:"[^"]*"|'[^']*'|[^\s,;&}]+)/gi,
|
|
573
573
|
replacement: (_match, prefix) => `${prefix}${REDACTED}`
|
|
574
574
|
},
|
|
575
575
|
{
|
|
@@ -579,7 +579,7 @@ var STRING_PATTERNS = [
|
|
|
579
579
|
},
|
|
580
580
|
{
|
|
581
581
|
label: "secret_query_param",
|
|
582
|
-
pattern: /([?&](?:api[_-]?key|token|secret|password|passwd|pwd|access[_-]?token|refresh[_-]?token|auth|code)=)[^&#\s]+/gi,
|
|
582
|
+
pattern: /([?&](?:credentials?|api[_-]?key|token|secret|password|passwd|pwd|access[_-]?token|refresh[_-]?token|client[_-]?credentials?|auth|code)=)[^&#\s]+/gi,
|
|
583
583
|
replacement: (_match, prefix) => `${prefix}${REDACTED}`
|
|
584
584
|
}
|
|
585
585
|
];
|
|
@@ -622,11 +622,13 @@ function redactString(input, path = "$") {
|
|
|
622
622
|
for (const { label, pattern, replacement } of STRING_PATTERNS) {
|
|
623
623
|
let matched = false;
|
|
624
624
|
output = output.replace(pattern, (...args) => {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
|
|
625
|
+
const original = args[0] ?? "";
|
|
626
|
+
const next = typeof replacement === "function" ? replacement(original, ...args.slice(1)) : replacement;
|
|
627
|
+
if (next !== original) {
|
|
628
|
+
matched = true;
|
|
629
|
+
replacements += 1;
|
|
630
|
+
}
|
|
631
|
+
return next;
|
|
630
632
|
});
|
|
631
633
|
if (matched)
|
|
632
634
|
fields.push(`${path}:${label}`);
|
|
@@ -669,7 +671,7 @@ function redactValue(input, path = "$", depth = 0) {
|
|
|
669
671
|
const reports = [];
|
|
670
672
|
for (const [key, value] of Object.entries(input)) {
|
|
671
673
|
const childPath = `${path}.${key}`;
|
|
672
|
-
if (
|
|
674
|
+
if (shouldRedactSensitiveKeyValue(key, value)) {
|
|
673
675
|
values[key] = REDACTED;
|
|
674
676
|
reports.push({ applied: true, fields: [childPath], replacements: 1 });
|
|
675
677
|
continue;
|
|
@@ -705,6 +707,24 @@ function isSensitiveFlag(value) {
|
|
|
705
707
|
return false;
|
|
706
708
|
return SENSITIVE_FLAG.test(normalized) || SENSITIVE_FLAG_NAME.test(normalized) || SENSITIVE_KEY.test(normalized.replace(/-/g, "_"));
|
|
707
709
|
}
|
|
710
|
+
function shouldRedactSensitiveKeyValue(key, value) {
|
|
711
|
+
if (value === null || value === undefined)
|
|
712
|
+
return false;
|
|
713
|
+
if (!SENSITIVE_KEY.test(key))
|
|
714
|
+
return false;
|
|
715
|
+
return !isKnownNonSecretCredentialMode(key, value);
|
|
716
|
+
}
|
|
717
|
+
function isKnownNonSecretCredentialMode(key, value) {
|
|
718
|
+
return key.toLowerCase() === "credentials" && typeof value === "string" && isKnownFetchCredentialMode(value);
|
|
719
|
+
}
|
|
720
|
+
function isKnownNonSecretCredentialAssignment(key, value) {
|
|
721
|
+
return key.toLowerCase() === "credentials" && isKnownFetchCredentialMode(value);
|
|
722
|
+
}
|
|
723
|
+
function isKnownFetchCredentialMode(value) {
|
|
724
|
+
const trimmed = value.trim();
|
|
725
|
+
const unquoted = trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'") ? trimmed.slice(1, -1) : trimmed;
|
|
726
|
+
return /^(?:include|omit|same-origin)$/i.test(unquoted);
|
|
727
|
+
}
|
|
708
728
|
|
|
709
729
|
// src/lib/ingest.ts
|
|
710
730
|
var ERROR_LEVELS = new Set(["warn", "error", "fatal"]);
|
package/dist/mcp/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
startScheduler,
|
|
9
9
|
structuredLogPayloadToEntries,
|
|
10
10
|
validateStructuredLogReferences
|
|
11
|
-
} from "../index-
|
|
11
|
+
} from "../index-89jb7jg9.js";
|
|
12
12
|
import {
|
|
13
13
|
countLogs
|
|
14
14
|
} from "../index-gcd14q2f.js";
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
updateAlertRule,
|
|
51
51
|
updateProject,
|
|
52
52
|
validateUniversalEventInput
|
|
53
|
-
} from "../index-
|
|
53
|
+
} from "../index-dbhpykkz.js";
|
|
54
54
|
import {
|
|
55
55
|
getDb,
|
|
56
56
|
getIssue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/logs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.29",
|
|
4
4
|
"description": "Log aggregation + browser script + headless page scanner + performance monitoring for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
"logs-mcp": "./dist/mcp/index.js",
|
|
20
20
|
"logs-serve": "./dist/server/index.js"
|
|
21
21
|
},
|
|
22
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"dashboard/dist"
|
|
25
|
+
],
|
|
23
26
|
"scripts": {
|
|
24
27
|
"build": "rm -rf dist && bun build src/cli/index.ts src/mcp/index.ts src/server/index.ts src/index.ts src/storage.ts --outdir dist --target bun --splitting --external playwright --external playwright-core --external electron --external chromium-bidi --external lighthouse",
|
|
25
28
|
"build:dashboard": "cd dashboard && bun run build",
|