@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
|
@@ -364,8 +364,9 @@ function extractBacktickSubstitutions(text, collect) {
|
|
|
364
364
|
return kept.join(" ");
|
|
365
365
|
}
|
|
366
366
|
function basename(token) {
|
|
367
|
-
const slash = token.lastIndexOf("/");
|
|
368
|
-
|
|
367
|
+
const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
|
|
368
|
+
const name = slash === -1 ? token : token.slice(slash + 1);
|
|
369
|
+
return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
|
|
369
370
|
}
|
|
370
371
|
function matchSegment(segment, list) {
|
|
371
372
|
const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
|
|
@@ -498,7 +499,9 @@ var LocalEvaluator = class {
|
|
|
498
499
|
}
|
|
499
500
|
return {
|
|
500
501
|
recommendation: "ALLOW",
|
|
501
|
-
|
|
502
|
+
// "evaluated": dimensions absent from the policy are skipped, not
|
|
503
|
+
// failed — evaluatedDimensions below records which ones ran.
|
|
504
|
+
reason: "All evaluated PDLSS checks passed",
|
|
502
505
|
evaluatedDimensions: {
|
|
503
506
|
purpose: true,
|
|
504
507
|
scope: !!this.policy.scope,
|
|
@@ -597,7 +600,7 @@ var LocalEvaluator = class {
|
|
|
597
600
|
}
|
|
598
601
|
}
|
|
599
602
|
if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
|
|
600
|
-
const targetLower = context.target.toLowerCase();
|
|
603
|
+
const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
|
|
601
604
|
for (const sensitivePath of SENSITIVE_PATHS) {
|
|
602
605
|
if (targetLower.includes(sensitivePath.toLowerCase())) {
|
|
603
606
|
score = Math.max(score, 50);
|
|
@@ -626,12 +629,20 @@ var LocalEvaluator = class {
|
|
|
626
629
|
matchesAnyPattern(value, patterns) {
|
|
627
630
|
return patterns.some((pattern) => this.matchGlob(value, pattern));
|
|
628
631
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
632
|
+
homePrefix() {
|
|
633
|
+
if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
|
|
634
|
+
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
635
|
+
const home = env?.HOME || env?.USERPROFILE;
|
|
636
|
+
this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
|
|
637
|
+
return this.cachedHomePrefix;
|
|
638
|
+
}
|
|
634
639
|
matchGlob(value, pattern) {
|
|
640
|
+
value = value.replace(/\\/g, "/");
|
|
641
|
+
pattern = pattern.replace(/\\/g, "/");
|
|
642
|
+
if (pattern === "~" || pattern.startsWith("~/")) {
|
|
643
|
+
const home = this.homePrefix();
|
|
644
|
+
if (home) pattern = home + pattern.slice(1);
|
|
645
|
+
}
|
|
635
646
|
if (pattern === value) return true;
|
|
636
647
|
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
637
648
|
if (starCount > 8) {
|
|
@@ -3904,7 +3915,7 @@ function getTrustLevel(score) {
|
|
|
3904
3915
|
}
|
|
3905
3916
|
|
|
3906
3917
|
// src/version.ts
|
|
3907
|
-
var SDK_VERSION = "3.
|
|
3918
|
+
var SDK_VERSION = "3.11.1";
|
|
3908
3919
|
|
|
3909
3920
|
// src/well-known.ts
|
|
3910
3921
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -4422,10 +4433,12 @@ function toGatewayConfig(config) {
|
|
|
4422
4433
|
};
|
|
4423
4434
|
}
|
|
4424
4435
|
function toVerificationRequest(context, astraId) {
|
|
4436
|
+
const dotIndex = context.purpose.indexOf(".");
|
|
4437
|
+
const dotted = dotIndex > 0;
|
|
4425
4438
|
return {
|
|
4426
4439
|
credentials: { astraId },
|
|
4427
|
-
purpose: context.purpose,
|
|
4428
|
-
action: context.action,
|
|
4440
|
+
purpose: dotted ? context.purpose.slice(0, dotIndex) : context.purpose,
|
|
4441
|
+
action: dotted ? context.purpose : context.action,
|
|
4429
4442
|
resourceType: context.resourceType,
|
|
4430
4443
|
resource: context.target,
|
|
4431
4444
|
transactionValue: context.transactionValue,
|
|
@@ -4668,13 +4681,43 @@ var TraceLogger = class {
|
|
|
4668
4681
|
* Log an evaluation event.
|
|
4669
4682
|
*/
|
|
4670
4683
|
logEvaluation(context, decision) {
|
|
4684
|
+
if (!this.enabled) return;
|
|
4685
|
+
let event;
|
|
4686
|
+
try {
|
|
4687
|
+
event = {
|
|
4688
|
+
id: this.generateId(),
|
|
4689
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4690
|
+
type: "evaluation",
|
|
4691
|
+
context: redactDeep(context),
|
|
4692
|
+
decision: redactDeep(decision)
|
|
4693
|
+
};
|
|
4694
|
+
} catch (err) {
|
|
4695
|
+
event = {
|
|
4696
|
+
id: this.generateId(),
|
|
4697
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4698
|
+
type: "error",
|
|
4699
|
+
metadata: {
|
|
4700
|
+
error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
4701
|
+
recommendation: decision.recommendation,
|
|
4702
|
+
purpose: context.purpose,
|
|
4703
|
+
action: context.action
|
|
4704
|
+
}
|
|
4705
|
+
};
|
|
4706
|
+
}
|
|
4707
|
+
this.write(event);
|
|
4708
|
+
}
|
|
4709
|
+
/**
|
|
4710
|
+
* Log a tool call the guard saw but did not govern. One line per skip
|
|
4711
|
+
* keeps coverage holes (unmapped platform tools) visible in the traces
|
|
4712
|
+
* instead of silently indistinguishable from ALLOW.
|
|
4713
|
+
*/
|
|
4714
|
+
logSkipped(toolName, reason) {
|
|
4671
4715
|
if (!this.enabled) return;
|
|
4672
4716
|
this.write({
|
|
4673
4717
|
id: this.generateId(),
|
|
4674
4718
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4675
|
-
type: "
|
|
4676
|
-
|
|
4677
|
-
decision: redactDeep(decision)
|
|
4719
|
+
type: "skipped",
|
|
4720
|
+
metadata: { toolName, reason }
|
|
4678
4721
|
});
|
|
4679
4722
|
}
|
|
4680
4723
|
/**
|
|
@@ -4703,17 +4746,34 @@ var TraceLogger = class {
|
|
|
4703
4746
|
});
|
|
4704
4747
|
}
|
|
4705
4748
|
write(event) {
|
|
4749
|
+
let line;
|
|
4750
|
+
try {
|
|
4751
|
+
line = JSON.stringify(event) + "\n";
|
|
4752
|
+
} catch {
|
|
4753
|
+
return;
|
|
4754
|
+
}
|
|
4706
4755
|
try {
|
|
4707
4756
|
const filePath = this.getCurrentFilePath();
|
|
4708
|
-
const line = JSON.stringify(event) + "\n";
|
|
4709
4757
|
if (existsSync2(filePath)) {
|
|
4710
4758
|
const stats = statSync(filePath);
|
|
4711
4759
|
if (stats.size > MAX_FILE_SIZE) {
|
|
4712
4760
|
this.rotate();
|
|
4713
4761
|
}
|
|
4714
4762
|
}
|
|
4715
|
-
|
|
4763
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
4764
|
+
try {
|
|
4765
|
+
appendFileSync(filePath, line);
|
|
4766
|
+
return;
|
|
4767
|
+
} catch {
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
|
|
4771
|
+
appendFileSync(fallbackPath, line);
|
|
4716
4772
|
} catch {
|
|
4773
|
+
try {
|
|
4774
|
+
console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
|
|
4775
|
+
} catch {
|
|
4776
|
+
}
|
|
4717
4777
|
}
|
|
4718
4778
|
}
|
|
4719
4779
|
getCurrentFilePath() {
|
|
@@ -4874,6 +4934,13 @@ var AstraSyncGateway = class {
|
|
|
4874
4934
|
getSyncStatus() {
|
|
4875
4935
|
return this.syncQueue?.getStatus() || null;
|
|
4876
4936
|
}
|
|
4937
|
+
/**
|
|
4938
|
+
* Record a tool call the calling adapter saw but did not govern
|
|
4939
|
+
* (unmapped tool, skipTools, MCP with governMcp off). Trace-only.
|
|
4940
|
+
*/
|
|
4941
|
+
logSkippedTool(toolName, reason) {
|
|
4942
|
+
this.traceLogger?.logSkipped(toolName, reason);
|
|
4943
|
+
}
|
|
4877
4944
|
};
|
|
4878
4945
|
|
|
4879
4946
|
// src/cursor/extension.ts
|