@vigilbase/cli 0.2.5 → 0.2.6
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/CLOUDFLARE.md +9 -2
- package/COMMANDS.md +5 -5
- package/LOCAL.md +87 -12
- package/ONE.md +1 -1
- package/README.md +13 -10
- package/dist/commands/cloudflare.js +79 -13
- package/dist/commands/helpers.d.ts +4 -1
- package/dist/commands/local.js +44 -23
- package/dist/lib/checkup-report-limits.d.ts +16 -0
- package/dist/lib/checkup-report-limits.js +16 -0
- package/dist/lib/checkup-report.d.ts +118 -0
- package/dist/lib/checkup-report.js +503 -0
- package/dist/lib/format.d.ts +2 -0
- package/dist/lib/format.js +1 -1
- package/dist/lib/tui.d.ts +4 -0
- package/dist/lib/tui.js +2 -2
- package/dist/local/cloudflare-checkup/cf/allowlist.js +5 -2
- package/dist/local/cloudflare-checkup/collector.js +5 -5
- package/dist/local/cloudflare-checkup/contract.d.ts +481 -20
- package/dist/local/cloudflare-checkup/contract.js +111 -27
- package/dist/local/cloudflare-checkup/email-verification.d.ts +8 -1
- package/dist/local/cloudflare-checkup/email-verification.js +0 -5
- package/dist/local/cloudflare-checkup/identity-verification.d.ts +11 -0
- package/dist/local/cloudflare-checkup/identity-verification.js +65 -0
- package/dist/local/cloudflare-checkup/snapshot-file.js +13 -1
- package/dist/local/cloudflare-checkup/submit-client.d.ts +6 -3
- package/dist/local/cloudflare-checkup/submit-client.js +17 -4
- package/dist/local/cloudflare-checkup/terminal-ui.d.ts +10 -3
- package/dist/local/cloudflare-checkup/terminal-ui.js +13 -3
- package/package.json +1 -1
package/dist/lib/tui.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export type Symbols = {
|
|
|
40
40
|
warning: string;
|
|
41
41
|
error: string;
|
|
42
42
|
check: string;
|
|
43
|
+
/** A failed check in a result list. */
|
|
44
|
+
cross: string;
|
|
45
|
+
/** An item without a status in a result list. */
|
|
46
|
+
bullet: string;
|
|
43
47
|
radioOn: string;
|
|
44
48
|
radioOff: string;
|
|
45
49
|
pointer: string;
|
package/dist/lib/tui.js
CHANGED
|
@@ -59,12 +59,12 @@ export function supportsHyperlinks(env) {
|
|
|
59
59
|
return Number(env.KONSOLE_VERSION) >= 201200;
|
|
60
60
|
}
|
|
61
61
|
export const UNICODE_SYMBOLS = {
|
|
62
|
-
active: '◆', done: '◇', rail: '│', end: '└', warning: '▲', error: '■', check: '✓',
|
|
62
|
+
active: '◆', done: '◇', rail: '│', end: '└', warning: '▲', error: '■', check: '✓', cross: '✗', bullet: '•',
|
|
63
63
|
radioOn: '●', radioOff: '○', pointer: '›', ellipsis: '…', separator: '·', mask: '●', placeholder: '·',
|
|
64
64
|
barFull: '█', barEmpty: '░', up: '↑', down: '↓', spinner: ['◒', '◐', '◓', '◑'],
|
|
65
65
|
};
|
|
66
66
|
export const ASCII_SYMBOLS = {
|
|
67
|
-
active: '*', done: 'o', rail: '|', end: '+', warning: '!', error: 'x', check: 'v',
|
|
67
|
+
active: '*', done: 'o', rail: '|', end: '+', warning: '!', error: 'x', check: 'v', cross: 'x', bullet: '-',
|
|
68
68
|
radioOn: '>', radioOff: ' ', pointer: '>', ellipsis: '...', separator: '-', mask: '*', placeholder: '.',
|
|
69
69
|
barFull: '#', barEmpty: '-', up: '^', down: 'v', spinner: ['|', '/', '-', '\\'],
|
|
70
70
|
};
|
|
@@ -34,7 +34,7 @@ export const TEMPLATES = deepFreeze({
|
|
|
34
34
|
account: { args: ['accounts', 'get'], path: '/accounts/{A}', paging: { kind: 'single' }, output: 'object', scope: 'account' },
|
|
35
35
|
zones: { args: ['zones', 'list', '--account-id', '{A}', '--per-page', '50', '--page', '{N}'], path: '/zones', query: { 'account.id': '{A}', page: '{N}', per_page: 50 }, paging: pages(50), output: 'array', scope: 'account' },
|
|
36
36
|
account_members: { args: ['accounts', 'members', 'list', '--per-page', '50', '--page', '{N}'], path: '/accounts/{A}/members', query: { page: '{N}', per_page: 50 }, paging: pages(50), output: 'array', scope: 'account' },
|
|
37
|
-
account_rulesets: { args: ['rulesets', 'list', '--per-page', '
|
|
37
|
+
account_rulesets: { args: ['rulesets', 'list', '--per-page', '50'], path: '/accounts/{A}/rulesets', query: { per_page: 50 }, paging: { kind: 'one_call', perPage: 50 }, output: 'array', scope: 'account' },
|
|
38
38
|
account_access_rules: { args: ['firewall', 'access-rules', 'list', '--per-page', '50', '--page', '{N}'], path: '/accounts/{A}/firewall/access_rules/rules', query: { page: '{N}', per_page: 50 }, paging: pages(50), output: 'array', scope: 'account' },
|
|
39
39
|
access_apps: { args: ['zero-trust', 'access', 'applications', 'list', '--per-page', '50', '--page', '{N}'], path: '/accounts/{A}/access/apps', query: { page: '{N}', per_page: 50 }, paging: pages(50), output: 'array', scope: 'account' },
|
|
40
40
|
access_identity_providers: { args: ['zero-trust', 'identity-providers', 'list', '--per-page', '50', '--page', '{N}'], path: '/accounts/{A}/access/identity_providers', query: { page: '{N}', per_page: 50 }, paging: pages(50), output: 'array', scope: 'account' },
|
|
@@ -48,7 +48,10 @@ export const TEMPLATES = deepFreeze({
|
|
|
48
48
|
zone_dns_records: { args: ['dns', 'records', 'list', '--zone', '{Z}', '--per-page', '100', '--page', '{N}'], path: '/zones/{Z}/dns_records', query: { page: '{N}', per_page: 100 }, paging: pages(100, 100), output: 'array', scope: 'zone' },
|
|
49
49
|
zone_universal_ssl: { args: ['ssl', 'universal', 'settings', 'get', '--zone', '{Z}'], path: '/zones/{Z}/ssl/universal/settings', paging: { kind: 'single' }, output: 'object', scope: 'zone' },
|
|
50
50
|
zone_total_tls: { args: ['acm', 'total-tls', 'get', '--zone', '{Z}'], path: '/zones/{Z}/acm/total_tls', paging: { kind: 'single' }, output: 'object', scope: 'zone' },
|
|
51
|
-
|
|
51
|
+
zone_certificate_packs: { args: ['ssl', 'certificate-packs', 'list', '--zone', '{Z}', '--status', 'all', '--per-page', '50', '--page', '{N}'], path: '/zones/{Z}/ssl/certificate_packs', query: { status: 'all', per_page: 50, page: '{N}' }, paging: pages(50, 100), output: 'array', scope: 'zone' },
|
|
52
|
+
zone_custom_certificates: { args: ['custom-certificates', 'list', '--zone', '{Z}', '--per-page', '50', '--page', '{N}'], path: '/zones/{Z}/custom_certificates', query: { per_page: 50, page: '{N}' }, paging: pages(50, 100), output: 'array', scope: 'zone' },
|
|
53
|
+
zone_api_operations: { args: ['web-assets', 'operations', 'list', '--zone', '{Z}', '--feature', 'schema_info', '--per-page', '50', '--page', '{N}'], path: '/zones/{Z}/api_gateway/operations', query: { feature: 'schema_info', per_page: 50, page: '{N}' }, paging: pages(50, 100), output: 'array', scope: 'zone' },
|
|
54
|
+
zone_rulesets: { args: ['rulesets', 'list', '--zone', '{Z}', '--per-page', '50'], path: '/zones/{Z}/rulesets', query: { per_page: 50 }, paging: { kind: 'one_call', perPage: 50 }, output: 'array', scope: 'zone' },
|
|
52
55
|
zone_ruleset: { args: ['rulesets', 'get', '{R}', '--zone', '{Z}'], path: '/zones/{Z}/rulesets/{R}', paging: { kind: 'single' }, output: 'object', scope: 'ruleset' },
|
|
53
56
|
zone_access_rules: { args: ['firewall', 'access-rules', 'list', '--zone', '{Z}', '--per-page', '100', '--page', '{N}'], path: '/zones/{Z}/firewall/access_rules/rules', query: { page: '{N}', per_page: 100 }, paging: pages(100), output: 'array', scope: 'zone' },
|
|
54
57
|
zone_page_rules: { args: ['page-rules', 'list', '--zone', '{Z}'], path: '/zones/{Z}/pagerules', query: {}, paging: { kind: 'single' }, output: 'array', scope: 'zone' },
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Lists are paged with `--page N` until an empty page, because cf strips
|
|
8
8
|
* `result_info`: a final page and a server-clamped page look the same.
|
|
9
9
|
*/
|
|
10
|
-
import { ACCOUNT_KINDS, CloudflareCheckupSnapshotV1Schema, NOT_COLLECTABLE_ZONE_KINDS, NOT_COLLECTED_RESULT, PROJECTORS, SNAPSHOT_LIMITS, ZONE_SETTING_IDS, ZONE_SINGLE_KINDS, assembleSnapshot, collectionFailedResult, httpErrorResult, projectAccount, projectZones, projectionToResult, serializeSnapshot, } from './contract.js';
|
|
10
|
+
import { ACCOUNT_KINDS, CloudflareCheckupSnapshotV1Schema, NOT_COLLECTABLE_ZONE_KINDS, NOT_COLLECTED_RESULT, OPTIONAL_ZONE_KINDS, PROJECTORS, SNAPSHOT_LIMITS, ZONE_SETTING_IDS, ZONE_SINGLE_KINDS, assembleSnapshot, collectionFailedResult, httpErrorResult, projectAccount, projectZones, projectionToResult, serializeSnapshot, } from './contract.js';
|
|
11
11
|
import { ENV_TOKEN_PERMISSION_HINT, LocalCheckupError } from './errors.js';
|
|
12
12
|
import { snapshotParseError } from './snapshot-file.js';
|
|
13
13
|
import { TEMPLATES, buildArgv } from './cf/allowlist.js';
|
|
@@ -113,7 +113,7 @@ export async function listAccounts(env) {
|
|
|
113
113
|
}
|
|
114
114
|
/** Requests for N zones: about 19 + extra pages + N × (33 + rulesets per zone). */
|
|
115
115
|
export function estimateRequests(zoneCount, rulesetsPerZone = ESTIMATED_RULESETS_PER_ZONE) {
|
|
116
|
-
return 19 + zoneCount * (33 + rulesetsPerZone);
|
|
116
|
+
return 19 + zoneCount * (33 + OPTIONAL_ZONE_KINDS.length * 2 + rulesetsPerZone);
|
|
117
117
|
}
|
|
118
118
|
/** A worker pool whose tasks may enqueue more tasks (ruleset details). */
|
|
119
119
|
async function runTasks(seed, concurrency, onError) {
|
|
@@ -219,7 +219,7 @@ export async function collectAccount(env, accountId, hooks = {}) {
|
|
|
219
219
|
report();
|
|
220
220
|
};
|
|
221
221
|
const projectInto = async (kind, taskIds) => {
|
|
222
|
-
const outcome = await fetchRaw(env, kind, taskIds);
|
|
222
|
+
const outcome = await fetchRaw(env, kind, taskIds, { maxItems: SNAPSHOT_LIMITS.maxListItems });
|
|
223
223
|
if (!outcome.ok)
|
|
224
224
|
return outcome.result;
|
|
225
225
|
const project = PROJECTORS[kind];
|
|
@@ -236,14 +236,14 @@ export async function collectAccount(env, accountId, hooks = {}) {
|
|
|
236
236
|
}
|
|
237
237
|
for (const zone of zones) {
|
|
238
238
|
const zoneIds = { accountId, zoneId: zone.id };
|
|
239
|
-
zoneTasksLeft.set(zone.id, ZONE_SETTING_IDS.length + ZONE_SINGLE_KINDS.length);
|
|
239
|
+
zoneTasksLeft.set(zone.id, ZONE_SETTING_IDS.length + ZONE_SINGLE_KINDS.length + OPTIONAL_ZONE_KINDS.length);
|
|
240
240
|
for (const settingId of ZONE_SETTING_IDS) {
|
|
241
241
|
enqueue(async () => {
|
|
242
242
|
entries.push({ kind: 'zone_setting', zoneId: zone.id, settingId, result: await projectInto('zone_setting', { ...zoneIds, settingId }) });
|
|
243
243
|
finishZoneTask(zone.id);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
for (const kind of ZONE_SINGLE_KINDS) {
|
|
246
|
+
for (const kind of [...ZONE_SINGLE_KINDS, ...OPTIONAL_ZONE_KINDS]) {
|
|
247
247
|
enqueue(async (more) => {
|
|
248
248
|
const result = await projectInto(kind, zoneIds);
|
|
249
249
|
entries.push({ kind, zoneId: zone.id, result });
|