unbound-cli 1.25.0 → 1.25.1
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/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install -g unbound-cli
|
|
|
14
14
|
# Login via browser
|
|
15
15
|
unbound login
|
|
16
16
|
|
|
17
|
-
# Or login with your CLI key from
|
|
17
|
+
# Or login with your CLI key from Settings → API Tokens (for CI/CD or headless environments)
|
|
18
18
|
unbound login --api-key <your-cli-key>
|
|
19
19
|
|
|
20
20
|
# Check your status, role, and connected tools
|
|
@@ -378,7 +378,7 @@ unbound config show
|
|
|
378
378
|
|
|
379
379
|
Bare hostnames are accepted (`backend.acme.com` becomes `https://backend.acme.com`). Each URL also accepts a per-process override via env var.
|
|
380
380
|
|
|
381
|
-
**API keys.** The CLI key (
|
|
381
|
+
**API keys.** The CLI key (Settings → API Tokens) can read your organization's data, so `unbound login` keeps it in the OS keychain: macOS Keychain, Windows Credential Manager, or the Linux Secret Service (`secret-tool`). Without a keychain, set `UNBOUND_TOKEN` instead; the CLI reads it only when the keychain has no key. The send-only device key that tools and hooks use is stored as `api_key` in `~/.unbound/config.json`. `unbound setup` fetches it from your login, and `--api-key` takes a device key. Run `unbound login` again after upgrading.
|
|
382
382
|
|
|
383
383
|
**Backend URL priority** (highest to lowest):
|
|
384
384
|
1. `UNBOUND_API_URL` environment variable
|
package/package.json
CHANGED
package/src/auth.js
CHANGED
|
@@ -12,7 +12,7 @@ const output = require('./output');
|
|
|
12
12
|
const api = require('./api');
|
|
13
13
|
const { getDeviceSerial, probeDeviceSerialLive } = require('./device-serial');
|
|
14
14
|
|
|
15
|
-
const NOT_A_CLI_KEY = "This key can't be used with the CLI.
|
|
15
|
+
const NOT_A_CLI_KEY = "This key can't be used with the CLI. Create one in Settings \u2192 API Tokens, or run `unbound login`.";
|
|
16
16
|
|
|
17
17
|
// 401/403 means the key is not a CLI key; anything else (offline, 5xx) is an outage, not an answer.
|
|
18
18
|
function isRejected(err) {
|
|
@@ -22,7 +22,7 @@ function isRejected(err) {
|
|
|
22
22
|
function warnIfNotStored(stored) {
|
|
23
23
|
if (stored === false) {
|
|
24
24
|
output.warn('No OS keychain is available, so this login lasts for this run only. '
|
|
25
|
-
+ 'Set UNBOUND_TOKEN to your CLI key (
|
|
25
|
+
+ 'Set UNBOUND_TOKEN to your CLI key (Settings \u2192 API Tokens) to stay logged in.');
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
package/src/commands/login.js
CHANGED
|
@@ -28,7 +28,7 @@ Authentication methods:
|
|
|
28
28
|
|
|
29
29
|
API key login (--api-key):
|
|
30
30
|
Non-interactive login for CI/CD or automation. Takes the CLI key from
|
|
31
|
-
|
|
31
|
+
Settings → API Tokens and keeps it in the OS keychain (or set
|
|
32
32
|
UNBOUND_TOKEN where there is none). Device and MDM keys are refused.
|
|
33
33
|
|
|
34
34
|
Tenant deployments (URL flags persist to ~/.unbound/config.json):
|
|
@@ -286,7 +286,7 @@ function routeBackendError(err) {
|
|
|
286
286
|
const code = err.statusCode;
|
|
287
287
|
if (code === 401 || code === 403) {
|
|
288
288
|
return {
|
|
289
|
-
message: 'Authentication failed / not authorized. Tool policies require admin. Run `unbound
|
|
289
|
+
message: 'Authentication failed / not authorized. Tool policies require admin. Run `unbound status` to check role.',
|
|
290
290
|
exitCode: 3,
|
|
291
291
|
};
|
|
292
292
|
}
|
package/test/cli-key.test.js
CHANGED
|
@@ -46,6 +46,7 @@ test('login --api-key rejects a device or MDM key and stores nothing', async ()
|
|
|
46
46
|
const { auth, state } = freshAuth();
|
|
47
47
|
await assert.rejects(() => auth.loginWithApiKey('device-key'));
|
|
48
48
|
assert.match(state.failed, /can't be used with the CLI/);
|
|
49
|
+
assert.match(state.failed, /Settings \u2192 API Tokens/);
|
|
49
50
|
assert.equal(state.keychain, null);
|
|
50
51
|
assert.equal(state.config, null);
|
|
51
52
|
});
|
|
@@ -395,7 +395,7 @@ test('routing: 401 → exit 3 + admin-required wording', async () => {
|
|
|
395
395
|
await runCreateMcp(['--prompt', 'audit linear writes', '--yes']);
|
|
396
396
|
assert.equal(process.exitCode, 3);
|
|
397
397
|
assert.ok(
|
|
398
|
-
h.captured.error.some((m) => m === 'Authentication failed / not authorized. Tool policies require admin. Run `unbound
|
|
398
|
+
h.captured.error.some((m) => m === 'Authentication failed / not authorized. Tool policies require admin. Run `unbound status` to check role.'),
|
|
399
399
|
`got: ${JSON.stringify(h.captured.error)}`
|
|
400
400
|
);
|
|
401
401
|
} finally {
|
|
@@ -795,7 +795,7 @@ test('routing: 401 → exit 3 + admin-required wording', async () => {
|
|
|
795
795
|
await runCreate(['--prompt', 'block rm -rf', '--yes']);
|
|
796
796
|
assert.equal(process.exitCode, 3);
|
|
797
797
|
assert.ok(
|
|
798
|
-
h.captured.error.some((m) => m === 'Authentication failed / not authorized. Tool policies require admin. Run `unbound
|
|
798
|
+
h.captured.error.some((m) => m === 'Authentication failed / not authorized. Tool policies require admin. Run `unbound status` to check role.'),
|
|
799
799
|
`got: ${JSON.stringify(h.captured.error)}`
|
|
800
800
|
);
|
|
801
801
|
} finally {
|