@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
package/dist/edge-config.d.mts
CHANGED
package/dist/edge-config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-BntuzEEn.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler, Request } from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { w as VerificationResult, k as ExpressMiddlewareOptions, c as AstraSyncCredentials } from './types-SDu4Llbe.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AstraSync Universal Verification Gateway - Express Middleware
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-Djw4GLtz.mjs';
|
|
2
|
+
import '../types-BntuzEEn.mjs';
|
|
3
3
|
import '../metadata-capture.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { a as AstraSyncGatewayConfig, P as PDLSSContext, V as VerificationDecision } from '../types-DHu7m9HI.js';
|
|
2
|
+
import '../types-SDu4Llbe.js';
|
|
3
3
|
import '../metadata-capture.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/gateway/gateway.js
CHANGED
|
@@ -147,8 +147,9 @@ function extractBacktickSubstitutions(text, collect) {
|
|
|
147
147
|
return kept.join(" ");
|
|
148
148
|
}
|
|
149
149
|
function basename(token) {
|
|
150
|
-
const slash = token.lastIndexOf("/");
|
|
151
|
-
|
|
150
|
+
const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
|
|
151
|
+
const name = slash === -1 ? token : token.slice(slash + 1);
|
|
152
|
+
return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
|
|
152
153
|
}
|
|
153
154
|
function matchSegment(segment, list) {
|
|
154
155
|
const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
|
|
@@ -281,7 +282,9 @@ var LocalEvaluator = class {
|
|
|
281
282
|
}
|
|
282
283
|
return {
|
|
283
284
|
recommendation: "ALLOW",
|
|
284
|
-
|
|
285
|
+
// "evaluated": dimensions absent from the policy are skipped, not
|
|
286
|
+
// failed — evaluatedDimensions below records which ones ran.
|
|
287
|
+
reason: "All evaluated PDLSS checks passed",
|
|
285
288
|
evaluatedDimensions: {
|
|
286
289
|
purpose: true,
|
|
287
290
|
scope: !!this.policy.scope,
|
|
@@ -380,7 +383,7 @@ var LocalEvaluator = class {
|
|
|
380
383
|
}
|
|
381
384
|
}
|
|
382
385
|
if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
|
|
383
|
-
const targetLower = context.target.toLowerCase();
|
|
386
|
+
const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
|
|
384
387
|
for (const sensitivePath of SENSITIVE_PATHS) {
|
|
385
388
|
if (targetLower.includes(sensitivePath.toLowerCase())) {
|
|
386
389
|
score = Math.max(score, 50);
|
|
@@ -409,12 +412,20 @@ var LocalEvaluator = class {
|
|
|
409
412
|
matchesAnyPattern(value, patterns) {
|
|
410
413
|
return patterns.some((pattern) => this.matchGlob(value, pattern));
|
|
411
414
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
homePrefix() {
|
|
416
|
+
if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
|
|
417
|
+
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
418
|
+
const home = env?.HOME || env?.USERPROFILE;
|
|
419
|
+
this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
|
|
420
|
+
return this.cachedHomePrefix;
|
|
421
|
+
}
|
|
417
422
|
matchGlob(value, pattern) {
|
|
423
|
+
value = value.replace(/\\/g, "/");
|
|
424
|
+
pattern = pattern.replace(/\\/g, "/");
|
|
425
|
+
if (pattern === "~" || pattern.startsWith("~/")) {
|
|
426
|
+
const home = this.homePrefix();
|
|
427
|
+
if (home) pattern = home + pattern.slice(1);
|
|
428
|
+
}
|
|
418
429
|
if (pattern === value) return true;
|
|
419
430
|
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
420
431
|
if (starCount > 8) {
|
|
@@ -3687,7 +3698,7 @@ function getTrustLevel(score) {
|
|
|
3687
3698
|
}
|
|
3688
3699
|
|
|
3689
3700
|
// src/version.ts
|
|
3690
|
-
var SDK_VERSION = "3.
|
|
3701
|
+
var SDK_VERSION = "3.12.0";
|
|
3691
3702
|
|
|
3692
3703
|
// src/well-known.ts
|
|
3693
3704
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -3854,6 +3865,7 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
3854
3865
|
}
|
|
3855
3866
|
] : void 0,
|
|
3856
3867
|
correlationId: options.correlationId,
|
|
3868
|
+
attemptId: options.attemptId,
|
|
3857
3869
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
3858
3870
|
};
|
|
3859
3871
|
}
|
|
@@ -3883,6 +3895,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3883
3895
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
3884
3896
|
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
3885
3897
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
3898
|
+
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
3899
|
+
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
3886
3900
|
body.sdkVersion = SDK_VERSION;
|
|
3887
3901
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
3888
3902
|
const meta = {
|
|
@@ -3910,6 +3924,9 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3910
3924
|
if (response.status === 410) {
|
|
3911
3925
|
return {
|
|
3912
3926
|
success: true,
|
|
3927
|
+
// 3.12.0 (Trust Record): keep the server-echoed attempt handle even on
|
|
3928
|
+
// the synthesised 410 deny shape (echoed on every branch).
|
|
3929
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
3913
3930
|
access: {
|
|
3914
3931
|
allowed: false,
|
|
3915
3932
|
accessLevel: "none",
|
|
@@ -3928,7 +3945,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3928
3945
|
return {
|
|
3929
3946
|
success: false,
|
|
3930
3947
|
error: data.message || data.error || `API returned ${response.status}`,
|
|
3931
|
-
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
|
|
3948
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
3949
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
3932
3950
|
};
|
|
3933
3951
|
}
|
|
3934
3952
|
return data;
|
|
@@ -3962,7 +3980,13 @@ async function verify(config, request, options) {
|
|
|
3962
3980
|
if (mergedConfig.debug) {
|
|
3963
3981
|
console.log("[VerificationGateway] Returning cached result");
|
|
3964
3982
|
}
|
|
3965
|
-
|
|
3983
|
+
const hit = { ...cached };
|
|
3984
|
+
if (request.attemptId) {
|
|
3985
|
+
hit.attemptId = request.attemptId;
|
|
3986
|
+
} else {
|
|
3987
|
+
delete hit.attemptId;
|
|
3988
|
+
}
|
|
3989
|
+
return hit;
|
|
3966
3990
|
}
|
|
3967
3991
|
}
|
|
3968
3992
|
const enrichedRequest = { ...request };
|
|
@@ -3982,6 +4006,7 @@ async function verify(config, request, options) {
|
|
|
3982
4006
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
3983
4007
|
source: "api_error",
|
|
3984
4008
|
correlationId: apiResponse.correlationId,
|
|
4009
|
+
attemptId: apiResponse.attemptId,
|
|
3985
4010
|
urls
|
|
3986
4011
|
});
|
|
3987
4012
|
}
|
|
@@ -4017,6 +4042,9 @@ async function verify(config, request, options) {
|
|
|
4017
4042
|
// Anonymous traffic has no session → correlationId is the per-attempt
|
|
4018
4043
|
// linking key (the sessionId-equivalent for anonymous callers).
|
|
4019
4044
|
correlationId: apiResponse.correlationId,
|
|
4045
|
+
// 3.12.0 (Trust Record): server echoes the attempt-chain handle on
|
|
4046
|
+
// every branch — denials included (the funnel outlives one deny).
|
|
4047
|
+
attemptId: apiResponse.attemptId,
|
|
4020
4048
|
recommendation: apiResponse.recommendation,
|
|
4021
4049
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
4022
4050
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
@@ -4068,6 +4096,8 @@ async function verify(config, request, options) {
|
|
|
4068
4096
|
// v2.3.10 (defect #34, round-4): anonymous responses surface correlationId
|
|
4069
4097
|
// (no session row exists for unverified callers).
|
|
4070
4098
|
correlationId: apiResponse.correlationId,
|
|
4099
|
+
// 3.12.0 (Trust Record): server-echoed attempt-chain handle.
|
|
4100
|
+
attemptId: apiResponse.attemptId,
|
|
4071
4101
|
runtimeChallenge: apiResponse.runtimeChallenge,
|
|
4072
4102
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
4073
4103
|
recommendation: apiResponse.recommendation,
|
|
@@ -4451,13 +4481,29 @@ var TraceLogger = class {
|
|
|
4451
4481
|
*/
|
|
4452
4482
|
logEvaluation(context, decision) {
|
|
4453
4483
|
if (!this.enabled) return;
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4484
|
+
let event;
|
|
4485
|
+
try {
|
|
4486
|
+
event = {
|
|
4487
|
+
id: this.generateId(),
|
|
4488
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4489
|
+
type: "evaluation",
|
|
4490
|
+
context: redactDeep(context),
|
|
4491
|
+
decision: redactDeep(decision)
|
|
4492
|
+
};
|
|
4493
|
+
} catch (err) {
|
|
4494
|
+
event = {
|
|
4495
|
+
id: this.generateId(),
|
|
4496
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4497
|
+
type: "error",
|
|
4498
|
+
metadata: {
|
|
4499
|
+
error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
4500
|
+
recommendation: decision.recommendation,
|
|
4501
|
+
purpose: context.purpose,
|
|
4502
|
+
action: context.action
|
|
4503
|
+
}
|
|
4504
|
+
};
|
|
4505
|
+
}
|
|
4506
|
+
this.write(event);
|
|
4461
4507
|
}
|
|
4462
4508
|
/**
|
|
4463
4509
|
* Log a tool call the guard saw but did not govern. One line per skip
|
|
@@ -4499,17 +4545,34 @@ var TraceLogger = class {
|
|
|
4499
4545
|
});
|
|
4500
4546
|
}
|
|
4501
4547
|
write(event) {
|
|
4548
|
+
let line;
|
|
4549
|
+
try {
|
|
4550
|
+
line = JSON.stringify(event) + "\n";
|
|
4551
|
+
} catch {
|
|
4552
|
+
return;
|
|
4553
|
+
}
|
|
4502
4554
|
try {
|
|
4503
4555
|
const filePath = this.getCurrentFilePath();
|
|
4504
|
-
const line = JSON.stringify(event) + "\n";
|
|
4505
4556
|
if ((0, import_fs3.existsSync)(filePath)) {
|
|
4506
4557
|
const stats = (0, import_fs3.statSync)(filePath);
|
|
4507
4558
|
if (stats.size > MAX_FILE_SIZE) {
|
|
4508
4559
|
this.rotate();
|
|
4509
4560
|
}
|
|
4510
4561
|
}
|
|
4511
|
-
(0
|
|
4562
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
4563
|
+
try {
|
|
4564
|
+
(0, import_fs3.appendFileSync)(filePath, line);
|
|
4565
|
+
return;
|
|
4566
|
+
} catch {
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
|
|
4570
|
+
(0, import_fs3.appendFileSync)(fallbackPath, line);
|
|
4512
4571
|
} catch {
|
|
4572
|
+
try {
|
|
4573
|
+
console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
|
|
4574
|
+
} catch {
|
|
4575
|
+
}
|
|
4513
4576
|
}
|
|
4514
4577
|
}
|
|
4515
4578
|
getCurrentFilePath() {
|