@princeverma130104/agentguard 1.0.1 → 1.0.2
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 +107 -23
- package/dist/guard.d.ts +51 -2
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +204 -39
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/langchain.d.ts +4 -1
- package/dist/langchain.d.ts.map +1 -1
- package/dist/langchain.js +30 -12
- package/dist/langchain.js.map +1 -1
- package/dist/mastra.d.ts.map +1 -1
- package/dist/mastra.js +4 -9
- package/dist/mastra.js.map +1 -1
- package/dist/middleware.d.ts +10 -5
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +13 -48
- package/dist/middleware.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +11 -2
- package/dist/scanner.js.map +1 -1
- package/dist/vault.d.ts +23 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +169 -16
- package/dist/vault.js.map +1 -1
- package/package.json +1 -1
package/dist/vault.js
CHANGED
|
@@ -1,33 +1,126 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @file vault.ts
|
|
4
|
-
* @description Redis-backed
|
|
4
|
+
* @description Redis-backed TTL-expiring token vault.
|
|
5
5
|
* Manages bidirectional (token ↔ rawValue) session mappings with TTL enforcement.
|
|
6
|
-
*
|
|
6
|
+
* Redis persistence and encryption are controlled by the Redis deployment.
|
|
7
7
|
*/
|
|
8
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TokenVault = void 0;
|
|
13
|
+
const crypto_1 = require("crypto");
|
|
13
14
|
const ioredis_1 = __importDefault(require("ioredis"));
|
|
15
|
+
const STORE_SCRIPT = `
|
|
16
|
+
local existingToken = redis.call('HGET', KEYS[2], ARGV[2])
|
|
17
|
+
local existingValue = redis.call('HGET', KEYS[1], ARGV[1])
|
|
18
|
+
if not existingToken and not existingValue and redis.call('HLEN', KEYS[1]) >= tonumber(ARGV[5]) then
|
|
19
|
+
return redis.error_reply('AGENTGUARD_SESSION_TOKEN_LIMIT')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if existingValue then
|
|
23
|
+
local mappings = redis.call('HGETALL', KEYS[2])
|
|
24
|
+
for i = 1, #mappings, 2 do
|
|
25
|
+
if mappings[i + 1] == ARGV[1] and mappings[i] ~= ARGV[2] then
|
|
26
|
+
redis.call('HDEL', KEYS[2], mappings[i])
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
if existingToken and existingToken ~= ARGV[1] then
|
|
31
|
+
redis.call('HDEL', KEYS[1], existingToken)
|
|
32
|
+
end
|
|
33
|
+
redis.call('HSET', KEYS[1], ARGV[1], ARGV[3])
|
|
34
|
+
redis.call('HSET', KEYS[2], ARGV[2], ARGV[1])
|
|
35
|
+
redis.call('EXPIRE', KEYS[1], ARGV[4])
|
|
36
|
+
redis.call('EXPIRE', KEYS[2], ARGV[4])
|
|
37
|
+
redis.call('EXPIRE', KEYS[3], ARGV[4])
|
|
38
|
+
return 1
|
|
39
|
+
`;
|
|
40
|
+
const GET_OR_STORE_SCRIPT = `
|
|
41
|
+
local existing = redis.call('HGET', KEYS[2], ARGV[2])
|
|
42
|
+
if existing then
|
|
43
|
+
redis.call('EXPIRE', KEYS[1], ARGV[4])
|
|
44
|
+
redis.call('EXPIRE', KEYS[2], ARGV[4])
|
|
45
|
+
redis.call('EXPIRE', KEYS[3], ARGV[4])
|
|
46
|
+
return { existing, 0 }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if redis.call('HLEN', KEYS[1]) >= tonumber(ARGV[5]) then
|
|
50
|
+
return redis.error_reply('AGENTGUARD_SESSION_TOKEN_LIMIT')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
local sequence = redis.call('HINCRBY', KEYS[3], ARGV[1], 1)
|
|
54
|
+
local token = '[' .. ARGV[1] .. '_' .. sequence .. ']'
|
|
55
|
+
while redis.call('HEXISTS', KEYS[1], token) == 1 do
|
|
56
|
+
sequence = redis.call('HINCRBY', KEYS[3], ARGV[1], 1)
|
|
57
|
+
token = '[' .. ARGV[1] .. '_' .. sequence .. ']'
|
|
58
|
+
end
|
|
59
|
+
redis.call('HSET', KEYS[1], token, ARGV[3])
|
|
60
|
+
redis.call('HSET', KEYS[2], ARGV[2], token)
|
|
61
|
+
redis.call('EXPIRE', KEYS[1], ARGV[4])
|
|
62
|
+
redis.call('EXPIRE', KEYS[2], ARGV[4])
|
|
63
|
+
redis.call('EXPIRE', KEYS[3], ARGV[4])
|
|
64
|
+
return { token, 1 }
|
|
65
|
+
`;
|
|
14
66
|
class TokenVault {
|
|
15
67
|
constructor(options = {}) {
|
|
16
|
-
this.
|
|
68
|
+
this.ttl = options.ttlSeconds ?? 900;
|
|
69
|
+
if (!Number.isSafeInteger(this.ttl) || this.ttl <= 0) {
|
|
70
|
+
throw new RangeError('ttlSeconds must be a positive safe integer.');
|
|
71
|
+
}
|
|
72
|
+
this.maxTokensPerSession = options.maxTokensPerSession ?? 10000;
|
|
73
|
+
if (!Number.isSafeInteger(this.maxTokensPerSession) || this.maxTokensPerSession <= 0) {
|
|
74
|
+
throw new RangeError('maxTokensPerSession must be a positive safe integer.');
|
|
75
|
+
}
|
|
76
|
+
if (options.vaultEncryptionKey !== undefined &&
|
|
77
|
+
!/^[a-fA-F0-9]{64}$/.test(options.vaultEncryptionKey)) {
|
|
78
|
+
throw new TypeError('vaultEncryptionKey must be exactly 64 hexadecimal characters.');
|
|
79
|
+
}
|
|
80
|
+
if (options.vaultEncryptionKey) {
|
|
81
|
+
const masterKey = Buffer.from(options.vaultEncryptionKey, 'hex');
|
|
82
|
+
this.encryptionKey = (0, crypto_1.createHmac)('sha256', masterKey)
|
|
83
|
+
.update('agentguard:vault-encryption')
|
|
84
|
+
.digest();
|
|
85
|
+
this.indexKey = (0, crypto_1.createHmac)('sha256', masterKey)
|
|
86
|
+
.update('agentguard:vault-index')
|
|
87
|
+
.digest();
|
|
88
|
+
}
|
|
89
|
+
const redisUrl = options.redisUrl ?? 'redis://localhost:6379';
|
|
90
|
+
let parsedRedisUrl;
|
|
91
|
+
try {
|
|
92
|
+
parsedRedisUrl = new URL(redisUrl);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
throw new TypeError('redisUrl must be a valid redis:// or rediss:// URL.');
|
|
96
|
+
}
|
|
97
|
+
if ((parsedRedisUrl.protocol !== 'redis:' && parsedRedisUrl.protocol !== 'rediss:') ||
|
|
98
|
+
!parsedRedisUrl.hostname) {
|
|
99
|
+
throw new TypeError('redisUrl must be a valid redis:// or rediss:// URL.');
|
|
100
|
+
}
|
|
101
|
+
this.redis = new ioredis_1.default(redisUrl, {
|
|
17
102
|
lazyConnect: true,
|
|
18
103
|
maxRetriesPerRequest: 3,
|
|
19
104
|
enableReadyCheck: true,
|
|
20
105
|
retryStrategy: (times) => Math.min(times * 100, 3000),
|
|
21
106
|
});
|
|
22
|
-
this.ttl = options.ttlSeconds ?? 900;
|
|
23
107
|
}
|
|
24
108
|
/** Returns the Redis key for the forward vault (token → rawValue) */
|
|
25
109
|
vaultKey(sessionId) {
|
|
26
|
-
return `agentguard:session:${sessionId}:vault`;
|
|
110
|
+
return `agentguard:session:${this.encodeSessionId(sessionId)}:vault`;
|
|
27
111
|
}
|
|
28
112
|
/** Returns the Redis key for the reverse index (rawValue → token) */
|
|
29
113
|
reverseKey(sessionId) {
|
|
30
|
-
return `agentguard:session:${sessionId}:reverse`;
|
|
114
|
+
return `agentguard:session:${this.encodeSessionId(sessionId)}:reverse`;
|
|
115
|
+
}
|
|
116
|
+
counterKey(sessionId) {
|
|
117
|
+
return `agentguard:session:${this.encodeSessionId(sessionId)}:counters`;
|
|
118
|
+
}
|
|
119
|
+
encodeSessionId(sessionId) {
|
|
120
|
+
if (typeof sessionId !== 'string' || sessionId.length === 0 || sessionId.length > 512) {
|
|
121
|
+
throw new TypeError('sessionId must be a non-empty string of at most 512 characters.');
|
|
122
|
+
}
|
|
123
|
+
return Buffer.from(sessionId, 'utf8').toString('base64url');
|
|
31
124
|
}
|
|
32
125
|
/**
|
|
33
126
|
* Stores a token → rawValue mapping for the given session.
|
|
@@ -35,33 +128,49 @@ class TokenVault {
|
|
|
35
128
|
* Refreshes TTL on every write.
|
|
36
129
|
*/
|
|
37
130
|
async store(sessionId, token, rawValue) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
131
|
+
const result = await this.redis.eval(STORE_SCRIPT, 3, this.vaultKey(sessionId), this.reverseKey(sessionId), this.counterKey(sessionId), token, this.valueDigest(rawValue), this.encodeValue(rawValue, sessionId), String(this.ttl), String(this.maxTokensPerSession));
|
|
132
|
+
if (result !== 1) {
|
|
133
|
+
throw new Error('Failed to store the vault mapping in Redis.');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Atomically reuses an existing token or allocates a new per-type token.
|
|
138
|
+
* Prevents concurrent requests from assigning the same token to different values.
|
|
139
|
+
*/
|
|
140
|
+
async getOrStore(sessionId, entityType, rawValue) {
|
|
141
|
+
if (!/^[A-Z_]+$/.test(entityType)) {
|
|
142
|
+
throw new TypeError('entityType must contain uppercase letters and underscores only.');
|
|
143
|
+
}
|
|
144
|
+
const result = (await this.redis.eval(GET_OR_STORE_SCRIPT, 3, this.vaultKey(sessionId), this.reverseKey(sessionId), this.counterKey(sessionId), entityType, this.valueDigest(rawValue), this.encodeValue(rawValue, sessionId), String(this.ttl), String(this.maxTokensPerSession)));
|
|
145
|
+
if (!result || typeof result[0] !== 'string') {
|
|
146
|
+
throw new Error('Failed to atomically store the vault mapping in Redis.');
|
|
147
|
+
}
|
|
148
|
+
return { token: result[0], created: Number(result[1]) === 1 };
|
|
44
149
|
}
|
|
45
150
|
/**
|
|
46
151
|
* Looks up the existing token for a given rawValue in a session.
|
|
47
|
-
* Returns
|
|
152
|
+
* Returns null if not found (i.e., first occurrence of this value).
|
|
48
153
|
*/
|
|
49
154
|
async lookupToken(sessionId, rawValue) {
|
|
50
|
-
return this.redis.hget(this.reverseKey(sessionId), rawValue);
|
|
155
|
+
return this.redis.hget(this.reverseKey(sessionId), this.valueDigest(rawValue));
|
|
51
156
|
}
|
|
52
157
|
/**
|
|
53
158
|
* Retrieves the full vault map (token → rawValue) for a session.
|
|
54
159
|
* Returns an empty object if the session has expired or doesn't exist.
|
|
55
160
|
*/
|
|
56
161
|
async getVault(sessionId) {
|
|
57
|
-
|
|
162
|
+
const stored = await this.redis.hgetall(this.vaultKey(sessionId));
|
|
163
|
+
return Object.fromEntries(Object.entries(stored).map(([token, value]) => [
|
|
164
|
+
token,
|
|
165
|
+
this.decodeValue(value, sessionId),
|
|
166
|
+
]));
|
|
58
167
|
}
|
|
59
168
|
/**
|
|
60
169
|
* Explicitly deletes all session data (vault + reverse index).
|
|
61
170
|
* Call this when a session is complete to proactively free memory.
|
|
62
171
|
*/
|
|
63
172
|
async destroySession(sessionId) {
|
|
64
|
-
await this.redis.del(this.vaultKey(sessionId), this.reverseKey(sessionId));
|
|
173
|
+
await this.redis.del(this.vaultKey(sessionId), this.reverseKey(sessionId), this.counterKey(sessionId));
|
|
65
174
|
}
|
|
66
175
|
/**
|
|
67
176
|
* Returns whether the Redis connection is healthy.
|
|
@@ -81,6 +190,50 @@ class TokenVault {
|
|
|
81
190
|
async close() {
|
|
82
191
|
await this.redis.quit();
|
|
83
192
|
}
|
|
193
|
+
valueDigest(rawValue) {
|
|
194
|
+
if (!this.indexKey)
|
|
195
|
+
return rawValue;
|
|
196
|
+
return (0, crypto_1.createHmac)('sha256', this.indexKey).update(rawValue).digest('hex');
|
|
197
|
+
}
|
|
198
|
+
encodeValue(rawValue, sessionId) {
|
|
199
|
+
if (!this.encryptionKey)
|
|
200
|
+
return `ag0:${rawValue}`;
|
|
201
|
+
const iv = (0, crypto_1.randomBytes)(12);
|
|
202
|
+
const cipher = (0, crypto_1.createCipheriv)('aes-256-gcm', this.encryptionKey, iv);
|
|
203
|
+
cipher.setAAD(Buffer.from(sessionId, 'utf8'));
|
|
204
|
+
const encrypted = Buffer.concat([cipher.update(rawValue, 'utf8'), cipher.final()]);
|
|
205
|
+
return [
|
|
206
|
+
'ag1',
|
|
207
|
+
iv.toString('base64url'),
|
|
208
|
+
cipher.getAuthTag().toString('base64url'),
|
|
209
|
+
encrypted.toString('base64url'),
|
|
210
|
+
].join(':');
|
|
211
|
+
}
|
|
212
|
+
decodeValue(storedValue, sessionId) {
|
|
213
|
+
if (storedValue.startsWith('ag0:'))
|
|
214
|
+
return storedValue.slice(4);
|
|
215
|
+
if (!storedValue.startsWith('ag1:'))
|
|
216
|
+
return storedValue;
|
|
217
|
+
if (!this.encryptionKey) {
|
|
218
|
+
throw new Error('Vault data is encrypted; configure vaultEncryptionKey to read it.');
|
|
219
|
+
}
|
|
220
|
+
const [, encodedIv, encodedTag, encodedCiphertext] = storedValue.split(':');
|
|
221
|
+
if (!encodedIv || !encodedTag || encodedCiphertext === undefined) {
|
|
222
|
+
throw new Error('Vault contains an invalid encrypted value.');
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
const decipher = (0, crypto_1.createDecipheriv)('aes-256-gcm', this.encryptionKey, Buffer.from(encodedIv, 'base64url'));
|
|
226
|
+
decipher.setAAD(Buffer.from(sessionId, 'utf8'));
|
|
227
|
+
decipher.setAuthTag(Buffer.from(encodedTag, 'base64url'));
|
|
228
|
+
return Buffer.concat([
|
|
229
|
+
decipher.update(Buffer.from(encodedCiphertext, 'base64url')),
|
|
230
|
+
decipher.final(),
|
|
231
|
+
]).toString('utf8');
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
throw new Error('Unable to decrypt vault value; verify vaultEncryptionKey.');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
84
237
|
}
|
|
85
238
|
exports.TokenVault = TokenVault;
|
|
86
239
|
//# sourceMappingURL=vault.js.map
|
package/dist/vault.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,sDAA4B;
|
|
1
|
+
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,mCAAmF;AACnF,sDAA4B;AAa5B,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpB,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyB3B,CAAC;AAEF,MAAa,UAAU;IAOrB,YAAY,UAAwB,EAAE;QACpC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,UAAU,CAAC,6CAA6C,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,KAAM,CAAC;QACjE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC;YACrF,MAAM,IAAI,UAAU,CAAC,sDAAsD,CAAC,CAAC;QAC/E,CAAC;QACD,IACE,OAAO,CAAC,kBAAkB,KAAK,SAAS;YACxC,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,k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AC;YACjE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAA,yBAAgB,EAC/B,aAAa,EACb,IAAI,CAAC,aAAa,EAClB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CACpC,CAAC;YACF,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAChD,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;gBAC5D,QAAQ,CAAC,KAAK,EAAE;aACjB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;CACF;AAxOD,gCAwOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@princeverma130104/agentguard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Privacy & Context Redaction Middleware for AI Agents — detect, tokenise, and restore PII/credentials in real-time without exposing sensitive data to LLMs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|