@astrasyncai/verification-gateway 2.4.11 → 2.4.14
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 +129 -36
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +129 -36
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +26 -4
- package/dist/adapters/mcp.d.ts +26 -4
- package/dist/adapters/mcp.js +94 -28
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +94 -28
- 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 +75 -29
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +75 -29
- 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 +45 -22
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +45 -22
- 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/agent/index.js +29 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +29 -0
- package/dist/agent/index.mjs.map +1 -1
- package/dist/browser/background.js +86 -24
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +86 -24
- 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/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- 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 +86 -24
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +86 -24
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-C1ePFB7n.d.ts → express-CrfwoNAR.d.ts} +1 -1
- package/dist/{express-4WStX3PV.d.mts → express-ienhAXps.d.mts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +86 -24
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +86 -24
- 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-ChPX4WHl.d.mts → index-B5e2IDWU.d.mts} +1 -1
- package/dist/{index-CzJMCgEy.d.ts → index-CCdZxvAr.d.ts} +71 -6
- package/dist/{index-D8IEntil.d.mts → index-CEg_WG6y.d.mts} +71 -6
- package/dist/{index-Cjm-zBeZ.d.ts → index-DC5f8eoQ.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +344 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +344 -73
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +2 -2
- package/dist/local-evaluator/evaluator.d.ts +2 -2
- package/dist/local-evaluator/evaluator.js +12 -2
- package/dist/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs +12 -2
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{nextjs-BIORS__0.d.ts → nextjs-66R1KW8e.d.ts} +1 -1
- package/dist/{nextjs-CjzHdaXA.d.mts → nextjs-DSpisQst.d.mts} +1 -1
- package/dist/{sdk-Chhz-FcT.d.mts → sdk-5U_CBRpr.d.mts} +1 -1
- package/dist/{sdk-CqTEQAc6.d.ts → sdk-Bm8np66n.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +146 -28
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +146 -28
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-L15pYd2c.d.mts → types-B3USs-Kx.d.mts} +42 -1
- package/dist/{types-L15pYd2c.d.ts → types-B3USs-Kx.d.ts} +42 -1
- package/dist/{types-DNK2BgIf.d.mts → types-CgDCUfo8.d.mts} +1 -1
- package/dist/{types-DoWIuzfj.d.ts → types-R5N4ET6x.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -346,7 +346,10 @@ var LocalEvaluator = class {
|
|
|
346
346
|
}
|
|
347
347
|
const depth = context.metadata?.subAgentDepth || 0;
|
|
348
348
|
if (this.policy.selfInstantiation.maxDepth !== void 0 && depth >= this.policy.selfInstantiation.maxDepth) {
|
|
349
|
-
return {
|
|
349
|
+
return {
|
|
350
|
+
recommendation: "DENY",
|
|
351
|
+
reason: `Sub-agent depth ${depth} exceeds max depth ${this.policy.selfInstantiation.maxDepth}`
|
|
352
|
+
};
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
if (purposeRule.requiresApproval) {
|
|
@@ -427,7 +430,10 @@ var LocalEvaluator = class {
|
|
|
427
430
|
return { recommendation: "DENY", reason: `Risk score ${riskScore} exceeds block threshold` };
|
|
428
431
|
}
|
|
429
432
|
if (riskScore >= thresholds.requireApproval.min) {
|
|
430
|
-
return {
|
|
433
|
+
return {
|
|
434
|
+
recommendation: "MANUAL_REVIEW",
|
|
435
|
+
reason: `Risk score ${riskScore} requires approval`
|
|
436
|
+
};
|
|
431
437
|
}
|
|
432
438
|
return null;
|
|
433
439
|
}
|
|
@@ -492,6 +498,10 @@ var LocalEvaluator = class {
|
|
|
492
498
|
*/
|
|
493
499
|
matchGlob(value, pattern) {
|
|
494
500
|
if (pattern === value) return true;
|
|
501
|
+
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
502
|
+
if (starCount > 8) {
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
495
505
|
const regexStr = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
496
506
|
try {
|
|
497
507
|
return new RegExp(`^${regexStr}$`, "i").test(value);
|
|
@@ -3295,7 +3305,7 @@ function getTrustLevel(score) {
|
|
|
3295
3305
|
}
|
|
3296
3306
|
|
|
3297
3307
|
// src/version.ts
|
|
3298
|
-
var SDK_VERSION = "2.4.
|
|
3308
|
+
var SDK_VERSION = "2.4.13";
|
|
3299
3309
|
|
|
3300
3310
|
// src/verify.ts
|
|
3301
3311
|
var DEFAULT_CONFIG = {
|
|
@@ -3314,22 +3324,27 @@ var DEFAULT_CONFIG = {
|
|
|
3314
3324
|
};
|
|
3315
3325
|
var initCheckPerformed = false;
|
|
3316
3326
|
var deprecationWarningShown = false;
|
|
3317
|
-
async function performInitCheck(apiBaseUrl, debug) {
|
|
3327
|
+
async function performInitCheck(apiBaseUrl, debug, strictInit) {
|
|
3318
3328
|
initCheckPerformed = true;
|
|
3319
3329
|
try {
|
|
3320
3330
|
const probeUrl = `${apiBaseUrl}/agents/verify-access`;
|
|
3321
3331
|
const response = await fetch(probeUrl, { method: "HEAD" });
|
|
3322
3332
|
const contentType = response.headers.get("content-type") ?? "";
|
|
3323
3333
|
if (contentType.startsWith("text/html")) {
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3334
|
+
const message = `[VerificationGateway] apiBaseUrl '${apiBaseUrl}' returned HTML (content-type: ${contentType}). This usually means apiBaseUrl is pointing at a marketing site instead of the API. Expected: 'https://astrasync.ai/api' (prod) or 'https://staging.astrasync.ai/api' (staging).`;
|
|
3335
|
+
if (strictInit) {
|
|
3336
|
+
throw new Error(`${message} (strictInit=true)`);
|
|
3337
|
+
}
|
|
3338
|
+
console.warn(`${message} Set disableInitChecks: true on GatewayConfig to silence.`);
|
|
3327
3339
|
} else if (debug) {
|
|
3328
3340
|
console.log(
|
|
3329
3341
|
`[VerificationGateway] init check passed for ${apiBaseUrl} (content-type: ${contentType})`
|
|
3330
3342
|
);
|
|
3331
3343
|
}
|
|
3332
3344
|
} catch (err) {
|
|
3345
|
+
if (strictInit) {
|
|
3346
|
+
throw err;
|
|
3347
|
+
}
|
|
3333
3348
|
if (debug) {
|
|
3334
3349
|
console.log(`[VerificationGateway] init check failed (non-blocking): ${String(err)}`);
|
|
3335
3350
|
}
|
|
@@ -3353,7 +3368,23 @@ function getCacheKey(request) {
|
|
|
3353
3368
|
request.counterpartyType || "",
|
|
3354
3369
|
request.isSubAgentRequest ? "1" : "0",
|
|
3355
3370
|
request.parentAgentId || "",
|
|
3356
|
-
request.subAgentDepth ?? ""
|
|
3371
|
+
request.subAgentDepth ?? "",
|
|
3372
|
+
// Audit F-A1-07: previously-missing dimensions that DO affect the
|
|
3373
|
+
// backend verdict. Without these, two requests with different
|
|
3374
|
+
// durations (e.g. 60s vs 86400s) collided on the same cache key and
|
|
3375
|
+
// the shorter-duration allow served the longer-duration request.
|
|
3376
|
+
request.durationRequired ?? "",
|
|
3377
|
+
request.invocationProtocol || "",
|
|
3378
|
+
request.enableRuntimeChallenge ? "1" : "0",
|
|
3379
|
+
// callerMetadata fields contribute to risk model; include the ones
|
|
3380
|
+
// backend reads. sourceIp/userAgent/forwardedFor change per-request
|
|
3381
|
+
// so their inclusion effectively forces a re-check for any varying
|
|
3382
|
+
// client (the right behavior — IP-driven anomaly scoring shouldn't
|
|
3383
|
+
// be cached across IPs).
|
|
3384
|
+
request.callerMetadata?.sourceIp || "",
|
|
3385
|
+
request.callerMetadata?.userAgent || "",
|
|
3386
|
+
request.callerMetadata?.forwardedFor || "",
|
|
3387
|
+
request.callerMetadata?.agentCardUrl || ""
|
|
3357
3388
|
].join("|");
|
|
3358
3389
|
}
|
|
3359
3390
|
function getCachedResult(request) {
|
|
@@ -3382,7 +3413,7 @@ function createGuidanceResponse(config, reason, options = {}) {
|
|
|
3382
3413
|
const isApiError = source === "api_error";
|
|
3383
3414
|
const guidance = isApiError ? {
|
|
3384
3415
|
message: "Verification is temporarily unavailable. Retry with exponential backoff; if the issue persists, contact support with the correlationId.",
|
|
3385
|
-
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
|
|
3416
|
+
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/agents/register`,
|
|
3386
3417
|
documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
|
|
3387
3418
|
steps: [
|
|
3388
3419
|
"Retry the request with exponential backoff",
|
|
@@ -3390,7 +3421,7 @@ function createGuidanceResponse(config, reason, options = {}) {
|
|
|
3390
3421
|
]
|
|
3391
3422
|
} : {
|
|
3392
3423
|
message: "This service verifies AI agents before granting access. Please register your agent with AstraSync.",
|
|
3393
|
-
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/register`,
|
|
3424
|
+
registrationUrl: `${config.apiBaseUrl.replace("/api", "")}/agents/register`,
|
|
3394
3425
|
documentationUrl: `${config.apiBaseUrl.replace("/api", "")}/docs/agent-access`,
|
|
3395
3426
|
steps: [
|
|
3396
3427
|
"Register for an AstraSync account",
|
|
@@ -3467,12 +3498,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3467
3498
|
"Content-Type": "application/json",
|
|
3468
3499
|
...config.customHeaders
|
|
3469
3500
|
};
|
|
3470
|
-
if (credentials.authorizationHeader) {
|
|
3471
|
-
headers["Authorization"] = credentials.authorizationHeader;
|
|
3472
|
-
} else if (config.apiKey) {
|
|
3473
|
-
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
3474
|
-
}
|
|
3475
3501
|
if (config.apiKey) {
|
|
3502
|
+
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
3476
3503
|
headers["X-API-Key"] = config.apiKey;
|
|
3477
3504
|
}
|
|
3478
3505
|
try {
|
|
@@ -3518,7 +3545,11 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
3518
3545
|
async function verify(config, request) {
|
|
3519
3546
|
const mergedConfig = { ...DEFAULT_CONFIG, ...config };
|
|
3520
3547
|
if (!initCheckPerformed && !mergedConfig.disableInitChecks && mergedConfig.apiBaseUrl) {
|
|
3521
|
-
|
|
3548
|
+
if (mergedConfig.strictInit) {
|
|
3549
|
+
await performInitCheck(mergedConfig.apiBaseUrl, mergedConfig.debug, true);
|
|
3550
|
+
} else {
|
|
3551
|
+
void performInitCheck(mergedConfig.apiBaseUrl, mergedConfig.debug, false);
|
|
3552
|
+
}
|
|
3522
3553
|
}
|
|
3523
3554
|
if (!deprecationWarningShown && (config.minTrustScore !== void 0 || config.minTrustScoreForFull !== void 0)) {
|
|
3524
3555
|
deprecationWarningShown = true;
|
|
@@ -3572,7 +3603,7 @@ async function verify(config, request) {
|
|
|
3572
3603
|
requiresApproval: apiResponse.access?.requiresApproval,
|
|
3573
3604
|
guidance: {
|
|
3574
3605
|
message: apiResponse.access?.reason || "Access denied by PDLSS policy",
|
|
3575
|
-
registrationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/register`,
|
|
3606
|
+
registrationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/agents/register`,
|
|
3576
3607
|
documentationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/docs/pdlss`
|
|
3577
3608
|
},
|
|
3578
3609
|
verifiedAt: /* @__PURE__ */ new Date(),
|
|
@@ -3642,13 +3673,15 @@ async function verify(config, request) {
|
|
|
3642
3673
|
result.denialReasons = result.recommendationReasons || [
|
|
3643
3674
|
"Access denied by AstraSync recommendation"
|
|
3644
3675
|
];
|
|
3645
|
-
|
|
3646
|
-
result.
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3676
|
+
result.guidance = result.runtimeChallenge ? {
|
|
3677
|
+
message: `Verification failed: ${result.runtimeChallenge.reason || "runtime challenge failed"}`,
|
|
3678
|
+
registrationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/agents/register`,
|
|
3679
|
+
documentationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/docs/runtime-challenge`
|
|
3680
|
+
} : {
|
|
3681
|
+
message: result.recommendationReasons?.[0] || "Access denied by AstraSync recommendation",
|
|
3682
|
+
registrationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/agents/register`,
|
|
3683
|
+
documentationUrl: `${mergedConfig.apiBaseUrl?.replace("/api", "")}/docs/pdlss`
|
|
3684
|
+
};
|
|
3652
3685
|
} else if (result.recommendation === "step_up_required") {
|
|
3653
3686
|
result.requiresStepUp = true;
|
|
3654
3687
|
if (ACCESS_LEVEL_HIERARCHY[result.accessLevel] > ACCESS_LEVEL_HIERARCHY["read-only"]) {
|
|
@@ -3674,6 +3707,35 @@ var import_structured_headers = require("structured-headers");
|
|
|
3674
3707
|
// src/transport/rfc9421-verify.ts
|
|
3675
3708
|
var import_http_message_signatures = require("http-message-signatures");
|
|
3676
3709
|
|
|
3710
|
+
// src/transport/nonce-store.ts
|
|
3711
|
+
var InMemoryNonceStore = class {
|
|
3712
|
+
constructor(capacity = 1e4) {
|
|
3713
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
3714
|
+
this.lastSweepMs = 0;
|
|
3715
|
+
this.capacity = capacity;
|
|
3716
|
+
}
|
|
3717
|
+
seen(key, expiresAtMs) {
|
|
3718
|
+
const nowMs = Date.now();
|
|
3719
|
+
if (nowMs - this.lastSweepMs > 1e3) {
|
|
3720
|
+
for (const [k, exp] of this.entries) {
|
|
3721
|
+
if (exp <= nowMs) this.entries.delete(k);
|
|
3722
|
+
}
|
|
3723
|
+
this.lastSweepMs = nowMs;
|
|
3724
|
+
}
|
|
3725
|
+
const existing = this.entries.get(key);
|
|
3726
|
+
if (existing !== void 0 && existing > nowMs) {
|
|
3727
|
+
return true;
|
|
3728
|
+
}
|
|
3729
|
+
if (this.entries.size >= this.capacity) {
|
|
3730
|
+
const oldest = this.entries.keys().next().value;
|
|
3731
|
+
if (oldest !== void 0) this.entries.delete(oldest);
|
|
3732
|
+
}
|
|
3733
|
+
this.entries.set(key, expiresAtMs);
|
|
3734
|
+
return false;
|
|
3735
|
+
}
|
|
3736
|
+
};
|
|
3737
|
+
var defaultNonceStore = new InMemoryNonceStore();
|
|
3738
|
+
|
|
3677
3739
|
// src/transport/vi.ts
|
|
3678
3740
|
var import_decode = require("@sd-jwt/decode");
|
|
3679
3741
|
var import_node_crypto = require("crypto");
|