@astrasyncai/verification-gateway 2.4.2 → 2.4.4
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 +25 -0
- 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 +31 -7
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +31 -7
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +25 -2
- package/dist/adapters/mcp.d.ts +25 -2
- package/dist/adapters/mcp.js +31 -7
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +31 -7
- 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 +1 -0
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +1 -0
- 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 +1 -0
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +1 -0
- 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.js +10 -2
- package/dist/browser/background.js +1 -0
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +1 -0
- 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 +1 -0
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +1 -0
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/{express-DneHiMhu.d.mts → express-Ck2RHZLT.d.mts} +1 -1
- package/dist/{express-DsiaQRFt.d.ts → express-DZmEzCgo.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 +1 -0
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +1 -0
- 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-NZiKvrtE.d.ts → index-6Jus6yWU.d.ts} +1 -1
- package/dist/{index-DAGm-Sgf.d.mts → index-BZZTOfrI.d.mts} +1 -1
- package/dist/{index-Dd4alF0l.d.ts → index-BgKghi19.d.ts} +1 -1
- package/dist/{index-C9yWlQ2Y.d.mts → index-D698fDOk.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- 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-vUuVCaBP.d.mts → nextjs-93PHcE-i.d.mts} +1 -1
- package/dist/{nextjs-B4WmoiVm.d.ts → nextjs-t_ix2zQZ.d.ts} +1 -1
- package/dist/registration/index.d.mts +37 -0
- package/dist/registration/index.d.ts +37 -0
- package/dist/registration/index.js +10 -2
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +10 -2
- package/dist/registration/index.mjs.map +1 -1
- package/dist/{sdk-Cixo6pTV.d.mts → sdk-BFwzjYjl.d.mts} +1 -1
- package/dist/{sdk-BvWp4q2q.d.ts → sdk-Chq02d82.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-IUzu-A4u.d.ts → types-CLP_TDu5.d.ts} +1 -1
- package/dist/{types-DLai3jly.d.mts → types-CVT-sorC.d.mts} +23 -0
- package/dist/{types-DLai3jly.d.ts → types-CVT-sorC.d.ts} +23 -0
- package/dist/{types-C_e1IZdU.d.mts → types-y13mmzbA.d.mts} +1 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -288,6 +288,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
288
288
|
if (config.counterpartyId) body.counterpartyId = config.counterpartyId;
|
|
289
289
|
if (requestData.runtimeChallengeOptions)
|
|
290
290
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
291
|
+
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
291
292
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
292
293
|
const meta = {
|
|
293
294
|
...requestData.clientIp && { sourceIp: requestData.clientIp },
|
|
@@ -798,14 +799,15 @@ function createMiddleware(options) {
|
|
|
798
799
|
}
|
|
799
800
|
return next();
|
|
800
801
|
}
|
|
801
|
-
|
|
802
|
+
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
803
|
+
const shouldEnforce = routeConfig.minAccessLevel !== "none";
|
|
804
|
+
if (routeConfig.minAccessLevel === "none" && (!config.evaluateAlwaysIfCredentialed || !credentials.astraId)) {
|
|
802
805
|
if (config.setPassThroughHeader) {
|
|
803
806
|
res.setHeader("X-Astra-Gateway-Mode", "unenforced");
|
|
804
807
|
res.setHeader("X-Astra-Gateway-Reason", "route-none");
|
|
805
808
|
}
|
|
806
809
|
return next();
|
|
807
810
|
}
|
|
808
|
-
const credentials = customExtractCredentials ? customExtractCredentials(req) : defaultExtractCredentials(req);
|
|
809
811
|
const purpose = customExtractPurpose ? customExtractPurpose(req) : defaultExtractPurpose(req);
|
|
810
812
|
const astraCreds = extractAstraSyncCredentials(req);
|
|
811
813
|
const counterpartyUrl = config.counterpartyUrl || `${req.protocol}://${req.get("host")}`;
|
|
@@ -869,9 +871,27 @@ function createMiddleware(options) {
|
|
|
869
871
|
onDenied(result, req, res);
|
|
870
872
|
return;
|
|
871
873
|
}
|
|
874
|
+
if (!shouldEnforce) {
|
|
875
|
+
if (config.setPassThroughHeader) {
|
|
876
|
+
res.setHeader("X-Astra-Gateway-Mode", "enforced");
|
|
877
|
+
res.setHeader("X-Astra-Gateway-Reason", "evaluated-not-enforced");
|
|
878
|
+
}
|
|
879
|
+
if (shouldRecordDecisions && sessionId) {
|
|
880
|
+
recordDecision(config, sessionId, "granted").catch(() => {
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
return next();
|
|
884
|
+
}
|
|
872
885
|
if (!hasMinimumAccess(result.accessLevel, routeConfig.minAccessLevel)) {
|
|
886
|
+
const insufficientFailure = {
|
|
887
|
+
dimension: "access_level.insufficient",
|
|
888
|
+
message: `Endpoint requires accessLevel '${routeConfig.minAccessLevel}'; agent has '${result.accessLevel}'.`,
|
|
889
|
+
guidance: "Request elevated access via step-up verification (coming soon \u2014 ships this month). Step-up lets the agent owner approve a one-time elevation for this specific counterparty + purpose without changing the agent's baseline trust score."
|
|
890
|
+
};
|
|
891
|
+
result.failures = [...result.failures ?? [], insufficientFailure];
|
|
892
|
+
result.denialReasons = [...result.denialReasons ?? [], insufficientFailure.message];
|
|
873
893
|
if (shouldRecordDecisions && sessionId) {
|
|
874
|
-
recordDecision(config, sessionId, "denied",
|
|
894
|
+
recordDecision(config, sessionId, "denied", insufficientFailure.message).catch(() => {
|
|
875
895
|
});
|
|
876
896
|
}
|
|
877
897
|
onDenied(result, req, res);
|
|
@@ -879,11 +899,15 @@ function createMiddleware(options) {
|
|
|
879
899
|
}
|
|
880
900
|
if (routeConfig.minTrustScore && result.agent) {
|
|
881
901
|
if (result.agent.trustScore < routeConfig.minTrustScore) {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
902
|
+
const trustFailure = {
|
|
903
|
+
dimension: "access_level.insufficient",
|
|
904
|
+
message: `Trust score ${result.agent.trustScore} is below required ${routeConfig.minTrustScore} for this route.`,
|
|
905
|
+
guidance: "Request elevated access via step-up verification (coming soon \u2014 ships this month). Step-up lets the agent owner approve a one-time elevation for this specific counterparty + purpose without changing the agent's baseline trust score."
|
|
906
|
+
};
|
|
907
|
+
result.failures = [...result.failures ?? [], trustFailure];
|
|
908
|
+
result.denialReasons = [trustFailure.message];
|
|
885
909
|
if (shouldRecordDecisions && sessionId) {
|
|
886
|
-
recordDecision(config, sessionId, "denied",
|
|
910
|
+
recordDecision(config, sessionId, "denied", trustFailure.message).catch(() => {
|
|
887
911
|
});
|
|
888
912
|
}
|
|
889
913
|
onDenied(result, req, res);
|