pi-cloudflare 0.11.2 → 0.11.3
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/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "pi-cloudflare",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.3",
|
|
5
5
|
"description": "Cloudflare skills: the official Cloudflare skills library plus cf-first hardening and cf CLI skills. Tools live in the cf CLI, not in this plugin.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "0xPlayerOne",
|
|
@@ -422,6 +422,40 @@ for (const account of accounts) {
|
|
|
422
422
|
auditedAccounts.push(summary)
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Collapse findings that repeat across many zones into one line, so a report
|
|
428
|
+
* about a large estate stays readable. A distinct message still gets its own
|
|
429
|
+
* line — only exact (subject, message) repeats are aggregated.
|
|
430
|
+
*/
|
|
431
|
+
const emit = (label, list) => {
|
|
432
|
+
if (list.length === 0) return
|
|
433
|
+
const collapsed = new Map()
|
|
434
|
+
for (const finding of list) {
|
|
435
|
+
const key = `${finding.subject}\u0000${finding.message}\u0000${finding.action ?? ''}`
|
|
436
|
+
const entry = collapsed.get(key)
|
|
437
|
+
if (entry) {
|
|
438
|
+
entry.scopes.push(finding.scope)
|
|
439
|
+
} else {
|
|
440
|
+
collapsed.set(key, { ...finding, scopes: [finding.scope] })
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
console.log(`${label} (${list.length} across ${new Set(list.map((f) => f.scope)).size} subject(s))`)
|
|
445
|
+
for (const entry of collapsed.values()) {
|
|
446
|
+
if (entry.scopes.length === 1) {
|
|
447
|
+
console.log(` ${entry.scopes[0].padEnd(24)} ${entry.subject.padEnd(32)} ${entry.message}`)
|
|
448
|
+
} else {
|
|
449
|
+
const names = entry.scopes.join(', ')
|
|
450
|
+
const shown = names.length > 90 ? `${names.slice(0, 87)}...` : names
|
|
451
|
+
console.log(` ${`${entry.scopes.length} zones`.padEnd(24)} ${entry.subject.padEnd(32)} ${entry.message}`)
|
|
452
|
+
console.log(` ${''.padEnd(24)} ${shown}`)
|
|
453
|
+
}
|
|
454
|
+
if (entry.action && entry.severity !== 'info') console.log(` ${''.padEnd(24)} → ${entry.action}`)
|
|
455
|
+
}
|
|
456
|
+
console.log('')
|
|
457
|
+
}
|
|
458
|
+
|
|
425
459
|
const report = {
|
|
426
460
|
generatedAt: new Date().toISOString(),
|
|
427
461
|
accounts: auditedAccounts,
|
|
@@ -433,7 +467,7 @@ if (AS_JSON) {
|
|
|
433
467
|
console.log(JSON.stringify(report, null, 2))
|
|
434
468
|
} else {
|
|
435
469
|
const order = { high: 0, medium: 1, gated: 2, blocked: 3, info: 4 }
|
|
436
|
-
const sorted =
|
|
470
|
+
const sorted = findings.toSorted((a, b) => (order[a.severity] ?? 9) - (order[b.severity] ?? 9))
|
|
437
471
|
|
|
438
472
|
console.log(`Cloudflare estate audit — ${accounts.length} account(s), ${zones.length} zone(s)`)
|
|
439
473
|
console.log(`Plans: ${[...new Set(zones.map((z) => z.plan?.name))].join(', ') || 'unknown'}\n`)
|
|
@@ -441,39 +475,6 @@ if (AS_JSON) {
|
|
|
441
475
|
const groups = { high: [], medium: [], gated: [], blocked: [], info: [] }
|
|
442
476
|
for (const finding of sorted) (groups[finding.severity] ?? groups.info).push(finding)
|
|
443
477
|
|
|
444
|
-
/**
|
|
445
|
-
* Collapse findings that repeat across many zones into one line, so a report
|
|
446
|
-
* about a large estate stays readable. A distinct message still gets its own
|
|
447
|
-
* line — only exact (subject, message) repeats are aggregated.
|
|
448
|
-
*/
|
|
449
|
-
const emit = (label, list) => {
|
|
450
|
-
if (list.length === 0) return
|
|
451
|
-
const collapsed = new Map()
|
|
452
|
-
for (const finding of list) {
|
|
453
|
-
const key = `${finding.subject}\u0000${finding.message}\u0000${finding.action ?? ''}`
|
|
454
|
-
const entry = collapsed.get(key)
|
|
455
|
-
if (entry) {
|
|
456
|
-
entry.scopes.push(finding.scope)
|
|
457
|
-
} else {
|
|
458
|
-
collapsed.set(key, { ...finding, scopes: [finding.scope] })
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
console.log(`${label} (${list.length} across ${new Set(list.map((f) => f.scope)).size} subject(s))`)
|
|
463
|
-
for (const entry of collapsed.values()) {
|
|
464
|
-
if (entry.scopes.length === 1) {
|
|
465
|
-
console.log(` ${entry.scopes[0].padEnd(24)} ${entry.subject.padEnd(32)} ${entry.message}`)
|
|
466
|
-
} else {
|
|
467
|
-
const names = entry.scopes.join(', ')
|
|
468
|
-
const shown = names.length > 90 ? `${names.slice(0, 87)}...` : names
|
|
469
|
-
console.log(` ${`${entry.scopes.length} zones`.padEnd(24)} ${entry.subject.padEnd(32)} ${entry.message}`)
|
|
470
|
-
console.log(` ${''.padEnd(24)} ${shown}`)
|
|
471
|
-
}
|
|
472
|
-
if (entry.action && entry.severity !== 'info') console.log(` ${''.padEnd(24)} → ${entry.action}`)
|
|
473
|
-
}
|
|
474
|
-
console.log('')
|
|
475
|
-
}
|
|
476
|
-
|
|
477
478
|
emit('ACTION NEEDED', groups.high)
|
|
478
479
|
emit('WORTH REVIEWING', groups.medium)
|
|
479
480
|
emit('GATED BY PLAN', groups.gated)
|