@astrasyncai/verification-gateway 3.10.1 → 3.11.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/dist/adapter-interface/interface.d.mts +1 -1
- package/dist/adapter-interface/interface.d.ts +1 -1
- package/dist/adapters/express.js +1 -1
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +1 -1
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +1 -1
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +1 -1
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +1 -1
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +1 -1
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +1 -1
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +105 -27
- package/dist/bin/astrasync-codex-hook.js +5151 -0
- package/dist/bin/astrasync-guard.js +234 -32
- package/dist/bin/astrasync.js +242 -32
- package/dist/browser/background.js +84 -17
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +84 -17
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +1 -1
- package/dist/browser/browser-adapter.d.ts +1 -1
- package/dist/claude-code/claude-code-adapter.d.mts +1 -1
- package/dist/claude-code/claude-code-adapter.d.ts +1 -1
- package/dist/claude-code/claude-code-adapter.js +9 -1
- package/dist/claude-code/claude-code-adapter.js.map +1 -1
- package/dist/claude-code/claude-code-adapter.mjs +9 -1
- package/dist/claude-code/claude-code-adapter.mjs.map +1 -1
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/codex/index.d.mts +230 -0
- package/dist/codex/index.d.ts +230 -0
- package/dist/codex/index.js +5269 -0
- package/dist/codex/index.js.map +1 -0
- package/dist/codex/index.mjs +5241 -0
- package/dist/codex/index.mjs.map +1 -0
- package/dist/cursor/cursor-adapter.d.mts +1 -1
- package/dist/cursor/cursor-adapter.d.ts +1 -1
- package/dist/cursor/extension.d.mts +1 -1
- package/dist/cursor/extension.d.ts +1 -1
- package/dist/cursor/extension.js +84 -17
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +84 -17
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/gateway/gateway.d.mts +6 -1
- package/dist/gateway/gateway.d.ts +6 -1
- package/dist/gateway/gateway.js +84 -17
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +84 -17
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +1 -1
- package/dist/git-trigger/git-hooks.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +10 -1
- package/dist/local-evaluator/evaluator.d.ts +10 -1
- package/dist/local-evaluator/evaluator.js +20 -9
- package/dist/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs +20 -9
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{types-C23_uaY8.d.ts → types-DhFPiZ3t.d.ts} +6 -1
- package/dist/{types-BV6abBnF.d.mts → types-cQVCMeNV.d.mts} +6 -1
- package/dist/verify.js +1 -1
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +1 -1
- package/dist/verify.mjs.map +1 -1
- package/package.json +8 -2
package/dist/gateway/gateway.mjs
CHANGED
|
@@ -121,8 +121,9 @@ function extractBacktickSubstitutions(text, collect) {
|
|
|
121
121
|
return kept.join(" ");
|
|
122
122
|
}
|
|
123
123
|
function basename(token) {
|
|
124
|
-
const slash = token.lastIndexOf("/");
|
|
125
|
-
|
|
124
|
+
const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
|
|
125
|
+
const name = slash === -1 ? token : token.slice(slash + 1);
|
|
126
|
+
return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
|
|
126
127
|
}
|
|
127
128
|
function matchSegment(segment, list) {
|
|
128
129
|
const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
|
|
@@ -255,7 +256,9 @@ var LocalEvaluator = class {
|
|
|
255
256
|
}
|
|
256
257
|
return {
|
|
257
258
|
recommendation: "ALLOW",
|
|
258
|
-
|
|
259
|
+
// "evaluated": dimensions absent from the policy are skipped, not
|
|
260
|
+
// failed — evaluatedDimensions below records which ones ran.
|
|
261
|
+
reason: "All evaluated PDLSS checks passed",
|
|
259
262
|
evaluatedDimensions: {
|
|
260
263
|
purpose: true,
|
|
261
264
|
scope: !!this.policy.scope,
|
|
@@ -354,7 +357,7 @@ var LocalEvaluator = class {
|
|
|
354
357
|
}
|
|
355
358
|
}
|
|
356
359
|
if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
|
|
357
|
-
const targetLower = context.target.toLowerCase();
|
|
360
|
+
const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
|
|
358
361
|
for (const sensitivePath of SENSITIVE_PATHS) {
|
|
359
362
|
if (targetLower.includes(sensitivePath.toLowerCase())) {
|
|
360
363
|
score = Math.max(score, 50);
|
|
@@ -383,12 +386,20 @@ var LocalEvaluator = class {
|
|
|
383
386
|
matchesAnyPattern(value, patterns) {
|
|
384
387
|
return patterns.some((pattern) => this.matchGlob(value, pattern));
|
|
385
388
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
homePrefix() {
|
|
390
|
+
if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
|
|
391
|
+
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
392
|
+
const home = env?.HOME || env?.USERPROFILE;
|
|
393
|
+
this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
|
|
394
|
+
return this.cachedHomePrefix;
|
|
395
|
+
}
|
|
391
396
|
matchGlob(value, pattern) {
|
|
397
|
+
value = value.replace(/\\/g, "/");
|
|
398
|
+
pattern = pattern.replace(/\\/g, "/");
|
|
399
|
+
if (pattern === "~" || pattern.startsWith("~/")) {
|
|
400
|
+
const home = this.homePrefix();
|
|
401
|
+
if (home) pattern = home + pattern.slice(1);
|
|
402
|
+
}
|
|
392
403
|
if (pattern === value) return true;
|
|
393
404
|
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
394
405
|
if (starCount > 8) {
|
|
@@ -3661,7 +3672,7 @@ function getTrustLevel(score) {
|
|
|
3661
3672
|
}
|
|
3662
3673
|
|
|
3663
3674
|
// src/version.ts
|
|
3664
|
-
var SDK_VERSION = "3.
|
|
3675
|
+
var SDK_VERSION = "3.11.1";
|
|
3665
3676
|
|
|
3666
3677
|
// src/well-known.ts
|
|
3667
3678
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -4179,10 +4190,12 @@ function toGatewayConfig(config) {
|
|
|
4179
4190
|
};
|
|
4180
4191
|
}
|
|
4181
4192
|
function toVerificationRequest(context, astraId) {
|
|
4193
|
+
const dotIndex = context.purpose.indexOf(".");
|
|
4194
|
+
const dotted = dotIndex > 0;
|
|
4182
4195
|
return {
|
|
4183
4196
|
credentials: { astraId },
|
|
4184
|
-
purpose: context.purpose,
|
|
4185
|
-
action: context.action,
|
|
4197
|
+
purpose: dotted ? context.purpose.slice(0, dotIndex) : context.purpose,
|
|
4198
|
+
action: dotted ? context.purpose : context.action,
|
|
4186
4199
|
resourceType: context.resourceType,
|
|
4187
4200
|
resource: context.target,
|
|
4188
4201
|
transactionValue: context.transactionValue,
|
|
@@ -4425,13 +4438,43 @@ var TraceLogger = class {
|
|
|
4425
4438
|
* Log an evaluation event.
|
|
4426
4439
|
*/
|
|
4427
4440
|
logEvaluation(context, decision) {
|
|
4441
|
+
if (!this.enabled) return;
|
|
4442
|
+
let event;
|
|
4443
|
+
try {
|
|
4444
|
+
event = {
|
|
4445
|
+
id: this.generateId(),
|
|
4446
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4447
|
+
type: "evaluation",
|
|
4448
|
+
context: redactDeep(context),
|
|
4449
|
+
decision: redactDeep(decision)
|
|
4450
|
+
};
|
|
4451
|
+
} catch (err) {
|
|
4452
|
+
event = {
|
|
4453
|
+
id: this.generateId(),
|
|
4454
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4455
|
+
type: "error",
|
|
4456
|
+
metadata: {
|
|
4457
|
+
error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
4458
|
+
recommendation: decision.recommendation,
|
|
4459
|
+
purpose: context.purpose,
|
|
4460
|
+
action: context.action
|
|
4461
|
+
}
|
|
4462
|
+
};
|
|
4463
|
+
}
|
|
4464
|
+
this.write(event);
|
|
4465
|
+
}
|
|
4466
|
+
/**
|
|
4467
|
+
* Log a tool call the guard saw but did not govern. One line per skip
|
|
4468
|
+
* keeps coverage holes (unmapped platform tools) visible in the traces
|
|
4469
|
+
* instead of silently indistinguishable from ALLOW.
|
|
4470
|
+
*/
|
|
4471
|
+
logSkipped(toolName, reason) {
|
|
4428
4472
|
if (!this.enabled) return;
|
|
4429
4473
|
this.write({
|
|
4430
4474
|
id: this.generateId(),
|
|
4431
4475
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4432
|
-
type: "
|
|
4433
|
-
|
|
4434
|
-
decision: redactDeep(decision)
|
|
4476
|
+
type: "skipped",
|
|
4477
|
+
metadata: { toolName, reason }
|
|
4435
4478
|
});
|
|
4436
4479
|
}
|
|
4437
4480
|
/**
|
|
@@ -4460,17 +4503,34 @@ var TraceLogger = class {
|
|
|
4460
4503
|
});
|
|
4461
4504
|
}
|
|
4462
4505
|
write(event) {
|
|
4506
|
+
let line;
|
|
4507
|
+
try {
|
|
4508
|
+
line = JSON.stringify(event) + "\n";
|
|
4509
|
+
} catch {
|
|
4510
|
+
return;
|
|
4511
|
+
}
|
|
4463
4512
|
try {
|
|
4464
4513
|
const filePath = this.getCurrentFilePath();
|
|
4465
|
-
const line = JSON.stringify(event) + "\n";
|
|
4466
4514
|
if (existsSync2(filePath)) {
|
|
4467
4515
|
const stats = statSync(filePath);
|
|
4468
4516
|
if (stats.size > MAX_FILE_SIZE) {
|
|
4469
4517
|
this.rotate();
|
|
4470
4518
|
}
|
|
4471
4519
|
}
|
|
4472
|
-
|
|
4520
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
4521
|
+
try {
|
|
4522
|
+
appendFileSync(filePath, line);
|
|
4523
|
+
return;
|
|
4524
|
+
} catch {
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
|
|
4528
|
+
appendFileSync(fallbackPath, line);
|
|
4473
4529
|
} catch {
|
|
4530
|
+
try {
|
|
4531
|
+
console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
|
|
4532
|
+
} catch {
|
|
4533
|
+
}
|
|
4474
4534
|
}
|
|
4475
4535
|
}
|
|
4476
4536
|
getCurrentFilePath() {
|
|
@@ -4631,6 +4691,13 @@ var AstraSyncGateway = class {
|
|
|
4631
4691
|
getSyncStatus() {
|
|
4632
4692
|
return this.syncQueue?.getStatus() || null;
|
|
4633
4693
|
}
|
|
4694
|
+
/**
|
|
4695
|
+
* Record a tool call the calling adapter saw but did not govern
|
|
4696
|
+
* (unmapped tool, skipTools, MCP with governMcp off). Trace-only.
|
|
4697
|
+
*/
|
|
4698
|
+
logSkippedTool(toolName, reason) {
|
|
4699
|
+
this.traceLogger?.logSkipped(toolName, reason);
|
|
4700
|
+
}
|
|
4634
4701
|
};
|
|
4635
4702
|
export {
|
|
4636
4703
|
AstraSyncGateway
|