@astrasyncai/verification-gateway 2.3.7 → 2.3.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/README.md +93 -10
- 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 +81 -7
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +81 -7
- 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 +84 -12
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +84 -12
- 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 +40 -6
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +40 -6
- 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 +40 -6
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +40 -6
- 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 +39 -5
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +39 -5
- 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 +39 -5
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +39 -5
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-D9oRsseg.d.mts → express-BiB51d5t.d.mts} +1 -1
- package/dist/{express-DMSIl20m.d.ts → express-D6tEDU08.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 +39 -5
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +39 -5
- 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-EwUWXC5T.d.ts → index-8DFMpITk.d.ts} +1 -1
- package/dist/{index-YNPs800Z.d.mts → index-B--6fiDp.d.mts} +1 -1
- package/dist/{index-Bn_7eGjb.d.mts → index-CAykfMWK.d.mts} +1 -1
- package/dist/{index-BtU9yFda.d.ts → index-Yt02MRyu.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +87 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -13
- 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-B5ZBpHra.d.ts → nextjs-CK5F_tVZ.d.ts} +1 -1
- package/dist/{nextjs-BLtjRbc-.d.mts → nextjs-CpxqfQqD.d.mts} +1 -1
- package/dist/{sdk-BhkxvqnK.d.mts → sdk-BMvauMgP.d.ts} +9 -2
- package/dist/{sdk-YmE3RG8n.d.ts → sdk-yJjO7yzn.d.mts} +9 -2
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-DxY5zt4z.d.mts → types-CKafuHDn.d.mts} +1 -1
- package/dist/{types-Bxqj1sKY.d.mts → types-UYT4GdPW.d.mts} +42 -4
- package/dist/{types-Bxqj1sKY.d.ts → types-UYT4GdPW.d.ts} +42 -4
- package/dist/{types-BecRpozv.d.ts → types-ppkhdldJ.d.ts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +3 -3
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.mjs';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-CKafuHDn.mjs';
|
|
3
|
+
import '../types-UYT4GdPW.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Git Trigger — Enterprise git push / PR verification
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.js';
|
|
2
|
-
import { V as VerificationDecision, P as PDLSSContext } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { V as VerificationDecision, P as PDLSSContext } from '../types-ppkhdldJ.js';
|
|
3
|
+
import '../types-UYT4GdPW.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Git Trigger — Enterprise git push / PR verification
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-
|
|
2
|
-
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-
|
|
3
|
-
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-UYT4GdPW.mjs';
|
|
2
|
+
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-UYT4GdPW.mjs';
|
|
3
|
+
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-yJjO7yzn.mjs';
|
|
4
|
+
export { e as express } from './express-BiB51d5t.mjs';
|
|
5
|
+
export { n as nextjs } from './nextjs-CpxqfQqD.mjs';
|
|
6
|
+
export { i as transport } from './index-B--6fiDp.mjs';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-CAykfMWK.mjs';
|
|
8
8
|
import 'express';
|
|
9
9
|
import 'next/server';
|
|
10
10
|
import 'jose';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-
|
|
2
|
-
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-
|
|
3
|
-
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-
|
|
4
|
-
export { e as express } from './express-
|
|
5
|
-
export { n as nextjs } from './nextjs-
|
|
6
|
-
export { i as transport } from './index-
|
|
7
|
-
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-
|
|
1
|
+
import { b as AgentCredentials, G as GatewayConfig, a as AccessLevel, c as VerificationRequest, V as VerificationResult } from './types-UYT4GdPW.js';
|
|
2
|
+
export { A as AstraSyncCredentials, d as CommerceShieldProps, C as CounterpartyType, e as EnhancedVerificationResult, E as ExpressMiddlewareOptions, f as GuidanceInfo, N as NextJsMiddlewareOptions, P as PDLSSInfo, g as ProtocolTransport, R as RouteAccessConfig, h as RuntimeChallengeResult, S as SDKOptions, T as TokenGuidance, i as TrustLevel, j as VerifiedAgent, k as VerifiedDeveloper, l as VerifiedOrganization } from './types-UYT4GdPW.js';
|
|
3
|
+
export { A as ACCESS_LEVEL_DESCRIPTIONS, a as ACCESS_LEVEL_HIERARCHY, b as AccessCapabilities, D as DEFAULT_TRUST_THRESHOLDS, T as TRUST_LEVEL_RANGES, d as determineAccessLevel, g as getAccessLevelForScore, c as getCapabilities, e as getTrustLevel, h as hasMinimumAccess, s as sdk } from './sdk-BMvauMgP.js';
|
|
4
|
+
export { e as express } from './express-D6tEDU08.js';
|
|
5
|
+
export { n as nextjs } from './nextjs-CK5F_tVZ.js';
|
|
6
|
+
export { i as transport } from './index-Yt02MRyu.js';
|
|
7
|
+
export { A as AgentClient, C as ChallengeHandler, i as agent, r as recordDecision } from './index-8DFMpITk.js';
|
|
8
8
|
import 'express';
|
|
9
9
|
import 'next/server';
|
|
10
10
|
import 'jose';
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
59
59
|
// src/access-levels.ts
|
|
60
60
|
var ACCESS_LEVEL_HIERARCHY = {
|
|
61
61
|
none: 0,
|
|
62
|
-
|
|
62
|
+
restricted: 1,
|
|
63
63
|
"read-only": 2,
|
|
64
64
|
standard: 3,
|
|
65
65
|
full: 4,
|
|
@@ -67,7 +67,7 @@ var ACCESS_LEVEL_HIERARCHY = {
|
|
|
67
67
|
};
|
|
68
68
|
var ACCESS_LEVEL_DESCRIPTIONS = {
|
|
69
69
|
none: "No access - credentials required",
|
|
70
|
-
|
|
70
|
+
restricted: "Restricted access - registration prompt only",
|
|
71
71
|
"read-only": "Read-only access - can browse but not modify",
|
|
72
72
|
standard: "Standard access - normal operations per PDLSS policy",
|
|
73
73
|
full: "Full access - all operations for high-trust agents",
|
|
@@ -75,7 +75,7 @@ var ACCESS_LEVEL_DESCRIPTIONS = {
|
|
|
75
75
|
};
|
|
76
76
|
var DEFAULT_TRUST_THRESHOLDS = {
|
|
77
77
|
none: 0,
|
|
78
|
-
|
|
78
|
+
restricted: 0,
|
|
79
79
|
"read-only": 20,
|
|
80
80
|
standard: 40,
|
|
81
81
|
full: 70,
|
|
@@ -101,11 +101,11 @@ function getAccessLevelForScore(trustScore, thresholds = DEFAULT_TRUST_THRESHOLD
|
|
|
101
101
|
if (trustScore >= thresholds.full) return "full";
|
|
102
102
|
if (trustScore >= thresholds.standard) return "standard";
|
|
103
103
|
if (trustScore >= thresholds["read-only"]) return "read-only";
|
|
104
|
-
return "
|
|
104
|
+
return "restricted";
|
|
105
105
|
}
|
|
106
106
|
function determineAccessLevel(verified, trustScore, isOrgMember, customThresholds) {
|
|
107
107
|
if (!verified) {
|
|
108
|
-
return "
|
|
108
|
+
return "none";
|
|
109
109
|
}
|
|
110
110
|
if (isOrgMember) {
|
|
111
111
|
return "internal";
|
|
@@ -126,7 +126,7 @@ function getCapabilities(accessLevel) {
|
|
|
126
126
|
canAdmin: false,
|
|
127
127
|
canAccessInternal: false
|
|
128
128
|
};
|
|
129
|
-
case "
|
|
129
|
+
case "restricted":
|
|
130
130
|
return {
|
|
131
131
|
canRead: false,
|
|
132
132
|
canWrite: false,
|
|
@@ -180,7 +180,11 @@ function getCapabilities(accessLevel) {
|
|
|
180
180
|
// src/verify.ts
|
|
181
181
|
var DEFAULT_CONFIG = {
|
|
182
182
|
apiBaseUrl: "https://astrasync.ai/api",
|
|
183
|
-
|
|
183
|
+
// v2.3.9 (defect #30): default for unconfigured callers is `'none'` (no
|
|
184
|
+
// access). Pre-rename this defaulted to `'guidance'`, which combined with
|
|
185
|
+
// a route gated at `'guidance'` to silently let unverified traffic
|
|
186
|
+
// through (`hasMinimumAccess('guidance', 'guidance') === true`).
|
|
187
|
+
defaultAccessLevel: "none",
|
|
184
188
|
// minTrustScore + minTrustScoreForFull deprecated in v2.3.0 — server decides.
|
|
185
189
|
cacheTtl: 300,
|
|
186
190
|
// 5 minutes
|
|
@@ -279,7 +283,12 @@ function createGuidanceResponse(config, reason) {
|
|
|
279
283
|
};
|
|
280
284
|
return {
|
|
281
285
|
verified: false,
|
|
282
|
-
|
|
286
|
+
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
287
|
+
// Adapters additionally short-circuit on `verified === false` before
|
|
288
|
+
// the gate check, but the access level still has to be honest at the
|
|
289
|
+
// data layer so downstream consumers (SDK adapters in other languages,
|
|
290
|
+
// custom integrations) inherit the correct semantics.
|
|
291
|
+
accessLevel: "none",
|
|
283
292
|
guidance,
|
|
284
293
|
denialReasons: reason ? [reason] : ["No valid agent credentials provided"],
|
|
285
294
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
@@ -336,6 +345,23 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
336
345
|
body: JSON.stringify(body)
|
|
337
346
|
});
|
|
338
347
|
const data = await response.json();
|
|
348
|
+
if (response.status === 410) {
|
|
349
|
+
return {
|
|
350
|
+
success: true,
|
|
351
|
+
access: {
|
|
352
|
+
allowed: false,
|
|
353
|
+
accessLevel: "none",
|
|
354
|
+
reason: "endpoint_deactivated",
|
|
355
|
+
failures: [
|
|
356
|
+
{
|
|
357
|
+
dimension: "endpoint.deactivated",
|
|
358
|
+
message: typeof data?.message === "string" ? data.message : "Endpoint has been deactivated",
|
|
359
|
+
guidance: typeof data?.guidance === "string" ? data.guidance : "Reactivate via POST /api/endpoints/{id}/reactivate, or update the URL on the calling agent."
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}
|
|
339
365
|
if (!response.ok) {
|
|
340
366
|
return {
|
|
341
367
|
success: false,
|
|
@@ -389,7 +415,14 @@ async function verify(config, request) {
|
|
|
389
415
|
const aggregatedFailures = apiResponse.access?.failures;
|
|
390
416
|
const result2 = {
|
|
391
417
|
verified: false,
|
|
392
|
-
|
|
418
|
+
// v2.3.9 (defect #30): denials grant `'none'`, NEVER a positive band.
|
|
419
|
+
// Pre-rename this hardcoded `'guidance'`, which conflated with the
|
|
420
|
+
// colocated `guidance: {...}` help-payload object below and let
|
|
421
|
+
// denied requests pass any route gated at `'guidance'` because
|
|
422
|
+
// `hasMinimumAccess('guidance', 'guidance') === true`. Adapters now
|
|
423
|
+
// ALSO short-circuit on `verified === false` before the gate check —
|
|
424
|
+
// belt-and-braces.
|
|
425
|
+
accessLevel: "none",
|
|
393
426
|
denialReasons: aggregatedFailures && aggregatedFailures.length > 0 ? aggregatedFailures.map((f) => f.message) : apiResponse.access?.reason ? [apiResponse.access.reason] : ["Access denied"],
|
|
394
427
|
failures: aggregatedFailures,
|
|
395
428
|
requiresStepUp: apiResponse.access?.requiresStepUp,
|
|
@@ -445,7 +478,8 @@ async function verify(config, request) {
|
|
|
445
478
|
runtimeChallenge: apiResponse.runtimeChallenge,
|
|
446
479
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
447
480
|
recommendation: apiResponse.recommendation,
|
|
448
|
-
recommendationReasons: apiResponse.recommendationReasons
|
|
481
|
+
recommendationReasons: apiResponse.recommendationReasons,
|
|
482
|
+
warningHeader: apiResponse.warningHeader
|
|
449
483
|
};
|
|
450
484
|
if (result.recommendation === "deny") {
|
|
451
485
|
result.verified = false;
|
|
@@ -472,7 +506,7 @@ async function verify(config, request) {
|
|
|
472
506
|
}
|
|
473
507
|
return result;
|
|
474
508
|
}
|
|
475
|
-
async function recordDecision(config, sessionId, decision, reason) {
|
|
509
|
+
async function recordDecision(config, sessionId, decision, reason, override) {
|
|
476
510
|
const headers = { "Content-Type": "application/json" };
|
|
477
511
|
if (config.apiKey) {
|
|
478
512
|
headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
@@ -481,7 +515,16 @@ async function recordDecision(config, sessionId, decision, reason) {
|
|
|
481
515
|
await fetch(`${config.apiBaseUrl}/agents/verify-access/${sessionId}/decision`, {
|
|
482
516
|
method: "POST",
|
|
483
517
|
headers,
|
|
484
|
-
body: JSON.stringify({
|
|
518
|
+
body: JSON.stringify({
|
|
519
|
+
decision,
|
|
520
|
+
reason,
|
|
521
|
+
...override && {
|
|
522
|
+
overriddenBy: override.overriddenBy,
|
|
523
|
+
toolName: override.toolName,
|
|
524
|
+
requestedLevel: override.requestedLevel,
|
|
525
|
+
grantedLevel: override.grantedLevel
|
|
526
|
+
}
|
|
527
|
+
})
|
|
485
528
|
}).catch(() => {
|
|
486
529
|
});
|
|
487
530
|
}
|
|
@@ -718,6 +761,7 @@ function createMiddleware(options) {
|
|
|
718
761
|
let lastFetchAt = 0;
|
|
719
762
|
let refreshing = null;
|
|
720
763
|
let warnedNoCounterparty = false;
|
|
764
|
+
let warnedEmptyRoutes = false;
|
|
721
765
|
async function refreshRoutes() {
|
|
722
766
|
if (!config.counterpartyId) {
|
|
723
767
|
if (!warnedNoCounterparty) {
|
|
@@ -732,6 +776,13 @@ function createMiddleware(options) {
|
|
|
732
776
|
if (fetched) {
|
|
733
777
|
cachedRoutes = fetched;
|
|
734
778
|
lastFetchAt = Date.now();
|
|
779
|
+
if (cachedRoutes.length === 0 && !warnedEmptyRoutes) {
|
|
780
|
+
const dashboard = config.dashboardUrl ?? "https://app.astrasync.ai";
|
|
781
|
+
console.warn(
|
|
782
|
+
`[VerificationGateway] No route policy configured for ${config.counterpartyId}. Gateway is in pass-through mode for ALL traffic until you add at least one route. Configure at ${dashboard}/dashboard/endpoints/${config.counterpartyId}/routes`
|
|
783
|
+
);
|
|
784
|
+
warnedEmptyRoutes = true;
|
|
785
|
+
}
|
|
735
786
|
}
|
|
736
787
|
}
|
|
737
788
|
refreshing = refreshRoutes().finally(() => {
|
|
@@ -754,9 +805,20 @@ function createMiddleware(options) {
|
|
|
754
805
|
}
|
|
755
806
|
const routeConfig = findRouteConfig(cachedRoutes, req.path, req.method);
|
|
756
807
|
if (!routeConfig) {
|
|
808
|
+
if (config.setPassThroughHeader) {
|
|
809
|
+
res.setHeader("X-Astra-Gateway-Mode", "pass-through");
|
|
810
|
+
res.setHeader(
|
|
811
|
+
"X-Astra-Gateway-Reason",
|
|
812
|
+
cachedRoutes.length === 0 ? "no-policy" : "no-match"
|
|
813
|
+
);
|
|
814
|
+
}
|
|
757
815
|
return next();
|
|
758
816
|
}
|
|
759
817
|
if (routeConfig.minAccessLevel === "none") {
|
|
818
|
+
if (config.setPassThroughHeader) {
|
|
819
|
+
res.setHeader("X-Astra-Gateway-Mode", "pass-through");
|
|
820
|
+
res.setHeader("X-Astra-Gateway-Reason", "route-none");
|
|
821
|
+
}
|
|
760
822
|
return next();
|
|
761
823
|
}
|
|
762
824
|
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
@@ -815,6 +877,14 @@ function createMiddleware(options) {
|
|
|
815
877
|
});
|
|
816
878
|
req.agentVerification = result;
|
|
817
879
|
const sessionId = result.sessionId;
|
|
880
|
+
if (!result.verified) {
|
|
881
|
+
if (shouldRecordDecisions && sessionId) {
|
|
882
|
+
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
onDenied(result, req, res);
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
818
888
|
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
819
889
|
if (shouldRecordDecisions && sessionId) {
|
|
820
890
|
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
@@ -840,6 +910,10 @@ function createMiddleware(options) {
|
|
|
840
910
|
recordDecision(config, sessionId, "granted").catch(() => {
|
|
841
911
|
});
|
|
842
912
|
}
|
|
913
|
+
const enhancedResult = result;
|
|
914
|
+
if (enhancedResult.warningHeader) {
|
|
915
|
+
res.setHeader(enhancedResult.warningHeader.name, enhancedResult.warningHeader.value);
|
|
916
|
+
}
|
|
843
917
|
next();
|
|
844
918
|
} catch (error) {
|
|
845
919
|
console.error("[VerificationGateway] Middleware error:", error);
|
|
@@ -1195,7 +1269,7 @@ function createMiddleware2(options) {
|
|
|
1195
1269
|
agentCardUrl: request.headers.get("x-astrasync-agent-card") || void 0
|
|
1196
1270
|
}
|
|
1197
1271
|
});
|
|
1198
|
-
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
1272
|
+
if (!result.verified || !hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
1199
1273
|
if (pathname.startsWith("/api/")) {
|
|
1200
1274
|
return NextResponse.json(
|
|
1201
1275
|
{
|