clavarium 0.2.61-next.1 → 0.2.62-next.1
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/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
- package/server/secret-scan.mjs +17 -6
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.62-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
13
13
|
"@xterm/xterm": "^6.0.0",
|
|
14
14
|
"clavarium-binder": "0.1.8-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.9-next.1",
|
|
17
17
|
"mermaid": "11.17.2",
|
|
18
18
|
"node-pty": "^1.1.0",
|
|
19
19
|
"pdfjs-dist": "6.4.299",
|
|
@@ -714,9 +714,9 @@
|
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
"node_modules/clavarium-parley": {
|
|
717
|
-
"version": "0.17.
|
|
718
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
719
|
-
"integrity": "sha512-
|
|
717
|
+
"version": "0.17.9-next.1",
|
|
718
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.9-next.1.tgz",
|
|
719
|
+
"integrity": "sha512-pKwFQnq/6JO2nA37u9RNCO6ddgCUvpqmmmqRPQMa5GGT1nL0dFGDs1hY+Wed3TqKYRKxLmCgUWgts0aQBYihqw==",
|
|
720
720
|
"license": "MIT",
|
|
721
721
|
"bin": {
|
|
722
722
|
"parley": "bin/parley.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@xterm/xterm": "^6.0.0",
|
|
47
47
|
"clavarium-binder": "0.1.8-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
|
-
"clavarium-parley": "0.17.
|
|
49
|
+
"clavarium-parley": "0.17.9-next.1",
|
|
50
50
|
"mermaid": "11.17.2",
|
|
51
51
|
"node-pty": "^1.1.0",
|
|
52
52
|
"pdfjs-dist": "6.4.299",
|
package/server/secret-scan.mjs
CHANGED
|
@@ -35,6 +35,12 @@ const BLOB = /[0-9A-Za-z+/=_-]{40,}/g;
|
|
|
35
35
|
const WORD = /[A-Za-z0-9]{20,39}/g;
|
|
36
36
|
const ENTROPY_MIN = 3.5; /* bits per character */
|
|
37
37
|
const CLASSES_MIN = 3; /* of: lower, upper, digit, symbol */
|
|
38
|
+
/* With a word nearby that announces a secret, the net is widened: a shorter run (a 10-char password) is
|
|
39
|
+
lifted, on a lower entropy floor -- because the context already says it is one. A bare short string, with
|
|
40
|
+
no such word, is left alone (too many false positives). */
|
|
41
|
+
const KEYWORD = /\b(pass(?:word|phrase)s?|mots?\s+de\s+passe|pwd|secrets?|tokens?|jetons?|cl[eé]s?|api[_\s-]?keys?|keys?|auth|credentials?|identifiants?)\b/i;
|
|
42
|
+
const SHORT_WORD = /[A-Za-z0-9]{10,39}/g;
|
|
43
|
+
const ENTROPY_SHORT = 3.2;
|
|
38
44
|
|
|
39
45
|
function entropy(s) {
|
|
40
46
|
const count = new Map();
|
|
@@ -56,9 +62,10 @@ function classes(s) {
|
|
|
56
62
|
function looksRandom(s) {
|
|
57
63
|
return classes(s) >= CLASSES_MIN && entropy(s) >= ENTROPY_MIN;
|
|
58
64
|
}
|
|
59
|
-
/* The shorter net: all three of upper, lower and digit present (a hash or a word misses one), and high
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
/* The shorter net: all three of upper, lower and digit present (a hash or a word misses one), and high
|
|
66
|
+
entropy (a lower floor when a nearby word already announces a secret). */
|
|
67
|
+
function improbableWord(s, floor = ENTROPY_MIN) {
|
|
68
|
+
return /[a-z]/.test(s) && /[A-Z]/.test(s) && /[0-9]/.test(s) && entropy(s) >= floor;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
/* How a lifted secret is written back into the message: a marker the chat
|
|
@@ -79,10 +86,14 @@ export function scan(text) {
|
|
|
79
86
|
if (looksRandom(m[0])) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
|
|
80
87
|
}
|
|
81
88
|
BLOB.lastIndex = 0;
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
/* A word nearby that announces a secret widens the net to shorter runs, on a lower floor. */
|
|
90
|
+
const near = KEYWORD.test(str);
|
|
91
|
+
const wordRe = near ? SHORT_WORD : WORD;
|
|
92
|
+
const floor = near ? ENTROPY_SHORT : ENTROPY_MIN;
|
|
93
|
+
for (let m; (m = wordRe.exec(str));) {
|
|
94
|
+
if (improbableWord(m[0], floor)) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
|
|
84
95
|
}
|
|
85
|
-
|
|
96
|
+
wordRe.lastIndex = 0;
|
|
86
97
|
/* Keep left-to-right, and when two matches overlap keep the one that starts
|
|
87
98
|
first (and, equal, the longer): a known prefix wins over the blob rule. */
|
|
88
99
|
found.sort((a, b) => a.start - b.start || b.end - a.end);
|