@astrasyncai/verification-gateway 4.4.0 → 4.5.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/adapters/express.js +14 -10
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +14 -10
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.js +12 -9
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +12 -9
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.js +15 -11
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +15 -11
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.js +10 -7
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +10 -7
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +10 -7
- package/dist/bin/astrasync-codex-hook.js +10 -7
- package/dist/bin/astrasync-guard.js +10 -7
- package/dist/bin/astrasync.js +10 -7
- package/dist/browser/background.js +10 -7
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +10 -7
- package/dist/browser/background.mjs.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.js +10 -7
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +10 -7
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/extension.js +10 -7
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +10 -7
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +11 -4
- package/dist/edge-config.d.ts +11 -4
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +21 -7
- package/dist/edge-core/index.d.ts +21 -7
- package/dist/edge-core/index.js +75 -15
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +75 -15
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.js +10 -7
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +10 -7
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -15
- package/dist/index.mjs.map +1 -1
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/verify.js +10 -7
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +10 -7
- package/dist/verify.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -126,7 +126,7 @@ function getCapabilities(accessLevel) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// src/version.ts
|
|
129
|
-
var SDK_VERSION = "4.
|
|
129
|
+
var SDK_VERSION = "4.5.0";
|
|
130
130
|
|
|
131
131
|
// src/http.ts
|
|
132
132
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -675,12 +675,15 @@ async function verify(config, request, options) {
|
|
|
675
675
|
const verificationContext = apiResponse.verificationContext;
|
|
676
676
|
const accessLevel = apiResponse.access?.accessLevel ?? "standard";
|
|
677
677
|
const result = {
|
|
678
|
-
//
|
|
679
|
-
//
|
|
680
|
-
//
|
|
681
|
-
//
|
|
682
|
-
//
|
|
683
|
-
|
|
678
|
+
// 4.5.0 (probe F1): read idVerified from verificationContext with the
|
|
679
|
+
// SAME absent⇒false default as the deny branch. The previous `!== false`
|
|
680
|
+
// default manufactured `identityVerified: true` for anonymous
|
|
681
|
+
// allow_full/allow_partial/audit responses (which allow access but omit
|
|
682
|
+
// verificationContext entirely) — the "anonymous caller labelled
|
|
683
|
+
// verified" defect. Every authenticated success response has carried
|
|
684
|
+
// `verificationContext.idVerified: true` since v2.2.4, so a truth claim
|
|
685
|
+
// this load-bearing must never be defaulted on.
|
|
686
|
+
identityVerified: apiResponse.verificationContext?.idVerified === true,
|
|
684
687
|
policyAllowed: true,
|
|
685
688
|
accessLevel,
|
|
686
689
|
agent,
|
|
@@ -1653,9 +1656,10 @@ function detectPlatformFingerprint(input) {
|
|
|
1653
1656
|
|
|
1654
1657
|
// src/edge-core/classify.ts
|
|
1655
1658
|
var STATIC_EXTENSIONS = /\.(css|js|mjs|map|png|jpe?g|gif|webp|avif|svg|ico|woff2?|ttf|otf|eot|mp4|webm|pdf|txt|xml)$/i;
|
|
1659
|
+
var SELF_UA_PATTERN = /^astrasync-sdk\//i;
|
|
1656
1660
|
var BOT_UA_PATTERN = /curl|wget|python-requests|python-urllib|node-fetch|axios|got|okhttp|go-http-client|libwww|httpie|java\/|ruby|php|scrapy|headless|phantomjs|selenium|playwright|puppeteer|bot|crawler|spider|slurp/i;
|
|
1657
1661
|
var BROWSER_UA_PATTERN = /mozilla\/\d/i;
|
|
1658
|
-
var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN };
|
|
1662
|
+
var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN, SELF_UA_PATTERN };
|
|
1659
1663
|
|
|
1660
1664
|
// src/edge-core/events.ts
|
|
1661
1665
|
function sampled(rate, random = Math.random) {
|
|
@@ -2075,7 +2079,7 @@ function createMiddleware(options) {
|
|
|
2075
2079
|
let result = await verify(config, verificationRequest);
|
|
2076
2080
|
req.agentVerification = result;
|
|
2077
2081
|
let sessionId = result.sessionId;
|
|
2078
|
-
if (config.stepUpMaxWaitMs !== void 0 && result.
|
|
2082
|
+
if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
|
|
2079
2083
|
const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
|
|
2080
2084
|
res.setHeader("X-Astra-Step-Up", outcome);
|
|
2081
2085
|
if (outcome === "approved") {
|
|
@@ -2086,7 +2090,7 @@ function createMiddleware(options) {
|
|
|
2086
2090
|
result.stepUpOutcome = outcome;
|
|
2087
2091
|
}
|
|
2088
2092
|
}
|
|
2089
|
-
if (!result.
|
|
2093
|
+
if (!result.policyAllowed) {
|
|
2090
2094
|
if (shouldRecordDecisions && sessionId) {
|
|
2091
2095
|
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
2092
2096
|
});
|
|
@@ -2587,7 +2591,7 @@ function createMiddleware2(options) {
|
|
|
2587
2591
|
};
|
|
2588
2592
|
let result = await verify(config, verificationRequest);
|
|
2589
2593
|
let stepUpHoldOutcome;
|
|
2590
|
-
if (config.stepUpMaxWaitMs !== void 0 && result.
|
|
2594
|
+
if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
|
|
2591
2595
|
stepUpHoldOutcome = await awaitStepUpApproval(config, result.stepUpApproval);
|
|
2592
2596
|
if (stepUpHoldOutcome === "approved") {
|
|
2593
2597
|
result = await verify(config, verificationRequest, { bypassCache: true });
|
|
@@ -2595,9 +2599,9 @@ function createMiddleware2(options) {
|
|
|
2595
2599
|
result.stepUpOutcome = stepUpHoldOutcome;
|
|
2596
2600
|
}
|
|
2597
2601
|
}
|
|
2598
|
-
const approvalRequired = result.
|
|
2602
|
+
const approvalRequired = result.policyAllowed && requiresHumanApproval(result);
|
|
2599
2603
|
if (approvalRequired) annotateApprovalRequired(result);
|
|
2600
|
-
if (!result.
|
|
2604
|
+
if (!result.policyAllowed || approvalRequired) {
|
|
2601
2605
|
if (result.misconfigured && pathname.startsWith("/api/")) {
|
|
2602
2606
|
return NextResponse.json(
|
|
2603
2607
|
{
|
|
@@ -5733,7 +5737,7 @@ function createMcpMiddleware(options) {
|
|
|
5733
5737
|
let result = await verify(config, verificationRequest);
|
|
5734
5738
|
req.agentVerification = result;
|
|
5735
5739
|
let sessionId = result.sessionId;
|
|
5736
|
-
if (config.stepUpMaxWaitMs !== void 0 && result.
|
|
5740
|
+
if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
|
|
5737
5741
|
const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
|
|
5738
5742
|
res.setHeader("X-Astra-Step-Up", outcome);
|
|
5739
5743
|
if (outcome === "approved") {
|
|
@@ -5744,7 +5748,7 @@ function createMcpMiddleware(options) {
|
|
|
5744
5748
|
result.stepUpOutcome = outcome;
|
|
5745
5749
|
}
|
|
5746
5750
|
}
|
|
5747
|
-
if (!result.
|
|
5751
|
+
if (!result.policyAllowed) {
|
|
5748
5752
|
if (shouldRecordDecisions && sessionId) {
|
|
5749
5753
|
recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
|
|
5750
5754
|
});
|