@astrasyncai/verification-gateway 3.11.0 → 3.12.0
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 +2 -2
- package/dist/adapter-interface/interface.d.ts +2 -2
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +22 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +22 -3
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +22 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +22 -3
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +2 -2
- package/dist/adapters/nextjs.d.ts +2 -2
- package/dist/adapters/nextjs.js +22 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +22 -3
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +2 -2
- package/dist/adapters/sdk.d.ts +2 -2
- package/dist/adapters/sdk.js +22 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +22 -3
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/bin/astrasync-claude-hook.js +84 -21
- package/dist/bin/astrasync-codex-hook.js +84 -21
- package/dist/bin/astrasync-guard.js +84 -21
- package/dist/bin/astrasync.js +85 -21
- package/dist/browser/background.js +84 -21
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +84 -21
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +2 -2
- package/dist/browser/browser-adapter.d.ts +2 -2
- package/dist/claude-code/claude-code-adapter.d.mts +2 -2
- package/dist/claude-code/claude-code-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/codex/index.d.mts +2 -2
- package/dist/codex/index.d.ts +2 -2
- package/dist/codex/index.js +84 -21
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +84 -21
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/cursor-adapter.d.mts +2 -2
- package/dist/cursor/cursor-adapter.d.ts +2 -2
- package/dist/cursor/extension.d.mts +2 -2
- package/dist/cursor/extension.d.ts +2 -2
- package/dist/cursor/extension.js +84 -21
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +84 -21
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/{express-DCXa1oqj.d.mts → express-B39o89gf.d.mts} +1 -1
- package/dist/{express-ClNtDhhc.d.ts → express-BuxKNO_q.d.ts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +84 -21
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +84 -21
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +2 -2
- package/dist/git-trigger/git-hooks.d.ts +2 -2
- package/dist/{index-CfHurO1P.d.ts → index-BG62SXso.d.ts} +1 -1
- package/dist/{index-D2ztkumS.d.ts → index-CLHdqs2M.d.ts} +1 -1
- package/dist/{index-Dr_XiN65.d.mts → index-CqydB4ks.d.mts} +1 -1
- package/dist/{index-BrNKDmiR.d.mts → index-DME3w3lf.d.mts} +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -3
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +11 -2
- package/dist/local-evaluator/evaluator.d.ts +11 -2
- 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/{nextjs-DcQIk6Zj.d.mts → nextjs-D74W7wt-.d.mts} +1 -1
- package/dist/{nextjs-CEBVBsdi.d.ts → nextjs-Ddlw_J1J.d.ts} +1 -1
- package/dist/{sdk-CZkbSOeO.d.mts → sdk-Bn6bj7kt.d.mts} +1 -1
- package/dist/{sdk-H0JCLW2y.d.ts → sdk-CT7gdkfR.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-sy3tq8lp.d.mts → types-BntuzEEn.d.mts} +103 -1
- package/dist/{types-BV6abBnF.d.mts → types-DHu7m9HI.d.ts} +7 -2
- package/dist/{types-C23_uaY8.d.ts → types-Djw4GLtz.d.mts} +7 -2
- package/dist/{types-9tns4wyl.d.ts → types-SDu4Llbe.d.ts} +103 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +13 -2
- package/dist/verify.d.ts +13 -2
- package/dist/verify.js +42 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +41 -3
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
|
|
2
|
-
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-
|
|
2
|
+
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-Djw4GLtz.mjs';
|
|
3
3
|
import '../gateway/gateway.mjs';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-BntuzEEn.mjs';
|
|
5
5
|
import '../metadata-capture.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
|
|
2
|
-
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-
|
|
2
|
+
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DHu7m9HI.js';
|
|
3
3
|
import '../gateway/gateway.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-SDu4Llbe.js';
|
|
5
5
|
import '../metadata-capture.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VSCodeAPI } from './cursor-adapter.mjs';
|
|
2
2
|
import '../adapter-interface/interface.mjs';
|
|
3
3
|
import '../gateway/gateway.mjs';
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../types-
|
|
4
|
+
import '../types-Djw4GLtz.mjs';
|
|
5
|
+
import '../types-BntuzEEn.mjs';
|
|
6
6
|
import '../metadata-capture.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VSCodeAPI } from './cursor-adapter.js';
|
|
2
2
|
import '../adapter-interface/interface.js';
|
|
3
3
|
import '../gateway/gateway.js';
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../types-
|
|
4
|
+
import '../types-DHu7m9HI.js';
|
|
5
|
+
import '../types-SDu4Llbe.js';
|
|
6
6
|
import '../metadata-capture.js';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/cursor/extension.js
CHANGED
|
@@ -391,8 +391,9 @@ function extractBacktickSubstitutions(text, collect) {
|
|
|
391
391
|
return kept.join(" ");
|
|
392
392
|
}
|
|
393
393
|
function basename(token) {
|
|
394
|
-
const slash = token.lastIndexOf("/");
|
|
395
|
-
|
|
394
|
+
const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
|
|
395
|
+
const name = slash === -1 ? token : token.slice(slash + 1);
|
|
396
|
+
return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
|
|
396
397
|
}
|
|
397
398
|
function matchSegment(segment, list) {
|
|
398
399
|
const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
|
|
@@ -525,7 +526,9 @@ var LocalEvaluator = class {
|
|
|
525
526
|
}
|
|
526
527
|
return {
|
|
527
528
|
recommendation: "ALLOW",
|
|
528
|
-
|
|
529
|
+
// "evaluated": dimensions absent from the policy are skipped, not
|
|
530
|
+
// failed — evaluatedDimensions below records which ones ran.
|
|
531
|
+
reason: "All evaluated PDLSS checks passed",
|
|
529
532
|
evaluatedDimensions: {
|
|
530
533
|
purpose: true,
|
|
531
534
|
scope: !!this.policy.scope,
|
|
@@ -624,7 +627,7 @@ var LocalEvaluator = class {
|
|
|
624
627
|
}
|
|
625
628
|
}
|
|
626
629
|
if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
|
|
627
|
-
const targetLower = context.target.toLowerCase();
|
|
630
|
+
const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
|
|
628
631
|
for (const sensitivePath of SENSITIVE_PATHS) {
|
|
629
632
|
if (targetLower.includes(sensitivePath.toLowerCase())) {
|
|
630
633
|
score = Math.max(score, 50);
|
|
@@ -653,12 +656,20 @@ var LocalEvaluator = class {
|
|
|
653
656
|
matchesAnyPattern(value, patterns) {
|
|
654
657
|
return patterns.some((pattern) => this.matchGlob(value, pattern));
|
|
655
658
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
659
|
+
homePrefix() {
|
|
660
|
+
if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
|
|
661
|
+
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
662
|
+
const home = env?.HOME || env?.USERPROFILE;
|
|
663
|
+
this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
|
|
664
|
+
return this.cachedHomePrefix;
|
|
665
|
+
}
|
|
661
666
|
matchGlob(value, pattern) {
|
|
667
|
+
value = value.replace(/\\/g, "/");
|
|
668
|
+
pattern = pattern.replace(/\\/g, "/");
|
|
669
|
+
if (pattern === "~" || pattern.startsWith("~/")) {
|
|
670
|
+
const home = this.homePrefix();
|
|
671
|
+
if (home) pattern = home + pattern.slice(1);
|
|
672
|
+
}
|
|
662
673
|
if (pattern === value) return true;
|
|
663
674
|
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
664
675
|
if (starCount > 8) {
|
|
@@ -3931,7 +3942,7 @@ function getTrustLevel(score) {
|
|
|
3931
3942
|
}
|
|
3932
3943
|
|
|
3933
3944
|
// src/version.ts
|
|
3934
|
-
var SDK_VERSION = "3.
|
|
3945
|
+
var SDK_VERSION = "3.12.0";
|
|
3935
3946
|
|
|
3936
3947
|
// src/well-known.ts
|
|
3937
3948
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -4098,6 +4109,7 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4098
4109
|
}
|
|
4099
4110
|
] : void 0,
|
|
4100
4111
|
correlationId: options.correlationId,
|
|
4112
|
+
attemptId: options.attemptId,
|
|
4101
4113
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
4102
4114
|
};
|
|
4103
4115
|
}
|
|
@@ -4127,6 +4139,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4127
4139
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
4128
4140
|
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
4129
4141
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
4142
|
+
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
4143
|
+
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
4130
4144
|
body.sdkVersion = SDK_VERSION;
|
|
4131
4145
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
4132
4146
|
const meta = {
|
|
@@ -4154,6 +4168,9 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4154
4168
|
if (response.status === 410) {
|
|
4155
4169
|
return {
|
|
4156
4170
|
success: true,
|
|
4171
|
+
// 3.12.0 (Trust Record): keep the server-echoed attempt handle even on
|
|
4172
|
+
// the synthesised 410 deny shape (echoed on every branch).
|
|
4173
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
4157
4174
|
access: {
|
|
4158
4175
|
allowed: false,
|
|
4159
4176
|
accessLevel: "none",
|
|
@@ -4172,7 +4189,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4172
4189
|
return {
|
|
4173
4190
|
success: false,
|
|
4174
4191
|
error: data.message || data.error || `API returned ${response.status}`,
|
|
4175
|
-
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
|
|
4192
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
4193
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
4176
4194
|
};
|
|
4177
4195
|
}
|
|
4178
4196
|
return data;
|
|
@@ -4206,7 +4224,13 @@ async function verify(config, request, options) {
|
|
|
4206
4224
|
if (mergedConfig.debug) {
|
|
4207
4225
|
console.log("[VerificationGateway] Returning cached result");
|
|
4208
4226
|
}
|
|
4209
|
-
|
|
4227
|
+
const hit = { ...cached };
|
|
4228
|
+
if (request.attemptId) {
|
|
4229
|
+
hit.attemptId = request.attemptId;
|
|
4230
|
+
} else {
|
|
4231
|
+
delete hit.attemptId;
|
|
4232
|
+
}
|
|
4233
|
+
return hit;
|
|
4210
4234
|
}
|
|
4211
4235
|
}
|
|
4212
4236
|
const enrichedRequest = { ...request };
|
|
@@ -4226,6 +4250,7 @@ async function verify(config, request, options) {
|
|
|
4226
4250
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
4227
4251
|
source: "api_error",
|
|
4228
4252
|
correlationId: apiResponse.correlationId,
|
|
4253
|
+
attemptId: apiResponse.attemptId,
|
|
4229
4254
|
urls
|
|
4230
4255
|
});
|
|
4231
4256
|
}
|
|
@@ -4261,6 +4286,9 @@ async function verify(config, request, options) {
|
|
|
4261
4286
|
// Anonymous traffic has no session → correlationId is the per-attempt
|
|
4262
4287
|
// linking key (the sessionId-equivalent for anonymous callers).
|
|
4263
4288
|
correlationId: apiResponse.correlationId,
|
|
4289
|
+
// 3.12.0 (Trust Record): server echoes the attempt-chain handle on
|
|
4290
|
+
// every branch — denials included (the funnel outlives one deny).
|
|
4291
|
+
attemptId: apiResponse.attemptId,
|
|
4264
4292
|
recommendation: apiResponse.recommendation,
|
|
4265
4293
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
4266
4294
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
@@ -4312,6 +4340,8 @@ async function verify(config, request, options) {
|
|
|
4312
4340
|
// v2.3.10 (defect #34, round-4): anonymous responses surface correlationId
|
|
4313
4341
|
// (no session row exists for unverified callers).
|
|
4314
4342
|
correlationId: apiResponse.correlationId,
|
|
4343
|
+
// 3.12.0 (Trust Record): server-echoed attempt-chain handle.
|
|
4344
|
+
attemptId: apiResponse.attemptId,
|
|
4315
4345
|
runtimeChallenge: apiResponse.runtimeChallenge,
|
|
4316
4346
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
4317
4347
|
recommendation: apiResponse.recommendation,
|
|
@@ -4695,13 +4725,29 @@ var TraceLogger = class {
|
|
|
4695
4725
|
*/
|
|
4696
4726
|
logEvaluation(context, decision) {
|
|
4697
4727
|
if (!this.enabled) return;
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4728
|
+
let event;
|
|
4729
|
+
try {
|
|
4730
|
+
event = {
|
|
4731
|
+
id: this.generateId(),
|
|
4732
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4733
|
+
type: "evaluation",
|
|
4734
|
+
context: redactDeep(context),
|
|
4735
|
+
decision: redactDeep(decision)
|
|
4736
|
+
};
|
|
4737
|
+
} catch (err) {
|
|
4738
|
+
event = {
|
|
4739
|
+
id: this.generateId(),
|
|
4740
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4741
|
+
type: "error",
|
|
4742
|
+
metadata: {
|
|
4743
|
+
error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
4744
|
+
recommendation: decision.recommendation,
|
|
4745
|
+
purpose: context.purpose,
|
|
4746
|
+
action: context.action
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
}
|
|
4750
|
+
this.write(event);
|
|
4705
4751
|
}
|
|
4706
4752
|
/**
|
|
4707
4753
|
* Log a tool call the guard saw but did not govern. One line per skip
|
|
@@ -4743,17 +4789,34 @@ var TraceLogger = class {
|
|
|
4743
4789
|
});
|
|
4744
4790
|
}
|
|
4745
4791
|
write(event) {
|
|
4792
|
+
let line;
|
|
4793
|
+
try {
|
|
4794
|
+
line = JSON.stringify(event) + "\n";
|
|
4795
|
+
} catch {
|
|
4796
|
+
return;
|
|
4797
|
+
}
|
|
4746
4798
|
try {
|
|
4747
4799
|
const filePath = this.getCurrentFilePath();
|
|
4748
|
-
const line = JSON.stringify(event) + "\n";
|
|
4749
4800
|
if ((0, import_fs3.existsSync)(filePath)) {
|
|
4750
4801
|
const stats = (0, import_fs3.statSync)(filePath);
|
|
4751
4802
|
if (stats.size > MAX_FILE_SIZE) {
|
|
4752
4803
|
this.rotate();
|
|
4753
4804
|
}
|
|
4754
4805
|
}
|
|
4755
|
-
(0
|
|
4806
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
4807
|
+
try {
|
|
4808
|
+
(0, import_fs3.appendFileSync)(filePath, line);
|
|
4809
|
+
return;
|
|
4810
|
+
} catch {
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
|
|
4814
|
+
(0, import_fs3.appendFileSync)(fallbackPath, line);
|
|
4756
4815
|
} catch {
|
|
4816
|
+
try {
|
|
4817
|
+
console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
|
|
4818
|
+
} catch {
|
|
4819
|
+
}
|
|
4757
4820
|
}
|
|
4758
4821
|
}
|
|
4759
4822
|
getCurrentFilePath() {
|