@browserless.io/cli 0.4.1 → 0.4.2
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/CHANGELOG.md +7 -0
- package/README.md +1 -0
- package/build/auth/server-url.js +2 -0
- package/build/auth/store.js +1 -1
- package/build/config/schema.js +1 -1
- package/build/version.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.2](https://github.com/browserless/browserless-cli/compare/v0.4.1...v0.4.2) (2026-10-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* PLT-1314 enforce secure server URLs before sending tokens ([#120](https://github.com/browserless/browserless-cli/issues/120)) ([de84550](https://github.com/browserless/browserless-cli/commit/de8455044faa84d99627475db49eb76a7feadfc1))
|
|
9
|
+
|
|
3
10
|
## [0.4.1](https://github.com/browserless/browserless-cli/compare/v0.4.0...v0.4.1) (2026-10-06)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -343,6 +343,7 @@ side-effects the CLI itself owns).
|
|
|
343
343
|
| `BROWSERLESS_TELEMETRY_DISABLED` | `1` to disable usage analytics for the run (see [Usage Analytics](#-usage-analytics)) |
|
|
344
344
|
| `DO_NOT_TRACK` | `1` also disables usage analytics (cross-tool standard) |
|
|
345
345
|
| `BROWSERLESS_API_URL` | Override the analytics endpoint (default `https://api.browserless.io`); must use HTTPS on `browserless.io` or `*.browserless.io`, or HTTP(S) loopback for local development. Telemetry is skipped otherwise. |
|
|
346
|
+
| `BROWSERLESS_ALLOW_INSECURE_HTTP` | `1` to allow sending the token over `http://` to a non-loopback server (prints a warning) |
|
|
346
347
|
| `BROWSERLESS_TELEMETRY_TIMEOUT_MS` | Override the 2 s analytics flush timeout (ignored unless a positive number) |
|
|
347
348
|
|
|
348
349
|
## 📊 Usage Analytics
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var s=Object.defineProperty;var o=(r,t)=>s(r,"name",{value:t,configurable:!0});import{PreconditionError as n,UsageError as e}from"../errors.js";import{isLoopbackHostname as p}from"../utils/loopback.js";const i="BROWSERLESS_ALLOW_INSECURE_HTTP",S=o(r=>{let t;try{t=new URL(r)}catch{throw new e(`server must be a valid URL (got "${r}")`)}if(t.protocol==="https:")return r;if(t.protocol==="http:"){if(p(t.hostname))return r;if(process.env[i]==="1")return process.stderr.write(`warning: sending your Browserless token over unencrypted http:// to ${t.host} (BROWSERLESS_ALLOW_INSECURE_HTTP is set)
|
|
2
|
+
`),r;throw new n(`Refusing to send your Browserless token over unencrypted http:// to ${t.host}. Use https://, or set BROWSERLESS_ALLOW_INSECURE_HTTP=1 to override.`,"insecure-server-url")}throw new e(`server must use https:// (got "${t.protocol}")`)},"assertSecureServerUrl");export{i as ALLOW_INSECURE_ENV,S as assertSecureServerUrl};
|
package/build/auth/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=Object.defineProperty;var t=(e,o)=>k(e,"name",{value:o,configurable:!0});import{readConfig as a,updateConfig as l}from"../config/store.js";import{DEFAULT_SERVER as g}from"../config/schema.js";import{deleteFromKeychain as u,readFromKeychain as y,writeToKeychain as w}from"./keychain.js";import{PreconditionError as i}from"../errors.js";import{regionToServerUrl as f}from"../regions.js";import{recordToken as s}from"../telemetry/token-cache.js";import{assertSecureServerUrl as c}from"./server-url.js";const h="BROWSERLESS_TOKEN",R=t(async e=>{const o=typeof e=="string"?e:e?.server,r=typeof e=="string"?void 0:e?.region;if(r&&o)throw new i("--region and --server are mutually exclusive \u2014 pass one or the other.","server-region-conflict");if(r)return f(r);if(o)return c(o);const n=await a();if(n.region&&n.server)throw new i(`Both "region" (${n.region}) and "server" (${n.server}) are set in ~/.browserless/config.json \u2014 unset one with \`browserless config unset region\` or \`browserless config unset server\`.`,"server-region-conflict");return n.region?f(n.region):c(n.server??g)},"resolveServer"),T=t(async e=>{if(e.flag)return s({token:e.flag,server:e.server}),{token:e.flag,source:"flag"};const o=process.env[h];if(o)return s({token:o,server:e.server}),{token:o,source:"env"};const r=await y(e.server);if(r.ok){if(r.value!==null)return s({token:r.value,server:e.server}),{token:r.value,source:"keychain"}}else if(r.reason==="op-failed")throw new i(`Keychain is available but read failed: ${r.error}. Retry, or set BROWSERLESS_DISABLE_KEYCHAIN=1 to bypass and use the plaintext fallback at ~/.browserless/config.json.`,"keychain-read-failed");const n=await a();if(n.api_key)return s({token:n.api_key,server:e.server}),{token:n.api_key,source:"file"};throw new i("No API token configured. Run `browserless auth login` to set one.","no-token")},"resolveToken"),x=t(async e=>{const o=await w(e.server,e.token);if(o.ok)return await l(r=>{r.token_storage="keychain",delete r.api_key}),{mode:"keychain"};if(o.reason==="op-failed")throw new i(`Keychain is available but write failed: ${o.error}. Retry, or set BROWSERLESS_DISABLE_KEYCHAIN=1 to store the token in plaintext at ~/.browserless/config.json instead.`,"keychain-write-failed");return await l(r=>{r.token_storage="file",r.api_key=e.token}),{mode:"file",warning:"Token stored in plaintext at ~/.browserless/config.json \u2014 keychain unavailable on this system."}},"persistToken"),K=t(async e=>{const o=await u(e);if(!o.ok&&o.reason==="op-failed")throw new i(`Could not delete the keychain entry for ${e}: ${o.error}. The token may still be stored \u2014 fix the keychain access and re-run \`browserless auth logout\`.`,"keychain-delete-failed");await l(r=>{delete r.api_key,delete r.token_storage})},"clearToken"),A=t(async()=>(await a()).token_storage??"none","getTokenStorageMode");export{K as clearToken,A as getTokenStorageMode,x as persistToken,R as resolveServer,T as resolveToken};
|
package/build/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var n=(e,t)=>l(e,"name",{value:t,configurable:!0});import{UsageError as s}from"../errors.js";import{isKnownRegion as c,KNOWN_REGIONS as d}from"../regions.js";const f="https://production-sfo.browserless.io",p=7,
|
|
1
|
+
var l=Object.defineProperty;var n=(e,t)=>l(e,"name",{value:t,configurable:!0});import{UsageError as s}from"../errors.js";import{isKnownRegion as c,KNOWN_REGIONS as d}from"../regions.js";const f="https://production-sfo.browserless.io",p=7,o={server:{kind:"scalar",sensitive:!1,parse:n(e=>{let t;try{t=new URL(e)}catch{throw new s(`server must be a valid URL (got "${e}")`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new s(`server must use https:// (got "${t.protocol}")`);return e},"parse")},region:{kind:"scalar",sensitive:!1,parse:n(e=>{if(!c(e))throw new s(`region must be one of: ${d.join(", ")} (got "${e}"). For self-hosted or staging, use \`config set server <url>\` instead.`);return e},"parse")},terms_ttl_days:{kind:"scalar",sensitive:!1,parse:n(e=>{const t=Number(e);if(!Number.isFinite(t)||t<0||!Number.isInteger(t))throw new s(`terms_ttl_days must be a non-negative integer (got "${e}")`);return t},"parse")},telemetry:{kind:"scalar",sensitive:!1,parse:n(e=>{const t=e.trim().toLowerCase();if(["true","1","yes","on"].includes(t))return!0;if(["false","0","no","off"].includes(t))return!1;throw new s(`telemetry must be a boolean (true/false) (got "${e}")`)},"parse")},excluded_domains:{kind:"list",manageHint:"`browserless profile exclude add/rm/list`",sensitive:!1},accepted_terms_at:{kind:"cli-managed",manageHint:"set automatically when you accept the disclaimer",sensitive:!1},token_storage:{kind:"cli-managed",manageHint:"set automatically by `browserless auth login`",sensitive:!1},api_key:{kind:"cli-managed",manageHint:"managed by `browserless auth login` / `auth logout`",sensitive:!0}},w=n(e=>o[e].sensitive,"isSensitiveKey"),r=n(()=>Object.keys(o),"allConfigKeys"),a=n(e=>Object.prototype.hasOwnProperty.call(o,e),"isKnownKey"),h=n((e,t)=>{if(!a(e))throw new s(`Unknown config key "${e}". Known keys: ${r().join(", ")}.`);const i=o[e];if(i.kind==="list")throw new s(`"${e}" is a list. Manage it via ${i.manageHint} \u2014 not via \`config set\`.`);if(i.kind==="cli-managed")throw new s(`"${e}" is managed by the CLI (${i.manageHint}). Editing it directly is not supported.`);return i.parse(t)},"validateScalarSet"),v=n(e=>{if(!a(e))throw new s(`Unknown config key "${e}". Known keys: ${r().join(", ")}.`);const t=o[e];if(t.kind==="cli-managed")throw new s(`"${e}" is managed by the CLI (${t.manageHint}). Use the relevant command to clear it.`);return e},"validateUnset");export{f as DEFAULT_SERVER,p as DEFAULT_TERMS_TTL_DAYS,r as allConfigKeys,a as isKnownKey,w as isSensitiveKey,h as validateScalarSet,v as validateUnset};
|
package/build/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.4.
|
|
1
|
+
const o="0.4.2";export{o as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserless.io/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Browserless CLI — manage authentication profiles, sessions, and other Browserless features from your terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/chai": "^5.2.3",
|
|
58
58
|
"@types/chrome-remote-interface": "^0.34.0",
|
|
59
59
|
"@types/mocha": "^10.0.10",
|
|
60
|
-
"@types/node": "^26.6.
|
|
60
|
+
"@types/node": "^26.6.5",
|
|
61
61
|
"@types/sinon": "^22.0.0",
|
|
62
62
|
"@types/ws": "^8.18.2",
|
|
63
63
|
"chai": "^6.3.0",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"husky": "^9.1.7",
|
|
68
68
|
"lint-staged": "^17.6.0",
|
|
69
69
|
"mocha": "^12.0.3",
|
|
70
|
-
"prettier": "3.9.
|
|
70
|
+
"prettier": "3.9.10",
|
|
71
71
|
"sinon": "^22.1.0",
|
|
72
72
|
"typescript": "^6.0.3",
|
|
73
|
-
"typescript-eslint": "^8.71.
|
|
73
|
+
"typescript-eslint": "^8.71.1"
|
|
74
74
|
},
|
|
75
75
|
"overrides": {
|
|
76
76
|
"mocha": {
|