vault-go 0.31.0 → 0.31.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/README.md +2 -1
- package/dist/capture-privacy.js +52 -7
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -243,9 +243,10 @@ bun run typecheck
|
|
|
243
243
|
bun test src
|
|
244
244
|
bun run build
|
|
245
245
|
npm run pack:check
|
|
246
|
+
npm run pack:smoke
|
|
246
247
|
```
|
|
247
248
|
|
|
248
|
-
|
|
249
|
+
CI and release currently run only when the **CI** workflow is started manually in GitHub Actions. The default run validates only. To publish after the checks pass, start it on `main` with the `publish` input enabled; pushes alone do not start it. The package smoke check installs the actual tarball in a temporary directory and checks the CLI and MCP handshake without account credentials. Conventional commits determine the version (`fix` → patch, `feat` → minor, `BREAKING CHANGE` → major). `NPM_TOKEN` lives only in GitHub Actions.
|
|
249
250
|
|
|
250
251
|
## Links
|
|
251
252
|
|
package/dist/capture-privacy.js
CHANGED
|
@@ -1,19 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
const SENSITIVE_KEY = /api[_-]?key|secret|token|password|authorization|cookie|credential|private[_-]?key/i;
|
|
2
|
+
/** Keep quoted values together: whitespace/escaped quotes must not leave a secret tail. */
|
|
3
|
+
function redactText(value, depth = 0) {
|
|
4
|
+
// Nested stringified payloads are untrusted. Do not recurse indefinitely.
|
|
5
|
+
if (depth >= 12)
|
|
6
|
+
return '[redacted]';
|
|
7
|
+
if (/^\s*[\[{\"]/.test(value)) {
|
|
8
|
+
try {
|
|
9
|
+
// Parsing handles arrays/objects used as credentials, escaped key names,
|
|
10
|
+
// and JSON string literals wrapping another serialized payload.
|
|
11
|
+
// Keep the capture field a string; its caller need not know it contained JSON.
|
|
12
|
+
return JSON.stringify(redactValue(JSON.parse(value), depth + 1));
|
|
13
|
+
}
|
|
14
|
+
catch { /* Partial JSON and pasted logs still use the text filter below. */ }
|
|
15
|
+
}
|
|
16
|
+
return value
|
|
17
|
+
.replace(new RegExp(`<(private|vault-private|${["claude", "mem", "context"].join("-")}|system_instruction|system-instruction|persisted-output|system-reminder)\\b[^>]*>[\\s\\S]*?(?:<\\/\\1\\s*>|$)`, "gi"), "[redacted]")
|
|
18
|
+
// Raw HTTP headers can contain spaces, auth schemes and several cookies.
|
|
19
|
+
// Stop at a shell argument's quote or a new line, preserving adjacent diagnostics.
|
|
20
|
+
.replace(/(\b(?:authorization|proxy-authorization|cookie|set-cookie)[ \t]*:[ \t]*)[^\r\n'\"]+/gi, '$1[redacted]')
|
|
21
|
+
.replace(/((?:["']?\b[\w-]+["']?)[ \t]*[:=][ \t]*)("(?:\\[\s\S]|[^"\\])*(?:"|$)|'(?:\\[\s\S]|[^'\\])*(?:'|$)|\[redacted\]|[^\s,"'{}\]]+)/g, (match, prefix, credential) => {
|
|
22
|
+
const key = prefix.replace(/["'\s:=]/g, '');
|
|
23
|
+
const quote = credential[0] === '"' || credential[0] === "'" ? credential[0] : '';
|
|
24
|
+
// A public field can itself contain serialized JSON, shell output or a
|
|
25
|
+
// pasted header. Inspect its contents instead of skipping the whole value.
|
|
26
|
+
if (!SENSITIVE_KEY.test(key)) {
|
|
27
|
+
if (!quote)
|
|
28
|
+
return match;
|
|
29
|
+
const closed = credential.endsWith(quote) && credential.length > 1;
|
|
30
|
+
const inner = credential.slice(1, closed ? -1 : undefined);
|
|
31
|
+
// JSON unescaping makes escaped credential keys visible to the same filter.
|
|
32
|
+
if (quote === '"' && closed) {
|
|
33
|
+
try {
|
|
34
|
+
return `${prefix}${JSON.stringify(redactText(JSON.parse(credential), depth + 1))}`;
|
|
35
|
+
}
|
|
36
|
+
catch { /* Shell strings are not necessarily valid JSON. */ }
|
|
37
|
+
}
|
|
38
|
+
return `${prefix}${quote}${redactText(inner, depth + 1)}${closed ? quote : ''}`;
|
|
39
|
+
}
|
|
40
|
+
return `${prefix}${quote}[redacted]${quote}`;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function redactValue(value, depth) {
|
|
44
|
+
if (depth >= 12)
|
|
45
|
+
return '[redacted]';
|
|
2
46
|
if (typeof value === "string") {
|
|
3
|
-
return value
|
|
4
|
-
.replace(new RegExp(`<(private|vault-private|${["claude", "mem", "context"].join("-")}|system_instruction|system-instruction|persisted-output|system-reminder)\\b[^>]*>[\\s\\S]*?(?:<\\/\\1\\s*>|$)`, "gi"), "[redacted]")
|
|
5
|
-
.replace(/(api[_-]?key|secret|token|password)\s*[:=]\s*['"]?[^\s'"]+/gi, "$1=[redacted]");
|
|
47
|
+
return redactText(value, depth);
|
|
6
48
|
}
|
|
7
49
|
if (Array.isArray(value))
|
|
8
|
-
return value.map(
|
|
50
|
+
return value.map(nested => redactValue(nested, depth + 1));
|
|
9
51
|
if (value && typeof value === "object") {
|
|
10
52
|
const output = {};
|
|
11
53
|
for (const [key, nested] of Object.entries(value)) {
|
|
12
|
-
output[key] =
|
|
54
|
+
output[key] = SENSITIVE_KEY.test(key)
|
|
13
55
|
? "[redacted]"
|
|
14
|
-
:
|
|
56
|
+
: redactValue(nested, depth + 1);
|
|
15
57
|
}
|
|
16
58
|
return output;
|
|
17
59
|
}
|
|
18
60
|
return value;
|
|
19
61
|
}
|
|
62
|
+
export function redact(value) {
|
|
63
|
+
return redactValue(value, 0);
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vault-go",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "MCP server and installer for Vault Memory: search, capture, and use account memory across AI clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -160,7 +160,8 @@
|
|
|
160
160
|
"test": "bun run build && bun test src",
|
|
161
161
|
"pack:check": "npm pack --dry-run",
|
|
162
162
|
"release": "semantic-release",
|
|
163
|
-
"prepublishOnly": "bun test src && npm run pack:check"
|
|
163
|
+
"prepublishOnly": "bun test src && npm run pack:check",
|
|
164
|
+
"pack:smoke": "node scripts/smoke-package.mjs"
|
|
164
165
|
},
|
|
165
166
|
"engines": {
|
|
166
167
|
"bun": ">=1.3.0",
|
|
@@ -222,12 +223,12 @@
|
|
|
222
223
|
},
|
|
223
224
|
"devDependencies": {
|
|
224
225
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
225
|
-
"@semantic-release/github": "12.0.
|
|
226
|
-
"@semantic-release/npm": "13.
|
|
226
|
+
"@semantic-release/github": "12.0.10",
|
|
227
|
+
"@semantic-release/npm": "13.2.0",
|
|
227
228
|
"@semantic-release/release-notes-generator": "14.1.1",
|
|
228
229
|
"@types/bun": "^1.3.0",
|
|
229
230
|
"@types/node": "^22.15.0",
|
|
230
|
-
"semantic-release": "25.0.
|
|
231
|
+
"semantic-release": "25.0.9",
|
|
231
232
|
"typescript": "^5.9.3"
|
|
232
233
|
},
|
|
233
234
|
"overrides": {
|