@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.
Files changed (75) hide show
  1. package/dist/adapters/express.js +14 -10
  2. package/dist/adapters/express.js.map +1 -1
  3. package/dist/adapters/express.mjs +14 -10
  4. package/dist/adapters/express.mjs.map +1 -1
  5. package/dist/adapters/mcp.js +12 -9
  6. package/dist/adapters/mcp.js.map +1 -1
  7. package/dist/adapters/mcp.mjs +12 -9
  8. package/dist/adapters/mcp.mjs.map +1 -1
  9. package/dist/adapters/nextjs.js +15 -11
  10. package/dist/adapters/nextjs.js.map +1 -1
  11. package/dist/adapters/nextjs.mjs +15 -11
  12. package/dist/adapters/nextjs.mjs.map +1 -1
  13. package/dist/adapters/sdk.js +10 -7
  14. package/dist/adapters/sdk.js.map +1 -1
  15. package/dist/adapters/sdk.mjs +10 -7
  16. package/dist/adapters/sdk.mjs.map +1 -1
  17. package/dist/agent/index.js +1 -1
  18. package/dist/agent/index.js.map +1 -1
  19. package/dist/agent/index.mjs +1 -1
  20. package/dist/agent/index.mjs.map +1 -1
  21. package/dist/bin/astrasync-claude-hook.js +10 -7
  22. package/dist/bin/astrasync-codex-hook.js +10 -7
  23. package/dist/bin/astrasync-guard.js +10 -7
  24. package/dist/bin/astrasync.js +10 -7
  25. package/dist/browser/background.js +10 -7
  26. package/dist/browser/background.js.map +1 -1
  27. package/dist/browser/background.mjs +10 -7
  28. package/dist/browser/background.mjs.map +1 -1
  29. package/dist/cli/index.js +1 -1
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/index.mjs +1 -1
  32. package/dist/cli/index.mjs.map +1 -1
  33. package/dist/codex/index.js +10 -7
  34. package/dist/codex/index.js.map +1 -1
  35. package/dist/codex/index.mjs +10 -7
  36. package/dist/codex/index.mjs.map +1 -1
  37. package/dist/cursor/extension.js +10 -7
  38. package/dist/cursor/extension.js.map +1 -1
  39. package/dist/cursor/extension.mjs +10 -7
  40. package/dist/cursor/extension.mjs.map +1 -1
  41. package/dist/edge-config.d.mts +11 -4
  42. package/dist/edge-config.d.ts +11 -4
  43. package/dist/edge-config.js +1 -1
  44. package/dist/edge-config.js.map +1 -1
  45. package/dist/edge-config.mjs +1 -1
  46. package/dist/edge-config.mjs.map +1 -1
  47. package/dist/edge-core/index.d.mts +21 -7
  48. package/dist/edge-core/index.d.ts +21 -7
  49. package/dist/edge-core/index.js +75 -15
  50. package/dist/edge-core/index.js.map +1 -1
  51. package/dist/edge-core/index.mjs +75 -15
  52. package/dist/edge-core/index.mjs.map +1 -1
  53. package/dist/gateway/gateway.js +10 -7
  54. package/dist/gateway/gateway.js.map +1 -1
  55. package/dist/gateway/gateway.mjs +10 -7
  56. package/dist/gateway/gateway.mjs.map +1 -1
  57. package/dist/index.d.mts +2 -2
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.js +19 -15
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.mjs +19 -15
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/registration/index.js +1 -1
  64. package/dist/registration/index.js.map +1 -1
  65. package/dist/registration/index.mjs +1 -1
  66. package/dist/registration/index.mjs.map +1 -1
  67. package/dist/transport/index.js +1 -1
  68. package/dist/transport/index.js.map +1 -1
  69. package/dist/transport/index.mjs +1 -1
  70. package/dist/transport/index.mjs.map +1 -1
  71. package/dist/verify.js +10 -7
  72. package/dist/verify.js.map +1 -1
  73. package/dist/verify.mjs +10 -7
  74. package/dist/verify.mjs.map +1 -1
  75. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
173
173
  * silently (never throwing), so this is a no-op there — which is correct:
174
174
  * in a browser the page's real UA is the honest identity.
175
175
  */
176
- declare const SDK_USER_AGENT = "astrasync-sdk/4.4.0";
176
+ declare const SDK_USER_AGENT = "astrasync-sdk/4.5.0";
177
177
  declare const sdkFetch: typeof fetch;
178
178
 
179
179
  /**
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
194
194
  * is fine — bumping both in the release-ceremony commit keeps them
195
195
  * lockstep.
196
196
  */
197
- declare const SDK_VERSION = "4.4.0";
197
+ declare const SDK_VERSION = "4.5.0";
198
198
 
199
199
  export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
package/dist/index.d.ts CHANGED
@@ -173,7 +173,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
173
173
  * silently (never throwing), so this is a no-op there — which is correct:
174
174
  * in a browser the page's real UA is the honest identity.
175
175
  */
176
- declare const SDK_USER_AGENT = "astrasync-sdk/4.4.0";
176
+ declare const SDK_USER_AGENT = "astrasync-sdk/4.5.0";
177
177
  declare const sdkFetch: typeof fetch;
178
178
 
179
179
  /**
@@ -194,6 +194,6 @@ declare const sdkFetch: typeof fetch;
194
194
  * is fine — bumping both in the release-ceremony commit keeps them
195
195
  * lockstep.
196
196
  */
197
- declare const SDK_VERSION = "4.4.0";
197
+ declare const SDK_VERSION = "4.5.0";
198
198
 
199
199
  export { EnhancedVerificationResult, GatewayConfig, RUNTIME_SIGNATURES, type RuntimeSignature, SDK_USER_AGENT, type SettlementDecision, type SettlementRequest, StepUpApprovalInfo, StepUpApprovalStatus, StepUpOutcome, SDK_VERSION as VERSION, type WellKnownAgenticCommerce, authorizeSettlement, awaitStepUpApproval, detectRuntime, getCachedWellKnownUrls, getWellKnownUrls, pollStepUpStatus, prefetchWellKnown, sdkFetch };
package/dist/index.js CHANGED
@@ -221,7 +221,7 @@ function getCapabilities(accessLevel) {
221
221
  }
222
222
 
223
223
  // src/version.ts
224
- var SDK_VERSION = "4.4.0";
224
+ var SDK_VERSION = "4.5.0";
225
225
 
226
226
  // src/http.ts
227
227
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -770,12 +770,15 @@ async function verify(config, request, options) {
770
770
  const verificationContext = apiResponse.verificationContext;
771
771
  const accessLevel = apiResponse.access?.accessLevel ?? "standard";
772
772
  const result = {
773
- // Round-18 G4: backend allowed access. Identity is verified (we resolved
774
- // the caller to an agent) and policy passed all gates. Read idVerified
775
- // from verificationContext for symmetry with the deny branch; default true
776
- // on success path since `access.allowed === true` implies identity was
777
- // resolvable (anonymous-allow paths flow through createGuidanceResponse).
778
- identityVerified: apiResponse.verificationContext?.idVerified !== false,
773
+ // 4.5.0 (probe F1): read idVerified from verificationContext with the
774
+ // SAME absent⇒false default as the deny branch. The previous `!== false`
775
+ // default manufactured `identityVerified: true` for anonymous
776
+ // allow_full/allow_partial/audit responses (which allow access but omit
777
+ // verificationContext entirely) — the "anonymous caller labelled
778
+ // verified" defect. Every authenticated success response has carried
779
+ // `verificationContext.idVerified: true` since v2.2.4, so a truth claim
780
+ // this load-bearing must never be defaulted on.
781
+ identityVerified: apiResponse.verificationContext?.idVerified === true,
779
782
  policyAllowed: true,
780
783
  accessLevel,
781
784
  agent,
@@ -1748,9 +1751,10 @@ function detectPlatformFingerprint(input) {
1748
1751
 
1749
1752
  // src/edge-core/classify.ts
1750
1753
  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;
1754
+ var SELF_UA_PATTERN = /^astrasync-sdk\//i;
1751
1755
  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;
1752
1756
  var BROWSER_UA_PATTERN = /mozilla\/\d/i;
1753
- var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN };
1757
+ var _patterns = { STATIC_EXTENSIONS, BOT_UA_PATTERN, BROWSER_UA_PATTERN, SELF_UA_PATTERN };
1754
1758
 
1755
1759
  // src/edge-core/events.ts
1756
1760
  function sampled(rate, random = Math.random) {
@@ -2170,7 +2174,7 @@ function createMiddleware(options) {
2170
2174
  let result = await verify(config, verificationRequest);
2171
2175
  req.agentVerification = result;
2172
2176
  let sessionId = result.sessionId;
2173
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2177
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2174
2178
  const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
2175
2179
  res.setHeader("X-Astra-Step-Up", outcome);
2176
2180
  if (outcome === "approved") {
@@ -2181,7 +2185,7 @@ function createMiddleware(options) {
2181
2185
  result.stepUpOutcome = outcome;
2182
2186
  }
2183
2187
  }
2184
- if (!result.identityVerified || !result.policyAllowed) {
2188
+ if (!result.policyAllowed) {
2185
2189
  if (shouldRecordDecisions && sessionId) {
2186
2190
  recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
2187
2191
  });
@@ -2682,7 +2686,7 @@ function createMiddleware2(options) {
2682
2686
  };
2683
2687
  let result = await verify(config, verificationRequest);
2684
2688
  let stepUpHoldOutcome;
2685
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2689
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
2686
2690
  stepUpHoldOutcome = await awaitStepUpApproval(config, result.stepUpApproval);
2687
2691
  if (stepUpHoldOutcome === "approved") {
2688
2692
  result = await verify(config, verificationRequest, { bypassCache: true });
@@ -2690,9 +2694,9 @@ function createMiddleware2(options) {
2690
2694
  result.stepUpOutcome = stepUpHoldOutcome;
2691
2695
  }
2692
2696
  }
2693
- const approvalRequired = result.identityVerified && result.policyAllowed && requiresHumanApproval(result);
2697
+ const approvalRequired = result.policyAllowed && requiresHumanApproval(result);
2694
2698
  if (approvalRequired) annotateApprovalRequired(result);
2695
- if (!result.identityVerified || !result.policyAllowed || approvalRequired) {
2699
+ if (!result.policyAllowed || approvalRequired) {
2696
2700
  if (result.misconfigured && pathname.startsWith("/api/")) {
2697
2701
  return NextResponse.json(
2698
2702
  {
@@ -5825,7 +5829,7 @@ function createMcpMiddleware(options) {
5825
5829
  let result = await verify(config, verificationRequest);
5826
5830
  req.agentVerification = result;
5827
5831
  let sessionId = result.sessionId;
5828
- if (config.stepUpMaxWaitMs !== void 0 && result.identityVerified && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
5832
+ if (config.stepUpMaxWaitMs !== void 0 && result.policyAllowed && requiresHumanApproval(result) && result.stepUpApproval?.pollUrl) {
5829
5833
  const outcome = await awaitStepUpApproval(config, result.stepUpApproval);
5830
5834
  res.setHeader("X-Astra-Step-Up", outcome);
5831
5835
  if (outcome === "approved") {
@@ -5836,7 +5840,7 @@ function createMcpMiddleware(options) {
5836
5840
  result.stepUpOutcome = outcome;
5837
5841
  }
5838
5842
  }
5839
- if (!result.identityVerified || !result.policyAllowed) {
5843
+ if (!result.policyAllowed) {
5840
5844
  if (shouldRecordDecisions && sessionId) {
5841
5845
  recordDecision(config, sessionId, "denied", result.denialReasons?.[0]).catch(() => {
5842
5846
  });