@eyeoverthink/sva-gate 2.1.3 → 2.1.5
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 +1 -1
- package/bin/sva-gate.js +2 -2
- package/package.json +2 -1
- package/src/lib/membrane-core.js +4 -1
- package/src/lib/stream-guard.js +10 -0
- package/test/review-2026-12-04.test.js +37 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `@eyeoverthink/sva-gate` (`v2.1.
|
|
1
|
+
# `@eyeoverthink/sva-gate` (`v2.1.5`)
|
|
2
2
|
|
|
3
3
|
[](https://github.com/eyeoverthink/sva-gate/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@eyeoverthink/sva-gate)
|
package/bin/sva-gate.js
CHANGED
|
@@ -58,12 +58,12 @@ function readJsonArg(arg) {
|
|
|
58
58
|
|
|
59
59
|
const [cmd, ...rest] = process.argv.slice(2);
|
|
60
60
|
|
|
61
|
-
if (
|
|
61
|
+
if (cmd === '-h' || cmd === '--help' || (!cmd && process.stdin.isTTY)) {
|
|
62
62
|
console.log(USAGE);
|
|
63
63
|
process.exit(0);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (cmd === 'mcp') {
|
|
66
|
+
if (!cmd || cmd === 'mcp') {
|
|
67
67
|
startStdioMcpServer();
|
|
68
68
|
} else if (cmd === 'seal') {
|
|
69
69
|
const text = rest.join(' ');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eyeoverthink/sva-gate",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"mcpName": "io.github.eyeoverthink/sva-gate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Zero-dependency 3-layer verification SDK, CLI, and stdio MCP server for AI agents: SVA-ER/1 & AER-1 (draft-zambo-aer1) receipts, OPEG/1 execution gates, StreamSealGuard split-token privacy membrane, SVA-JEV/1 rule-based judge checks, and zero-LLM skill crystallization.",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"url": "https://github.com/eyeoverthink/sva-gate/issues"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
|
+
"build": "node -e \"console.log('sva-gate zero-build ESM ready')\"",
|
|
70
71
|
"test": "node --test \"test/*.test.js\"",
|
|
71
72
|
"mcp": "node ./bin/sva-gate.js mcp",
|
|
72
73
|
"self-test": "node ./bin/sva-gate.js self-test"
|
package/src/lib/membrane-core.js
CHANGED
|
@@ -16,7 +16,7 @@ function luhn(digits) {
|
|
|
16
16
|
|
|
17
17
|
const DETECTORS = [
|
|
18
18
|
['SECRET', /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g],
|
|
19
|
-
['SECRET', /\b(?:sk|pk|rk)-[A-Za-z0-9_-]{
|
|
19
|
+
['SECRET', /\b(?:sk|pk|rk)-[A-Za-z0-9_-]{12,}\b|\b(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{12,}\b|\bgh[pousr]_[A-Za-z0-9_]{12,}\b|\bgithub_pat_[A-Za-z0-9_]{12,}\b|\bhf_[A-Za-z0-9]{12,}\b|\bAIza[0-9A-Za-z_-]{16,}\b|\bxox[abpr]-[A-Za-z0-9-]{10,}\b|\bAKIA[0-9A-Z]{12,}\b/g],
|
|
20
20
|
// Bearer credentials: only the token after the scheme is sealed. Bounded whitespace keeps it linear.
|
|
21
21
|
['SECRET', /(?<=\bBearer[ \t]{1,4})[A-Za-z0-9._~+/=-]{16,}/g],
|
|
22
22
|
['SECRET', /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g],
|
|
@@ -77,6 +77,8 @@ export function detect(text, { terms = [] } = {}) {
|
|
|
77
77
|
|
|
78
78
|
const digitsOnly = (v) => v.replace(/\D/g, '');
|
|
79
79
|
const squeezeDigits = (s) => s.replace(/(?<=\d)[\s.\-()]+(?=\d)/g, '');
|
|
80
|
+
// Independent fail-closed egress check for high-confidence secret prefixes (catches truncated/test tokens even if bypassed).
|
|
81
|
+
const RESIDUAL_SECRET_RE = /-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:sk|pk|rk)-[A-Za-z0-9_-]{10,}\b|\b(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,}\b|\bgh[pousr]_[A-Za-z0-9_]{8,}\b|\bgithub_pat_[A-Za-z0-9_]{8,}\b|\bhf_[A-Za-z0-9]{10,}\b|\bAIza[0-9A-Za-z_-]{12,}\b|\bxox[abpr]-[A-Za-z0-9-]{8,}\b|\bAKIA[0-9A-Z]{10,}\b/;
|
|
80
82
|
|
|
81
83
|
export class SealSession {
|
|
82
84
|
constructor() { this.byValue = new Map(); this.byPlaceholder = new Map(); this.counts = {}; }
|
|
@@ -142,6 +144,7 @@ export class SealSession {
|
|
|
142
144
|
const d = digitsOnly(value);
|
|
143
145
|
if (d.length >= 7 && (squeezed.includes(d) || (d.length > 10 && squeezed.includes(d.slice(-10))))) leaks.push(type);
|
|
144
146
|
}
|
|
147
|
+
if (RESIDUAL_SECRET_RE.test(p)) leaks.push('SECRET');
|
|
145
148
|
return { clean: leaks.length === 0, leaks };
|
|
146
149
|
}
|
|
147
150
|
}
|
package/src/lib/stream-guard.js
CHANGED
|
@@ -10,11 +10,21 @@ import { detect, SealSession } from './membrane-core.js';
|
|
|
10
10
|
export const SECRET_PREFIXES = [
|
|
11
11
|
'sk-ant-',
|
|
12
12
|
'sk-proj-',
|
|
13
|
+
'sk_live_',
|
|
14
|
+
'sk_test_',
|
|
15
|
+
'pk_live_',
|
|
16
|
+
'pk_test_',
|
|
17
|
+
'rk_live_',
|
|
18
|
+
'rk_test_',
|
|
13
19
|
'sk-',
|
|
14
20
|
'AIza',
|
|
15
21
|
'ghp_',
|
|
16
22
|
'gho_',
|
|
23
|
+
'ghu_',
|
|
24
|
+
'ghs_',
|
|
25
|
+
'ghr_',
|
|
17
26
|
'github_pat_',
|
|
27
|
+
'hf_',
|
|
18
28
|
'AKIA',
|
|
19
29
|
'xoxb-',
|
|
20
30
|
'xoxp-',
|
|
@@ -82,3 +82,40 @@ test('README heading and MCP serverInfo match package.json version', () => {
|
|
|
82
82
|
assert.equal(SERVER_INFO.version, PKG.version);
|
|
83
83
|
assert.ok(!/IETF `?draft-zambo/.test(readme), 'AER-1 is an individual draft, not an IETF document');
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
test('truncated/test ghp_ tokens (24 chars) seal in single & stream modes and audit fails closed independently', () => {
|
|
87
|
+
const shortPat = 'ghp_9fQ2aBcDeFgHiJkL5w8y';
|
|
88
|
+
assert.equal(shortPat.length, 24);
|
|
89
|
+
const handle = createMcpHandler();
|
|
90
|
+
|
|
91
|
+
const singleRes = handle({
|
|
92
|
+
jsonrpc: '2.0',
|
|
93
|
+
id: 10,
|
|
94
|
+
method: 'tools/call',
|
|
95
|
+
params: { name: 'sva_seal_text', arguments: { text: `token ${shortPat} ok` } },
|
|
96
|
+
});
|
|
97
|
+
const singleOut = JSON.parse(singleRes.result.content[0].text);
|
|
98
|
+
assert.equal(singleOut.ok, true);
|
|
99
|
+
assert.equal(singleOut.findingsCount, 1);
|
|
100
|
+
assert.ok(!singleOut.sealed.includes('ghp_'));
|
|
101
|
+
assert.ok(singleOut.sealed.includes('⟦SECRET_1⟧'));
|
|
102
|
+
assert.equal(singleOut.audit.clean, true);
|
|
103
|
+
|
|
104
|
+
const streamRes = handle({
|
|
105
|
+
jsonrpc: '2.0',
|
|
106
|
+
id: 11,
|
|
107
|
+
method: 'tools/call',
|
|
108
|
+
params: { name: 'sva_seal_text', arguments: { chunks: ['tok gh', 'p_9fQ2aBcDeF', 'gHiJkL5w8y ok'] } },
|
|
109
|
+
});
|
|
110
|
+
const streamOut = JSON.parse(streamRes.result.content[0].text);
|
|
111
|
+
assert.equal(streamOut.ok, true);
|
|
112
|
+
assert.ok(!streamOut.sealed.includes('ghp_'));
|
|
113
|
+
assert.ok(streamOut.sealed.includes('⟦SECRET_1⟧'));
|
|
114
|
+
assert.equal(streamOut.audit.clean, true);
|
|
115
|
+
|
|
116
|
+
// Independent fail-closed egress check even on a fresh session that sealed nothing
|
|
117
|
+
const emptySession = new SealSession();
|
|
118
|
+
const auditRes = emptySession.audit('leaked ghp_1234567890 here');
|
|
119
|
+
assert.equal(auditRes.clean, false);
|
|
120
|
+
assert.ok(auditRes.leaks.includes('SECRET'));
|
|
121
|
+
});
|