@arcjet/env
Advanced tools
+15
-7
@@ -67,3 +67,2 @@ /** | ||
| "https://fly.decide.arcjettest.com", | ||
| "https://decide.arcjet.orb.local", | ||
| // Allow trailing slashes | ||
@@ -74,3 +73,2 @@ "https://decide.arcjet.com/", | ||
| "https://fly.decide.arcjettest.com/", | ||
| "https://decide.arcjet.orb.local/", | ||
| ]; | ||
@@ -86,7 +84,17 @@ /** | ||
| function baseUrl(environment) { | ||
| // Use ARCJET_BASE_URL if it is set and belongs to our allowlist; otherwise | ||
| // use the hardcoded default. | ||
| if (typeof environment["ARCJET_BASE_URL"] === "string" && | ||
| baseUrlAllowed.includes(environment["ARCJET_BASE_URL"])) { | ||
| return environment["ARCJET_BASE_URL"]; | ||
| // Use ARCJET_BASE_URL if it is set and belongs to our allowlist or has a | ||
| // hostname ending in .orb.local; otherwise use the hardcoded default. | ||
| if (typeof environment["ARCJET_BASE_URL"] === "string") { | ||
| if (baseUrlAllowed.includes(environment["ARCJET_BASE_URL"])) { | ||
| return environment["ARCJET_BASE_URL"]; | ||
| } | ||
| try { | ||
| const hostname = new URL(environment["ARCJET_BASE_URL"]).hostname; | ||
| if (hostname.endsWith(".orb.local")) { | ||
| return environment["ARCJET_BASE_URL"]; | ||
| } | ||
| } | ||
| catch { | ||
| // Invalid URL, fall through to default. | ||
| } | ||
| } | ||
@@ -93,0 +101,0 @@ // If we're running on fly.io, use the Arcjet Decide Service hosted on fly |
+3
-3
| { | ||
| "name": "@arcjet/env", | ||
| "version": "1.3.1", | ||
| "version": "1.4.0", | ||
| "description": "Arcjet environment detection", | ||
@@ -46,4 +46,4 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "@arcjet/eslint-config": "1.3.1", | ||
| "@arcjet/rollup-config": "1.3.1", | ||
| "@arcjet/eslint-config": "1.4.0", | ||
| "@arcjet/rollup-config": "1.4.0", | ||
| "@rollup/wasm-node": "4.59.0", | ||
@@ -50,0 +50,0 @@ "eslint": "9.39.3", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
22643
1.25%187
4.47%