securenow 8.0.0 → 8.0.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/cli/apiKey.js +7 -0
- package/package.json +1 -1
package/cli/apiKey.js
CHANGED
|
@@ -4,6 +4,10 @@ const { api, requireAuth } = require('./client');
|
|
|
4
4
|
const config = require('./config');
|
|
5
5
|
const ui = require('./ui');
|
|
6
6
|
|
|
7
|
+
const PRESET_SCOPES = {
|
|
8
|
+
runtime_app: ['traces:write', 'logs:write', 'firewall:read', 'blocklist:read', 'allowlist:read'],
|
|
9
|
+
};
|
|
10
|
+
|
|
7
11
|
function maskKey(key) {
|
|
8
12
|
if (!key || key.length < 16) return key || '';
|
|
9
13
|
return `${key.slice(0, 12)}••••••${key.slice(-4)}`;
|
|
@@ -20,6 +24,9 @@ async function create(args, flags) {
|
|
|
20
24
|
const s = ui.spinner(`Creating ${preset} API key`);
|
|
21
25
|
try {
|
|
22
26
|
const body = { name, preset };
|
|
27
|
+
if (PRESET_SCOPES[preset]) {
|
|
28
|
+
body.scopes = PRESET_SCOPES[preset];
|
|
29
|
+
}
|
|
23
30
|
if (flags.app) {
|
|
24
31
|
body.apps = [flags.app];
|
|
25
32
|
} else if (preset === 'runtime_app' && app?.key) {
|
package/package.json
CHANGED