@astrasyncai/verification-gateway 2.4.8 → 2.4.9
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 +29 -15
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +29 -15
- 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 +30 -14
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +30 -14
- 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 +37 -16
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +37 -16
- 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 +31 -13
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +31 -13
- 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/browser/background.js +25 -12
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +25 -12
- 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 +25 -12
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +25 -12
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-DvVjR2H4.d.mts → express-4WStX3PV.d.mts} +1 -1
- package/dist/{express-714gJbaW.d.ts → express-C1ePFB7n.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 +25 -12
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +25 -12
- 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-DYFS9QVb.d.mts → index-ChPX4WHl.d.mts} +1 -1
- package/dist/{index-DO0oG8ED.d.ts → index-Cjm-zBeZ.d.ts} +1 -1
- package/dist/{index-2WAlxs2G.d.ts → index-CzJMCgEy.d.ts} +1 -1
- package/dist/{index-P9t7M_dJ.d.mts → index-D8IEntil.d.mts} +1 -1
- package/dist/index.d.mts +22 -11
- package/dist/index.d.ts +22 -11
- package/dist/index.js +80 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -25
- 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/{nextjs-CZ-MwSOT.d.ts → nextjs-BIORS__0.d.ts} +1 -1
- package/dist/{nextjs-BCoH7EqF.d.mts → nextjs-CjzHdaXA.d.mts} +1 -1
- package/dist/registration/index.d.mts +76 -1
- package/dist/registration/index.d.ts +76 -1
- package/dist/registration/index.js +27 -2
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +25 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-wwhFDXWX.d.mts → sdk-Chhz-FcT.d.mts} +9 -4
- package/dist/{sdk-kiA49vqJ.d.ts → sdk-CqTEQAc6.d.ts} +9 -4
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-DOAb89cm.d.mts → types-DNK2BgIf.d.mts} +1 -1
- package/dist/{types-aucqzfUa.d.ts → types-DoWIuzfj.d.ts} +1 -1
- package/dist/{types-BwDmjIdr.d.mts → types-L15pYd2c.d.mts} +21 -4
- package/dist/{types-BwDmjIdr.d.ts → types-L15pYd2c.d.ts} +21 -4
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1 -1
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function hasMinimumAccess(actual, required) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// src/version.ts
|
|
21
|
-
var SDK_VERSION = "2.4.
|
|
21
|
+
var SDK_VERSION = "2.4.9";
|
|
22
22
|
|
|
23
23
|
// src/verify.ts
|
|
24
24
|
var DEFAULT_CONFIG = {
|
|
@@ -129,12 +129,17 @@ function createGuidanceResponse(config, reason, options = {}) {
|
|
|
129
129
|
]
|
|
130
130
|
};
|
|
131
131
|
return {
|
|
132
|
-
|
|
132
|
+
// Round-18 G4: createGuidanceResponse fires for unverified-agent path or
|
|
133
|
+
// API-error fallback. Identity is not verified (no agent resolved);
|
|
134
|
+
// policy is not evaluated (we never reached the gate).
|
|
135
|
+
identityVerified: false,
|
|
136
|
+
policyAllowed: false,
|
|
133
137
|
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
134
|
-
// Adapters additionally short-circuit on
|
|
135
|
-
// the gate check, but the access level still has
|
|
136
|
-
// data layer so downstream consumers (SDK adapters
|
|
137
|
-
// custom integrations) inherit the correct
|
|
138
|
+
// Adapters additionally short-circuit on `!identityVerified ||
|
|
139
|
+
// !policyAllowed` before the gate check, but the access level still has
|
|
140
|
+
// to be honest at the data layer so downstream consumers (SDK adapters
|
|
141
|
+
// in other languages, custom integrations) inherit the correct
|
|
142
|
+
// semantics.
|
|
138
143
|
accessLevel: "none",
|
|
139
144
|
guidance,
|
|
140
145
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
@@ -278,15 +283,17 @@ async function verify(config, request) {
|
|
|
278
283
|
}
|
|
279
284
|
if (!apiResponse.access?.allowed) {
|
|
280
285
|
const aggregatedFailures = apiResponse.access?.failures;
|
|
286
|
+
const idVerifiedFromBackend = apiResponse.verificationContext?.idVerified === true;
|
|
281
287
|
const result2 = {
|
|
282
|
-
|
|
288
|
+
identityVerified: idVerifiedFromBackend,
|
|
289
|
+
policyAllowed: false,
|
|
283
290
|
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
284
291
|
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
285
292
|
// colocated `guidance: {...}` help-payload object below and let
|
|
286
293
|
// denied requests pass any route gated at `'guidance'` because
|
|
287
294
|
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
288
|
-
// ALSO short-circuit on
|
|
289
|
-
// belt-and-braces.
|
|
295
|
+
// ALSO short-circuit on `!identityVerified || !policyAllowed` before
|
|
296
|
+
// the gate check — belt-and-braces.
|
|
290
297
|
accessLevel: "none",
|
|
291
298
|
denialReasons: aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"],
|
|
292
299
|
failures: aggregatedFailures,
|
|
@@ -330,7 +337,13 @@ async function verify(config, request) {
|
|
|
330
337
|
const verificationContext = apiResponse.verificationContext;
|
|
331
338
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
332
339
|
const result = {
|
|
333
|
-
|
|
340
|
+
// Round-18 G4: backend allowed access. Identity is verified (we resolved
|
|
341
|
+
// the caller to an agent) and policy passed all gates. Read idVerified
|
|
342
|
+
// from verificationContext for symmetry with the deny branch; default true
|
|
343
|
+
// on success path since `access.allowed === true` implies identity was
|
|
344
|
+
// resolvable (anonymous-allow paths flow through createGuidanceResponse).
|
|
345
|
+
identityVerified: apiResponse.verificationContext?.idVerified !== false,
|
|
346
|
+
policyAllowed: true,
|
|
334
347
|
accessLevel,
|
|
335
348
|
agent,
|
|
336
349
|
developer,
|
|
@@ -353,7 +366,7 @@ async function verify(config, request) {
|
|
|
353
366
|
warningHeader: apiResponse.warningHeader
|
|
354
367
|
};
|
|
355
368
|
if (result.recommendation === "deny") {
|
|
356
|
-
result.
|
|
369
|
+
result.policyAllowed = false;
|
|
357
370
|
result.accessLevel = "none";
|
|
358
371
|
result.denialReasons = result.recommendationReasons || [
|
|
359
372
|
"Access denied by AstraSync recommendation"
|
|
@@ -543,13 +556,16 @@ function readSingleHeader(value) {
|
|
|
543
556
|
}
|
|
544
557
|
function defaultMcpDenied(result, req, res) {
|
|
545
558
|
const id = req.body?.id ?? null;
|
|
546
|
-
const status = result.
|
|
559
|
+
const status = !result.identityVerified ? 401 : 403;
|
|
547
560
|
res.setHeader("X-Astra-Gateway-Mode", "enforced");
|
|
548
561
|
res.status(status).json({
|
|
549
562
|
jsonrpc: "2.0",
|
|
550
563
|
id,
|
|
551
564
|
error: {
|
|
552
|
-
|
|
565
|
+
// JSON-RPC error codes:
|
|
566
|
+
// -32000 → unauthorized (no identity resolved)
|
|
567
|
+
// -32001 → insufficient access (identity OK, policy denied)
|
|
568
|
+
code: !result.identityVerified ? -32e3 : -32001,
|
|
553
569
|
message: result.denialReasons?.[0] ?? "Access denied",
|
|
554
570
|
data: {
|
|
555
571
|
accessLevel: result.accessLevel,
|
|
@@ -683,7 +699,7 @@ function createMcpMiddleware(options) {
|
|
|
683
699
|
req.agentVerification = result;
|
|
684
700
|
const sessionId = result.sessionId;
|
|
685
701
|
const correlationId = result.correlationId;
|
|
686
|
-
if (!result.
|
|
702
|
+
if (!result.identityVerified || !result.policyAllowed) {
|
|
687
703
|
if (shouldRecordDecisions && sessionId) {
|
|
688
704
|
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
689
705
|
});
|