@astrasyncai/verification-gateway 3.8.0 → 3.10.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/adapter-interface/interface.d.mts +3 -2
- package/dist/adapter-interface/interface.d.ts +3 -2
- package/dist/adapters/express.d.mts +3 -2
- package/dist/adapters/express.d.ts +3 -2
- package/dist/adapters/express.js +152 -2
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +152 -2
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/http-pdlss.d.mts +81 -0
- package/dist/adapters/http-pdlss.d.ts +81 -0
- package/dist/adapters/http-pdlss.js +117 -0
- package/dist/adapters/http-pdlss.js.map +1 -0
- package/dist/adapters/http-pdlss.mjs +87 -0
- package/dist/adapters/http-pdlss.mjs.map +1 -0
- package/dist/adapters/mcp.d.mts +2 -1
- package/dist/adapters/mcp.d.ts +2 -1
- package/dist/adapters/mcp.js +2 -1
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +2 -1
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +3 -2
- package/dist/adapters/nextjs.d.ts +3 -2
- package/dist/adapters/nextjs.js +152 -2
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +152 -2
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +3 -2
- package/dist/adapters/sdk.d.ts +3 -2
- package/dist/adapters/sdk.js +2 -1
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +2 -1
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +3 -2
- package/dist/agent/index.d.ts +3 -2
- package/dist/bin/astrasync-claude-hook.js +17 -1
- package/dist/bin/astrasync-guard.js +17 -1
- package/dist/bin/astrasync.js +43 -1
- package/dist/browser/background.js +17 -1
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +17 -1
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +3 -2
- package/dist/browser/browser-adapter.d.ts +3 -2
- package/dist/claude-code/claude-code-adapter.d.mts +3 -2
- package/dist/claude-code/claude-code-adapter.d.ts +3 -2
- package/dist/cli/index.d.mts +3 -2
- package/dist/cli/index.d.ts +3 -2
- package/dist/cursor/cursor-adapter.d.mts +3 -2
- package/dist/cursor/cursor-adapter.d.ts +3 -2
- package/dist/cursor/extension.d.mts +3 -2
- package/dist/cursor/extension.d.ts +3 -2
- package/dist/cursor/extension.js +17 -1
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +17 -1
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +131 -0
- package/dist/edge-config.d.ts +131 -0
- package/dist/edge-config.js +162 -0
- package/dist/edge-config.js.map +1 -0
- package/dist/edge-config.mjs +131 -0
- package/dist/edge-config.mjs.map +1 -0
- package/dist/{express-C8nJGi5P.d.ts → express-ClNtDhhc.d.ts} +1 -1
- package/dist/{express-Di_hnZZS.d.mts → express-DCXa1oqj.d.mts} +1 -1
- package/dist/gateway/gateway.d.mts +3 -2
- package/dist/gateway/gateway.d.ts +3 -2
- package/dist/gateway/gateway.js +17 -1
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +17 -1
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +3 -2
- package/dist/git-trigger/git-hooks.d.ts +3 -2
- package/dist/{index-CXcvO9Au.d.mts → index-BrNKDmiR.d.mts} +1 -1
- package/dist/{index-CuCkjT7B.d.ts → index-CfHurO1P.d.ts} +1 -1
- package/dist/{index-CBQr4FGs.d.ts → index-D2ztkumS.d.ts} +1 -1
- package/dist/{index-DALAqct7.d.mts → index-Dr_XiN65.d.mts} +1 -1
- package/dist/index.d.mts +27 -82
- package/dist/index.d.ts +27 -82
- package/dist/index.js +435 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -12
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +3 -2
- package/dist/local-evaluator/evaluator.d.ts +3 -2
- package/dist/metadata-capture.d.mts +87 -0
- package/dist/metadata-capture.d.ts +87 -0
- package/dist/metadata-capture.js +184 -0
- package/dist/metadata-capture.js.map +1 -0
- package/dist/metadata-capture.mjs +154 -0
- package/dist/metadata-capture.mjs.map +1 -0
- package/dist/{nextjs-IyXWW2KL.d.ts → nextjs-CEBVBsdi.d.ts} +1 -1
- package/dist/{nextjs-BMAe8ode.d.mts → nextjs-DcQIk6Zj.d.mts} +1 -1
- package/dist/platform-signatures.d.mts +97 -0
- package/dist/platform-signatures.d.ts +97 -0
- package/dist/platform-signatures.js +116 -0
- package/dist/platform-signatures.js.map +1 -0
- package/dist/platform-signatures.mjs +89 -0
- package/dist/platform-signatures.mjs.map +1 -0
- package/dist/{sdk-Cn4KcZ5G.d.mts → sdk-CZkbSOeO.d.mts} +1 -1
- package/dist/{sdk-ThdA_NtL.d.ts → sdk-H0JCLW2y.d.ts} +1 -1
- package/dist/transport/index.d.mts +3 -2
- package/dist/transport/index.d.ts +3 -2
- package/dist/{types-DedAJbNI.d.mts → types-9tns4wyl.d.ts} +88 -1
- package/dist/{types-CSFci5zD.d.mts → types-D0lCtFQ7.d.mts} +1 -1
- package/dist/{types-D1kyMiml.d.ts → types-YbiXYKx1.d.ts} +1 -1
- package/dist/{types-DedAJbNI.d.ts → types-sy3tq8lp.d.mts} +88 -1
- package/dist/ui/index.d.mts +2 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/verify.d.mts +151 -0
- package/dist/verify.d.ts +151 -0
- package/dist/verify.js +593 -0
- package/dist/verify.js.map +1 -0
- package/dist/verify.mjs +557 -0
- package/dist/verify.mjs.map +1 -0
- package/package.json +26 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.mjs';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-D0lCtFQ7.mjs';
|
|
3
|
+
import '../types-sy3tq8lp.mjs';
|
|
4
|
+
import '../metadata-capture.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* PlatformAdapter Interface
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AstraSyncGateway } from '../gateway/gateway.js';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-YbiXYKx1.js';
|
|
3
|
+
import '../types-9tns4wyl.js';
|
|
4
|
+
import '../metadata-capture.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* PlatformAdapter Interface
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
import '../types-
|
|
3
|
-
export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-
|
|
2
|
+
import '../types-sy3tq8lp.mjs';
|
|
3
|
+
export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-DCXa1oqj.mjs';
|
|
4
|
+
import '../metadata-capture.mjs';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
import '../types-
|
|
3
|
-
export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-
|
|
2
|
+
import '../types-9tns4wyl.js';
|
|
3
|
+
export { c as createMiddleware, a as extractAstraSyncCredentials } from '../express-ClNtDhhc.js';
|
|
4
|
+
import '../metadata-capture.js';
|
package/dist/adapters/express.js
CHANGED
|
@@ -92,7 +92,7 @@ function getTrustLevel(score) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// src/version.ts
|
|
95
|
-
var SDK_VERSION = "3.
|
|
95
|
+
var SDK_VERSION = "3.10.0";
|
|
96
96
|
|
|
97
97
|
// src/well-known.ts
|
|
98
98
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -373,6 +373,7 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
373
373
|
if (requestData.runtimeChallengeOptions)
|
|
374
374
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
375
375
|
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
376
|
+
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
376
377
|
body.sdkVersion = SDK_VERSION;
|
|
377
378
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
378
379
|
const meta = {
|
|
@@ -817,6 +818,144 @@ function performCounterpartyPreCheck(routeConfig, astraCreds, purpose) {
|
|
|
817
818
|
return failures;
|
|
818
819
|
}
|
|
819
820
|
|
|
821
|
+
// src/metadata-capture.ts
|
|
822
|
+
var SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
823
|
+
"cookie",
|
|
824
|
+
"set-cookie",
|
|
825
|
+
"x-csrf-token",
|
|
826
|
+
"proxy-authorization",
|
|
827
|
+
"x-astrasync-signature",
|
|
828
|
+
"x-astrasync-secret",
|
|
829
|
+
"x-hub-signature",
|
|
830
|
+
"x-hub-signature-256"
|
|
831
|
+
]);
|
|
832
|
+
var SECRET_HEADER_PREFIXES = ["x-astrasync-", "kya-", "kya_"];
|
|
833
|
+
var CREDENTIAL_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
834
|
+
"authorization",
|
|
835
|
+
"x-api-key",
|
|
836
|
+
"x-goog-api-key",
|
|
837
|
+
"api-key"
|
|
838
|
+
]);
|
|
839
|
+
function isSignatureHeader(name) {
|
|
840
|
+
return name === "signature" || name.endsWith("-signature") || name.endsWith("-signature-256");
|
|
841
|
+
}
|
|
842
|
+
var PLATFORM_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
843
|
+
"openai-organization",
|
|
844
|
+
"openai-project",
|
|
845
|
+
"openai-version",
|
|
846
|
+
"openai-processing-ms",
|
|
847
|
+
"anthropic-version",
|
|
848
|
+
"anthropic-beta",
|
|
849
|
+
"x-goog-user-project",
|
|
850
|
+
"x-goog-api-client",
|
|
851
|
+
"user-agent",
|
|
852
|
+
"x-agent-card-url",
|
|
853
|
+
"x-agent-provider"
|
|
854
|
+
]);
|
|
855
|
+
var PLATFORM_HEADER_PREFIXES = ["x-goog-", "x-stainless-", "x-anthropic-", "x-openai-"];
|
|
856
|
+
var KEY_FORMAT_PREFIXES = [
|
|
857
|
+
"sk-ant-api03",
|
|
858
|
+
"sk-ant-api",
|
|
859
|
+
"sk-ant",
|
|
860
|
+
"sk-proj",
|
|
861
|
+
"sk-svcacct",
|
|
862
|
+
"sk-or-v1",
|
|
863
|
+
"sk-or",
|
|
864
|
+
"sk-lf",
|
|
865
|
+
"sk-",
|
|
866
|
+
"gsk_",
|
|
867
|
+
"aiza",
|
|
868
|
+
"ya29",
|
|
869
|
+
"ghp_",
|
|
870
|
+
"gho_",
|
|
871
|
+
"github_pat_",
|
|
872
|
+
"xai-",
|
|
873
|
+
"pplx-",
|
|
874
|
+
"r8_",
|
|
875
|
+
"hf_",
|
|
876
|
+
"astra-",
|
|
877
|
+
"astrae-"
|
|
878
|
+
];
|
|
879
|
+
var MAX_HEADERS = 64;
|
|
880
|
+
var MAX_HEADER_VALUE_BYTES = 1024;
|
|
881
|
+
var MAX_TOTAL_BYTES = 16 * 1024;
|
|
882
|
+
function byteLength(s) {
|
|
883
|
+
let bytes = 0;
|
|
884
|
+
for (let i = 0; i < s.length; i++) {
|
|
885
|
+
const code = s.charCodeAt(i);
|
|
886
|
+
if (code < 128) bytes += 1;
|
|
887
|
+
else if (code < 2048) bytes += 2;
|
|
888
|
+
else if (code >= 55296 && code <= 56319) {
|
|
889
|
+
bytes += 4;
|
|
890
|
+
i++;
|
|
891
|
+
} else bytes += 3;
|
|
892
|
+
}
|
|
893
|
+
return bytes;
|
|
894
|
+
}
|
|
895
|
+
function extractApiKeyFormat(rawValue) {
|
|
896
|
+
if (!rawValue) return void 0;
|
|
897
|
+
let value = rawValue.trim();
|
|
898
|
+
const spaceIdx = value.indexOf(" ");
|
|
899
|
+
if (spaceIdx > 0) {
|
|
900
|
+
const scheme = value.slice(0, spaceIdx).toLowerCase();
|
|
901
|
+
if (scheme === "bearer" || scheme === "basic" || scheme === "token") {
|
|
902
|
+
value = value.slice(spaceIdx + 1).trim();
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
const lower = value.toLowerCase();
|
|
906
|
+
for (const prefix of KEY_FORMAT_PREFIXES) {
|
|
907
|
+
if (lower.startsWith(prefix)) {
|
|
908
|
+
return prefix;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return void 0;
|
|
912
|
+
}
|
|
913
|
+
function isSecretHeader(name) {
|
|
914
|
+
if (SECRET_HEADER_NAMES.has(name)) return true;
|
|
915
|
+
if (SECRET_HEADER_PREFIXES.some((p) => name.startsWith(p))) return true;
|
|
916
|
+
if (isSignatureHeader(name)) return true;
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
919
|
+
function isPlatformHeader(name) {
|
|
920
|
+
if (PLATFORM_HEADER_NAMES.has(name)) return true;
|
|
921
|
+
return PLATFORM_HEADER_PREFIXES.some((p) => name.startsWith(p));
|
|
922
|
+
}
|
|
923
|
+
function sanitizeHeaders(raw) {
|
|
924
|
+
const headers = {};
|
|
925
|
+
const platformHeaders = {};
|
|
926
|
+
let apiKeyFormat;
|
|
927
|
+
let totalBytes = 0;
|
|
928
|
+
let count = 0;
|
|
929
|
+
if (!raw) return { headers };
|
|
930
|
+
for (const rawName of Object.keys(raw)) {
|
|
931
|
+
if (count >= MAX_HEADERS) break;
|
|
932
|
+
const name = rawName.toLowerCase();
|
|
933
|
+
const rawValue = raw[rawName];
|
|
934
|
+
if (rawValue === void 0) continue;
|
|
935
|
+
const joined = Array.isArray(rawValue) ? rawValue.join(", ") : String(rawValue);
|
|
936
|
+
if (CREDENTIAL_HEADER_NAMES.has(name)) {
|
|
937
|
+
const fmt = extractApiKeyFormat(joined);
|
|
938
|
+
if (fmt && !apiKeyFormat) apiKeyFormat = fmt;
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
941
|
+
if (isSecretHeader(name)) continue;
|
|
942
|
+
let value = joined;
|
|
943
|
+
if (byteLength(value) > MAX_HEADER_VALUE_BYTES) {
|
|
944
|
+
value = value.slice(0, MAX_HEADER_VALUE_BYTES);
|
|
945
|
+
}
|
|
946
|
+
const entryBytes = byteLength(name) + byteLength(value);
|
|
947
|
+
if (totalBytes + entryBytes > MAX_TOTAL_BYTES) continue;
|
|
948
|
+
totalBytes += entryBytes;
|
|
949
|
+
count++;
|
|
950
|
+
headers[name] = value;
|
|
951
|
+
if (isPlatformHeader(name)) platformHeaders[name] = value;
|
|
952
|
+
}
|
|
953
|
+
const result = { headers };
|
|
954
|
+
if (apiKeyFormat) result.apiKeyFormat = apiKeyFormat;
|
|
955
|
+
if (Object.keys(platformHeaders).length > 0) result.platformHeaders = platformHeaders;
|
|
956
|
+
return result;
|
|
957
|
+
}
|
|
958
|
+
|
|
820
959
|
// src/adapters/express.ts
|
|
821
960
|
function defaultExtractCredentials(req) {
|
|
822
961
|
return extractCredentials(
|
|
@@ -1083,7 +1222,18 @@ function createMiddleware(options) {
|
|
|
1083
1222
|
referer: req.headers.referer,
|
|
1084
1223
|
host: req.headers.host,
|
|
1085
1224
|
forwardedFor: forwardedForStr,
|
|
1086
|
-
agentCardUrl
|
|
1225
|
+
agentCardUrl,
|
|
1226
|
+
// Workstream D — capture EVERY inbound header (SDK-only merchants
|
|
1227
|
+
// have no edge to do it upstream). Local string work, secrets
|
|
1228
|
+
// stripped; out of the verify cache key so it doesn't defeat caching.
|
|
1229
|
+
observedMetadata: (() => {
|
|
1230
|
+
const { headers, apiKeyFormat, platformHeaders } = sanitizeHeaders(req.headers);
|
|
1231
|
+
return {
|
|
1232
|
+
headers,
|
|
1233
|
+
...apiKeyFormat && { apiKeyFormat },
|
|
1234
|
+
...platformHeaders && { platformHeaders }
|
|
1235
|
+
};
|
|
1236
|
+
})()
|
|
1087
1237
|
}
|
|
1088
1238
|
};
|
|
1089
1239
|
let result = await verify(config, verificationRequest);
|