@autokap/core 1.6.6 → 1.6.8
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/config.d.ts +14 -0
- package/dist/config.js +25 -0
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -34,4 +34,18 @@ declare function assertAllowedApiOrigin(candidateUrl: string, baselineUrl: strin
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function validateServerOrigin(candidateUrl: string): void;
|
|
36
36
|
export declare function validatePublicHttpUrl(candidateUrl: string, fieldLabel?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Validator for URLs that are dereferenced ONLY by the user's local machine —
|
|
39
|
+
* project baseUrls (Playwright local navigates there), credential loginUrls,
|
|
40
|
+
* etc. There is no SSRF surface here: the cloud server never fetches these.
|
|
41
|
+
*
|
|
42
|
+
* Accepts localhost, RFC1918 private ranges, link-local, IPv6 loopback,
|
|
43
|
+
* `.local` / `.internal` mDNS names. Still rejects non-http(s) schemes and
|
|
44
|
+
* unparseable URLs, because those aren't valid navigation targets anyway.
|
|
45
|
+
*
|
|
46
|
+
* Use this instead of `validatePublicHttpUrl` whenever the URL is consumed
|
|
47
|
+
* client-side. Reserve `validatePublicHttpUrl` for inputs the cloud server
|
|
48
|
+
* will fetch (apiBaseUrl, proxyUrl, webhookUrl).
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateClientConsumedHttpUrl(candidateUrl: string, fieldLabel?: string): void;
|
|
37
51
|
export { DEFAULT_API_BASE_URL, DEFAULT_WS_URL, LOCAL_API_BASE_URL, API_KEY_ENV_VAR, RUN_TOKEN_ENV_VAR, API_BASE_URL_ENV_VAR, WS_URL_ENV_VAR, ALLOW_UNSAFE_SERVER_ORIGIN_ENV_VAR, assertAllowedApiOrigin, };
|
package/dist/config.js
CHANGED
|
@@ -228,6 +228,31 @@ export function validatePublicHttpUrl(candidateUrl, fieldLabel = 'URL') {
|
|
|
228
228
|
`Set ${ALLOW_UNSAFE_SERVER_ORIGIN_ENV_VAR}=1 to override (dev/test only).`);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Validator for URLs that are dereferenced ONLY by the user's local machine —
|
|
233
|
+
* project baseUrls (Playwright local navigates there), credential loginUrls,
|
|
234
|
+
* etc. There is no SSRF surface here: the cloud server never fetches these.
|
|
235
|
+
*
|
|
236
|
+
* Accepts localhost, RFC1918 private ranges, link-local, IPv6 loopback,
|
|
237
|
+
* `.local` / `.internal` mDNS names. Still rejects non-http(s) schemes and
|
|
238
|
+
* unparseable URLs, because those aren't valid navigation targets anyway.
|
|
239
|
+
*
|
|
240
|
+
* Use this instead of `validatePublicHttpUrl` whenever the URL is consumed
|
|
241
|
+
* client-side. Reserve `validatePublicHttpUrl` for inputs the cloud server
|
|
242
|
+
* will fetch (apiBaseUrl, proxyUrl, webhookUrl).
|
|
243
|
+
*/
|
|
244
|
+
export function validateClientConsumedHttpUrl(candidateUrl, fieldLabel = 'URL') {
|
|
245
|
+
let parsed;
|
|
246
|
+
try {
|
|
247
|
+
parsed = new URL(candidateUrl);
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
throw new Error(`Invalid ${fieldLabel}: ${candidateUrl}`);
|
|
251
|
+
}
|
|
252
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
253
|
+
throw new Error(`Refusing ${fieldLabel} with unsupported scheme "${parsed.protocol}"; only http(s) are allowed.`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
231
256
|
function isPrivateOrInternalHost(hostname) {
|
|
232
257
|
const lower = hostname.toLowerCase();
|
|
233
258
|
if (lower === 'localhost')
|