bdy 1.22.84 → 1.22.85-beta

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.
@@ -48,6 +48,7 @@ exports.openApiPrepareUrl = openApiPrepareUrl;
48
48
  exports.getOpenApiEndpointByApiBaseUrl = getOpenApiEndpointByApiBaseUrl;
49
49
  exports.isValidDomain = isValidDomain;
50
50
  exports.isInSandbox = isInSandbox;
51
+ exports.isLocalHost = isLocalHost;
51
52
  exports.isValidSubdomain = isValidSubdomain;
52
53
  exports.isValidEmail = isValidEmail;
53
54
  exports.isValidName = isValidName;
@@ -56,6 +57,8 @@ exports.getSubdomain = getSubdomain;
56
57
  exports.getDomainTld = getDomainTld;
57
58
  exports.getPopularTlds = getPopularTlds;
58
59
  exports.getAppHostByApiBaseUrl = getAppHostByApiBaseUrl;
60
+ exports.getOidcIssuerByAppHost = getOidcIssuerByAppHost;
61
+ exports.isKnownOidcIssuer = isKnownOidcIssuer;
59
62
  const node_path_1 = __importDefault(require("node:path"));
60
63
  const node_fs_1 = require("node:fs");
61
64
  const texts_1 = require("./texts");
@@ -711,6 +714,13 @@ function isValidDomain(prompt) {
711
714
  function isInSandbox() {
712
715
  return !!process.env.BUDDY_SANDBOX && !!process.env.BUDDY_SANDBOX_ID;
713
716
  }
717
+ // Verify TLS certs for real hosts; only local/IP dev hosts (self-signed)
718
+ // may skip verification. Accepts a full URL or a bare hostname.
719
+ function isLocalHost(host) {
720
+ return (/^(https?:\/\/)?\d+\.\d+\.\d+\.\d+/.test(host) ||
721
+ /\.local\.io/.test(host) ||
722
+ /\.tsd\.com/.test(host));
723
+ }
714
724
  function isValidSubdomain(prompt) {
715
725
  return /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(prompt);
716
726
  }
@@ -877,3 +887,42 @@ function getAppHostByApiBaseUrl(baseUrl) {
877
887
  return baseUrl.hostname;
878
888
  }
879
889
  }
890
+ // Pins each (platform-set, trusted) app host to its environment's OIDC issuer,
891
+ // so a token minted by one environment can't authenticate against another.
892
+ // Mirrors getAppHostByApiBaseUrl; matched as ordered hostname substrings.
893
+ const APP_HOST_OIDC_ISSUERS = [
894
+ ['app.buddy.works', 'https://oidc.buddyusercontent.com'],
895
+ ['eu.buddy.works', 'https://eu-oidc.buddyusercontent.com'],
896
+ ['asia.buddy.works', 'https://asia-oidc.buddyusercontent.com'],
897
+ ['app.awsdev.net', 'https://dev-oidc.buddyusercontent.com'],
898
+ ['eu.awsstage.net', 'https://stageeu-oidc.buddyusercontent.com'],
899
+ ['app.awsstage.net', 'https://stage-oidc.buddyusercontent.com'],
900
+ ['app.awsmaster.net', 'https://master-oidc.buddyusercontent.com'],
901
+ ['app.buddy.mom', 'https://sls-oidc.buddyusercontent.com'],
902
+ ['app.sd1.com', 'https://sd1-oidc.buddyusercontent.com'],
903
+ ['app.sd2.com', 'https://sd2-oidc.buddyusercontent.com'],
904
+ ['app.sd3.com', 'https://sd3-oidc.buddyusercontent.com'],
905
+ ['app.sd4.com', 'https://sd4-oidc.buddyusercontent.com'],
906
+ ['app.sd5.com', 'https://sd5-oidc.buddyusercontent.com'],
907
+ ['app.sd6.com', 'https://sd6-oidc.buddyusercontent.com'],
908
+ ['app.sd7.com', 'https://sd7-oidc.buddyusercontent.com'],
909
+ ['app.sd8.com', 'https://sd8-oidc.buddyusercontent.com'],
910
+ ['app.sd9.com', 'https://sd9-oidc.buddyusercontent.com'],
911
+ ];
912
+ // Returns the pinned issuer for a host, or null for unmapped hosts (e.g. local dev IPs).
913
+ function getOidcIssuerByAppHost(host) {
914
+ let hostname = host;
915
+ try {
916
+ hostname = new URL(host).hostname;
917
+ }
918
+ catch {
919
+ // host may already be a bare hostname
920
+ }
921
+ const found = APP_HOST_OIDC_ISSUERS.find(([fragment]) => hostname.includes(fragment));
922
+ return found ? found[1] : null;
923
+ }
924
+ const OIDC_ISSUERS = new Set(APP_HOST_OIDC_ISSUERS.map(([, issuer]) => issuer));
925
+ // Bounds the JWKS fetch to trusted issuers (SSRF guard) for unmapped hosts.
926
+ function isKnownOidcIssuer(issuer) {
927
+ return OIDC_ISSUERS.has(issuer);
928
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.84",
4
+ "version": "1.22.85-beta",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",