@bussolabs/closeyourit-cli 0.2.0 → 0.2.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/dist/base.js +7 -0
- package/dist/commands/whoami.js +21 -2
- package/oclif.manifest.json +3417 -3417
- package/opencli.json +1 -1
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -101,6 +101,13 @@ class BaseCommand extends core_1.Command {
|
|
|
101
101
|
}
|
|
102
102
|
return this.exit(1);
|
|
103
103
|
}
|
|
104
|
+
// Oclif's default JSON formatter serializes the complete CommandError. That object references
|
|
105
|
+
// the command instance and therefore cfg/api.config, including the bearer token. Never pass an
|
|
106
|
+
// unknown error to that formatter in JSON mode: emit a deliberately small allow-listed envelope.
|
|
107
|
+
if (this.jsonEnabled()) {
|
|
108
|
+
this.logJson({ error: { code: error_codes_1.ErrorCodes.System.unexpected, message: 'Command failed' } });
|
|
109
|
+
return this.exit(1);
|
|
110
|
+
}
|
|
104
111
|
return super.catch(error);
|
|
105
112
|
}
|
|
106
113
|
}
|
package/dist/commands/whoami.js
CHANGED
|
@@ -2,11 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const base_1 = require("../base");
|
|
4
4
|
class Whoami extends base_1.BaseCommand {
|
|
5
|
-
static description = 'Show the authenticated account, organization, token and permissions';
|
|
5
|
+
static description = 'Show the authenticated account, organization, token prefix and permissions';
|
|
6
6
|
static examples = ['<%= config.bin %> whoami', '<%= config.bin %> whoami --json'];
|
|
7
7
|
async run() {
|
|
8
8
|
const res = await this.api.get('/cli/v1/whoami');
|
|
9
|
-
|
|
9
|
+
// Rebuild from an allow-list. If a future backend accidentally includes a token secret or other
|
|
10
|
+
// authentication internals, `--json` must not proxy them to stdout.
|
|
11
|
+
const who = {
|
|
12
|
+
account: res.data.account && {
|
|
13
|
+
id: res.data.account.id,
|
|
14
|
+
name: res.data.account.name,
|
|
15
|
+
email: res.data.account.email,
|
|
16
|
+
},
|
|
17
|
+
organization: res.data.organization && {
|
|
18
|
+
id: res.data.organization.id,
|
|
19
|
+
name: res.data.organization.name,
|
|
20
|
+
slug: res.data.organization.slug,
|
|
21
|
+
},
|
|
22
|
+
token: res.data.token && {
|
|
23
|
+
id: res.data.token.id,
|
|
24
|
+
name: res.data.token.name,
|
|
25
|
+
prefix: res.data.token.prefix,
|
|
26
|
+
},
|
|
27
|
+
permissions: res.data.permissions,
|
|
28
|
+
};
|
|
10
29
|
if (!this.jsonEnabled()) {
|
|
11
30
|
this.log(`Account: ${who.account?.name ?? '-'} <${who.account?.email ?? '-'}>`);
|
|
12
31
|
this.log(`Organization: ${who.organization?.name ?? '-'} (${who.organization?.slug ?? '-'})`);
|