@knowttl/tenable-axi 0.1.2 → 0.1.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/README.md CHANGED
@@ -45,7 +45,7 @@ tenable-axi asset list --profile example --limit 10
45
45
  tenable-axi finding list --profile example --filter 'severity = ["HIGH"]'
46
46
  ```
47
47
 
48
- `auth status` is local; `doctor` makes one bounded tag-properties read and does not prove other module permissions.
48
+ `auth status` is local; `doctor` makes one bounded read per module and reports each module's access separately.
49
49
  Configured home reads up to five live exposure cards; unconfigured home stays offline.
50
50
  Only `https://cloud.tenable.com` is supported.
51
51
  Upstream licensing and the user's per-operation permissions still apply.
@@ -130,8 +130,8 @@ Bare `--version`, `-v` and `-V` print only the package version.
130
130
  | `tenable-axi combination show` | show combination |
131
131
  | `tenable-axi combination update` | Preview or update combination |
132
132
  | `tenable-axi config path` | Show selected config and state paths without reading files |
133
- | `tenable-axi connector logs` | Read connector sync logs; the API has no server paging parameters |
134
- | `tenable-axi doctor` | Check local security and one tag-properties read without retries |
133
+ | `tenable-axi connector logs` | Read connector sync logs with sync identity, trigger, first FAILED stage and first ERROR summary (falling back to text); the API has no server paging parameters |
134
+ | `tenable-axi doctor` | Check local security and read access to assets, findings, software, attack paths, attack techniques, initiatives, export jobs and connector logs without retries |
135
135
  | `tenable-axi export asset jobs` | List recent inventory asset export jobs |
136
136
  | `tenable-axi export asset start` | Preview or create an inventory asset export job |
137
137
  | `tenable-axi export attack download` | Download an attack export to a new file, redacting JSON/CSV within 128 MiB |
@@ -146,6 +146,7 @@ Bare `--version`, `-v` and `-V` print only the package version.
146
146
  | `tenable-axi finding list` | Search findings |
147
147
  | `tenable-axi finding properties` | Discover finding properties and supported operators |
148
148
  | `tenable-axi finding show` | Find one finding by exact ID search |
149
+ | `tenable-axi finding summary` | Count findings by each published severity and sensor_type value using limit-1 searches; no per-asset grouping |
149
150
  | `tenable-axi home` | Show profile state and up to five live exposure cards |
150
151
  | `tenable-axi hook` | Show compact local profile context without resolving secrets or HTTP |
151
152
  | `tenable-axi initiative create` | Preview or create initiative |
@@ -243,17 +244,28 @@ Files are validated as JSON or CSV, scanned for secrets, redacted and published
243
244
  Inventory JSON chunks must contain arrays of objects.
244
245
  See [download bounds](docs/design.md#collections-jobs-and-bounded-reads) for file size and decompression limits.
245
246
 
246
- Use `asset list/show/properties`, `finding list/show/properties`, and `software list/properties` with `--help` for their flags and examples.
247
+ Use `asset list/show/properties`, `finding list/show/properties/summary`, and `software list/properties` with `--help` for their flags and examples.
247
248
  Lists default to 100 rows, expose upstream totals when supplied, and return a cursor when more rows remain.
248
249
  `--all` remains bounded by 10,000 rows and the shared transport budgets; resume with the returned `--cursor` and original selectors, filters, sort, and fields.
249
250
  Offset paging does not provide snapshot isolation.
250
- `--fields` selects display or wire properties and automatically requests extra properties; `--full` removes the 1,000-character text preview while retaining invocation bounds.
251
+ `--fields` selects display or wire properties and automatically requests extra properties; `--full` removes the 1,000-character text preview without adding fields or rows or changing invocation bounds.
251
252
  For inventory reads and `tag list`, `--extra-properties` also adds the requested properties to the output, even when omitted from `--fields`.
253
+ Absent selected inventory properties render as `null`; present malformed values still fail validation.
254
+ Inventory sort accepts display aliases such as `name`, `class` and `exposureScore` and maps them to each kind's documented sortable keys.
255
+ Unknown sort names return the valid choices before making a request.
256
+ `asset show` includes FQDNs and last-observed time; `finding show` includes asset ID, CVEs and sensor type, and `finding list` includes sensor type.
257
+ `finding summary` counts each severity and sensor type published in the pinned properties examples, including deprecated sensor types, using 19 sequential limit-1 searches and `pagination.total` without retries.
258
+ It accepts profile/config selection, does no per-host grouping, and retains completed counts with `complete: false` if a read fails or the unchanged invocation budget runs out.
259
+ Missing `pagination.total` fails validation rather than inventing a count.
260
+ These counts are independent reads rather than a snapshot, and sensor values can overlap; their sum is not a distinct finding total.
252
261
  Simple filters use `--filter 'severity = ["HIGH"]'`; `--filter-file` accepts a flat JSON array of `{property, operator, value: string[]}` and rejects nested boolean expressions.
253
262
  Software defaults to name, version, and publisher because the pinned API exposes no stable software ID.
254
263
 
255
- `doctor` validates local configuration and file security, then performs exactly one tag-properties read without retries.
256
- It checks `EXPOSURE_MANAGEMENT.TAG.TAG.READ`, without claiming access to other modules.
264
+ `doctor` validates local configuration and file security, then performs one read each for assets, findings, software, attack paths, attack techniques, initiatives, export jobs and connector logs without retries or writes.
265
+ Each check reports `ok`, `permission-denied` for HTTP 403 with its privilege advice, or `error`; any unsuccessful check exits nonzero while the other modules are still checked within the existing budgets.
266
+ Probes use minimum documented page sizes; initiatives and connector logs have no server paging, so their collection reads remain bounded by the shared byte and deadline limits.
267
+ `connector logs` includes sync UUID, type, trigger reason, first failed stage name and first ERROR message, preferring summarized text over full text.
268
+ Failure details are `null` when no matching stage or log exists, and error text follows the same redaction, preview and `--full` behavior as other text.
257
269
  Collections expose returned count, upstream total when known, completeness and a scoped resume cursor.
258
270
  Card lists and home accept upstream pages of up to 25 cards even when fewer are requested, emit only the requested limit, and preserve overflow in a scoped, redacted cursor bounded at 64 KiB.
259
271
  Pages above 25 cards or cursors above this bound fail validation rather than dropping cards.
@@ -63,9 +63,9 @@ export const attackCatalogue = {
63
63
  "attack-technique list": { description: "Search top attack techniques; affectedAssets counts assets_ids", operationId: "apa-attack-techniques-search",
64
64
  flags: { ...common, ...search }, defaultFields: ["id", "name", "affectedAssets"],
65
65
  examples: ["tenable-axi attack-technique list --limit 20", "tenable-axi attack-technique list --sort priority:desc --include-resolved"], evidence: "specs/exposure-management.json" },
66
- "connector logs": { description: "Read connector sync logs; the API has no server paging parameters", operationId: "connectors-logs",
66
+ "connector logs": { description: "Read connector sync logs with sync identity, trigger, first FAILED stage and first ERROR summary (falling back to text); the API has no server paging parameters", operationId: "connectors-logs",
67
67
  flags: { ...common, "connector-id": "Nonnegative numeric connector ID", status: "SUCCEEDED|FAILED",
68
68
  "start-date": "Inclusive YYYY-MM-DD; requires --end-date", "end-date": "Exclusive YYYY-MM-DD; requires --start-date" },
69
- defaultFields: ["connectorId", "status", "timestamp"], examples: ["tenable-axi connector logs --connector-id 1 --limit 20",
69
+ defaultFields: ["connectorId", "status", "timestamp", "syncUuid", "type", "triggerReason", "failedStage", "error"], examples: ["tenable-axi connector logs --connector-id 1 --limit 20",
70
70
  "tenable-axi connector logs --status FAILED --start-date 2026-01-01 --end-date 2026-02-01"], evidence: "specs/exposure-management.json" },
71
71
  };
@@ -78,7 +78,8 @@ export async function attackCommand(argv, store, transportFactory = createTransp
78
78
  if (fields.some((field) => !/^[A-Za-z][A-Za-z0-9_]*$/.test(field)) || new Set(fields).size !== fields.length)
79
79
  usage("Fields must be unique comma-separated names");
80
80
  const schemas = logs ? logFields : technique ? techniqueFields : attackFields;
81
- const aliases = logs ? { connectorId: "connector_id", timestamp: "sync_timestamp" }
81
+ const aliases = logs ? { connectorId: "connector_id", timestamp: "sync_timestamp", syncUuid: "sync_uuid",
82
+ triggerReason: "trigger_reason", failedStage: "sync_stages_info", error: "sync_logs" }
82
83
  : technique ? { id: "serial_id", affectedAssets: "assets_ids" } : { id: "vector_id" };
83
84
  const wire = (field) => aliases[field] ?? field;
84
85
  if (fields.some((field) => !Object.hasOwn(schemas, wire(field))))
@@ -193,10 +194,20 @@ export async function attackCommand(argv, store, transportFactory = createTransp
193
194
  };
194
195
  const project = (row) => Object.fromEntries(fields.map((field) => {
195
196
  let value = row[wire(field)];
197
+ if (logs && ["failedStage", "error"].includes(field) && value === undefined)
198
+ return [field, null];
196
199
  if (value === undefined || !schemas[wire(field)].safeParse(value).success)
197
200
  invalid(`Missing or malformed selected field: ${field}`);
198
201
  if (logs && field === "timestamp")
199
202
  value = value.start;
203
+ if (logs && field === "failedStage")
204
+ value = value.find((stage) => stage.status === "FAILED")?.name ?? null;
205
+ if (logs && field === "error") {
206
+ const entry = value.find((entry) => entry.level === "ERROR");
207
+ value = entry?.summarized_text ?? entry?.text ?? null;
208
+ }
209
+ if (logs && ["failedStage", "error"].includes(field) && value !== null && typeof value !== "string")
210
+ invalid(`Malformed selected field: ${field}`);
200
211
  if (technique && field === "affectedAssets")
201
212
  value = value.length;
202
213
  return [field, preview(store.redactor.payload(value))];
@@ -53,7 +53,7 @@ function exposureCatalogue() {
53
53
  "card show": { description: "Show an exposure card and its scores, trends and SLA details", flags: { ...common, id: "Required card ID", "trend-start-date": "UTC ISO timestamp", "trend-end-date": "UTC ISO timestamp", "sla-efficiency-start-date": "UTC ISO timestamp", "sla-efficiency-end-date": "UTC ISO timestamp", "sla-breakdown-filter": "ANY, REMEDIATED or NON_REMEDIATED; default ANY", "include-trend-events": "true or false; default false" }, examples: ["tenable-axi card show --id <id>", "tenable-axi card show --id <id> --include-trend-events true"] },
54
54
  "tag list": { description: "Search Exposure Management tags", flags: { ...common, ...paging, query: "Simple text search", filter: "Repeatable: property operator JSON-array-of-strings", "filter-file": "Strict documented tag filter array; incompatible with --filter", sort: "property:asc or property:desc", "extra-properties": "Comma-separated property names" }, examples: ["tenable-axi tag list", "tenable-axi tag list --query production --limit 10"] },
55
55
  "tag properties": { description: "List available tag properties and operators", flags: common, examples: ["tenable-axi tag properties", "tenable-axi tag properties --fields property,operators"] },
56
- doctor: { description: "Check local security and one tag-properties read without retries", flags: common, examples: ["tenable-axi doctor", "tenable-axi doctor --profile example"] },
56
+ doctor: { description: "Check local security and read access to assets, findings, software, attack paths, attack techniques, initiatives, export jobs and connector logs without retries", flags: common, examples: ["tenable-axi doctor", "tenable-axi doctor --profile example"] },
57
57
  hook: { description: "Show compact local profile context without resolving secrets or HTTP", flags: common, examples: ["tenable-axi hook", "tenable-axi hook --profile example"] },
58
58
  };
59
59
  }
@@ -2,8 +2,8 @@ import { AxiError } from "axi-sdk-js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { closeSync, openSync, readSync } from "node:fs";
4
4
  import { z } from "zod";
5
- import { catalogue, DESCRIPTION, SETUP_GUIDANCE } from "./catalogue.js";
6
- import { cardDetails, cardRecord, properties, tagRecord, TAG_PRIVILEGE } from "./exposure-contracts.js";
5
+ import { catalogue, DESCRIPTION, SETUP_GUIDANCE, transportBindings } from "./catalogue.js";
6
+ import { cardDetails, cardRecord, properties, tagRecord } from "./exposure-contracts.js";
7
7
  import { createTransport, TransportError } from "./transport.js";
8
8
  const operators = ["=", "!=", "<=", "between", "match", ">=", "<", ">", "contains", "not contains", "exists", "not exists", "older than", "newer than", "within last"];
9
9
  const filterSchema = z.array(z.strictObject({ property: z.string().min(1), operator: z.enum(operators), value: z.array(z.string()) }));
@@ -61,7 +61,7 @@ export async function exposureCommand(argv, store, factory = createTransport) {
61
61
  const displayArgs = argv.map((arg, index) => name === "home" && argv[index - 1] === "--config" ? "<config>" : arg);
62
62
  const fullCommand = `tenable-axi ${displayArgs.map(quote).join(" ")} --full`;
63
63
  const defaults = name === "tag list" ? ["id", "category", "value"] : name === "tag properties" ? ["property", "operators"]
64
- : name === "doctor" ? ["profile", "origin", "readOnly", "check", "status", "scope"]
64
+ : name === "doctor" ? ["profile", "origin", "readOnly", "status", "checks"]
65
65
  : name === "hook" ? ["profile", "origin", "readOnly"] : name === "card show" ? ["id", "name", "score", "ces_scores", "ces_trend", "exposure_classes_details"] : ["id", "name", "score"];
66
66
  const available = name === "tag list" ? tagFields : name === "tag properties" ? propertyFields : name === "card show" ? detailFields
67
67
  : ["doctor", "hook"].includes(name) ? defaults : cardFields;
@@ -220,15 +220,34 @@ export async function exposureCommand(argv, store, factory = createTransport) {
220
220
  const keys = store.credentials(profile, name === "doctor");
221
221
  const transport = factory({ keys, origin: profile.origin });
222
222
  if (name === "doctor") {
223
- try {
224
- await transport.request("inventory-tag-properties-list", { retry: false });
225
- }
226
- catch (error) {
227
- if (error instanceof TransportError && error.error.status === 401)
228
- throw new TransportError(error.error, [...error.help, `This check requires ${TAG_PRIVILEGE}; authentication failure does not establish module access`]);
229
- throw error;
223
+ const probes = [
224
+ { module: "assets", operation: "inventory-assets-search", query: { offset: 0, limit: 1 }, body: {} },
225
+ { module: "findings", operation: "inventory-findings-search", query: { offset: 0, limit: 1 }, body: {} },
226
+ { module: "software", operation: "inventory-software-search", query: { offset: 0, limit: 1 }, body: {} },
227
+ { module: "attack-paths", operation: "apa-attack-paths-search", query: { offset: 0, limit: 100, exclude_resolved: true, run_ai_summarization: "false" } },
228
+ { module: "attack-techniques", operation: "apa-attack-techniques-search", query: { offset: 0, limit: 100, exclude_resolved: true } },
229
+ { module: "initiatives", operation: "initiatives-list" },
230
+ { module: "export-jobs", operation: "inventory-export-assets-jobs", query: { limit: 1 } },
231
+ { module: "connector-logs", operation: "connectors-logs" },
232
+ ];
233
+ const checks = [];
234
+ for (const probe of probes) {
235
+ const check = { module: probe.module, operation: probe.operation, privilege: transportBindings[probe.operation].permissionHelp };
236
+ try {
237
+ await transport.request(probe.operation, { ...(probe.query ? { query: probe.query } : {}),
238
+ ...("body" in probe ? { body: probe.body } : {}), retry: false });
239
+ checks.push({ ...check, status: "ok" });
240
+ }
241
+ catch (error) {
242
+ if (!(error instanceof TransportError))
243
+ throw error;
244
+ checks.push({ ...check, status: error.error.status === 403 ? "permission-denied" : "error", error: error.error });
245
+ }
230
246
  }
231
- return select({ ...context, check: "inventory-tag-properties-list", status: "ok", scope: `Verified one tag-properties read (${TAG_PRIVILEGE}); other modules are untested` });
247
+ const ok = checks.every((check) => check.status === "ok");
248
+ if (!ok)
249
+ process.exitCode = 1;
250
+ return select({ ...context, status: ok ? "ok" : "error", checks });
232
251
  }
233
252
  const truncated = [];
234
253
  function preview(value, path) {
@@ -11,8 +11,15 @@ export declare const defaultFields: {
11
11
  finding: string[];
12
12
  software: string[];
13
13
  };
14
+ export declare const sortAliases: Record<InventoryKind, Record<string, string>>;
15
+ export declare const sortableFields: Record<InventoryKind, string[]>;
16
+ export declare const findingCountValues: {
17
+ severity: string[];
18
+ sensor_type: string[];
19
+ };
14
20
  export declare const aliases: Record<InventoryKind, Record<string, string>>;
15
21
  export declare const wireFields: Record<InventoryKind, Record<string, z.ZodType>>;
22
+ export declare const extraFields: Record<InventoryKind, Record<string, z.ZodType>>;
16
23
  export declare const propertyFields: Record<string, z.ZodType>;
17
24
  export declare const assetClasses: readonly ["ACCOUNT", "APPLICATION", "CONTAINER", "DEVICE", "GENERAL", "GROUP", "IAC", "IDENTITY", "RESOURCE", "ROLE", "STORAGE", "UNKNOWN"];
18
25
  export declare const filterSchema: z.ZodObject<{
@@ -1,7 +1,31 @@
1
1
  import { z } from "zod";
2
2
  export const inventoryKinds = { asset: "assets", finding: "findings", software: "software" };
3
- export const defaultFields = { asset: ["id", "name", "class", "exposureScore"], finding: ["id", "name", "severity", "state"],
3
+ export const defaultFields = { asset: ["id", "name", "class", "exposureScore"], finding: ["id", "name", "severity", "state", "sensor_type"],
4
4
  software: ["name", "version", "publisher"] };
5
+ const showFields = { asset: [...defaultFields.asset, "fqdns", "last_observed_at"],
6
+ finding: [...defaultFields.finding, "asset_id", "cves"], software: defaultFields.software };
7
+ export const sortAliases = {
8
+ asset: { id: "asset_id", name: "asset_name", class: "asset_class", exposureScore: "aes" },
9
+ finding: { id: "finding_id", name: "finding_name" }, software: { name: "application" },
10
+ };
11
+ // Sortable keys and count values come from the pinned properties-route examples.
12
+ export const sortableFields = {
13
+ asset: ["asset_id", "asset_class", "last_updated", "asset_name", "sources", "created_at", "first_observed_at", "last_observed_at",
14
+ "last_licensed_at", "fqdns", "aes", "critical_vuln_count", "high_vuln_count", "low_vuln_count", "is_licensed", "exposure_classes",
15
+ "tenable_uuid", "license_expires_at", "sensors", "critical_weakness_count", "high_weakness_count", "medium_weakness_count",
16
+ "low_weakness_count", "total_weakness_count", "tag_count", "entitlement_count"],
17
+ finding: ["finding_id", "state", "last_updated", "first_observed_at", "last_observed_at", "port", "protocol", "detection_id",
18
+ "finding_name", "solution", "severity", "vpr_score", "cves", "asset_id", "asset_name", "asset_class", "apa_total_steps_count",
19
+ "apa_low_steps_count", "apa_medium_steps_count", "apa_high_steps_count", "apa_critical_steps_count", "sensor_type"],
20
+ software: ["cpe", "publisher", "application", "version", "software_update", "edition", "software_edition", "target_software",
21
+ "target_hardware", "software_language", "software_other", "display_publisher", "display_application", "file_location",
22
+ "port_binding_count", "ports", "protocols", "last_seen_version", "eol_date", "devices_count", "version_count", "cpe_count",
23
+ "file_location_count", "type", "asset_sources", "last_seen", "first_seen", "category_names"],
24
+ };
25
+ export const findingCountValues = {
26
+ severity: ["Info", "Low", "Medium", "High", "Critical"],
27
+ sensor_type: ["ACCURICS", "INVENTORY", "RAPID_7", "SECURITY_CENTER", "CARBON_BLACK", "TVDB", "AWS", "OT", "CONSEC", "WAS", "ASM", "NESSUS", "CLOUD_SCAN", "TIE"],
28
+ };
5
29
  export const aliases = {
6
30
  asset: { class: "asset_class", exposureScore: "aes" }, finding: {}, software: { name: "application" },
7
31
  };
@@ -10,6 +34,11 @@ export const wireFields = {
10
34
  finding: { id: z.string(), name: z.string(), severity: z.string(), state: z.string(), asset_id: z.string() },
11
35
  software: { application: z.string(), publisher: z.string(), type: z.array(z.string()), devices_count: z.number().int().nonnegative() },
12
36
  };
37
+ export const extraFields = {
38
+ asset: { fqdns: z.array(z.string()), last_observed_at: z.string() },
39
+ finding: { cves: z.array(z.string()), sensor_type: z.string(), last_observed_at: z.string() },
40
+ software: {},
41
+ };
13
42
  export const propertyFields = { key: z.string(), readable_name: z.string(), operators: z.array(z.string()),
14
43
  sortable: z.boolean(), filterable: z.boolean(), control: z.record(z.string(), z.unknown()), description: z.string() };
15
44
  export const assetClasses = ["ACCOUNT", "APPLICATION", "CONTAINER", "DEVICE", "GENERAL", "GROUP", "IAC", "IDENTITY", "RESOURCE", "ROLE", "STORAGE", "UNKNOWN"];
@@ -43,15 +72,22 @@ export const filterExamples = {
43
72
  asset: 'asset_class = ["DEVICE"]', finding: 'severity = ["HIGH"]', software: 'application = ["example-app"]',
44
73
  };
45
74
  const common = (fields) => ({ config: "Config path; default credential precedence", profile: "Profile name; default credential precedence",
46
- fields, full: "Show full text; default false", help: "Show help" });
47
- const listFields = (kind) => `Comma-separated display or wire properties; display names: ${defaultFields[kind].join(", ")}; default compact view`;
75
+ fields, full: "Show untruncated text; does not add fields or rows; default false", help: "Show help" });
76
+ const listFields = (kind, fields = defaultFields[kind]) => `Comma-separated display or wire properties; display names: ${fields.join(", ")}; default compact view`;
48
77
  const propertyFieldsHelp = `Comma-separated output fields; accepted: ${Object.keys(propertyFields).join(", ")}; default compact view`;
49
78
  const collection = { limit: "Maximum emitted rows, 1-10000; default 100", all: "Read up to 10000 rows within invocation budgets; excludes --limit",
50
79
  cursor: "Opaque resume cursor; retain the original selectors and filters" };
51
80
  const search = { query: "Simple query text", filter: "Repeatable: <property> <operator> <JSON string array>",
52
81
  "filter-file": "JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter",
53
- sort: "Wire property:asc|desc", "extra-properties": "Comma-separated extra wire properties", offset: "Starting record; default 0; excludes --cursor" };
82
+ sort: "Sortable display or wire property:asc|desc; unknown names report valid choices", "extra-properties": "Comma-separated extra wire properties", offset: "Starting record; default 0; excludes --cursor" };
54
83
  export const inventoryCatalogue = Object.fromEntries(Object.keys(inventoryKinds).flatMap((kind) => [
84
+ ...(kind !== "finding" ? [] : [["finding summary", {
85
+ description: "Count findings by each published severity and sensor_type value using limit-1 searches; no per-asset grouping",
86
+ operationId: "inventory-findings-search", defaultFields: [], evidence: "specs/exposure-management.json",
87
+ flags: { config: "Config path; default credential precedence", profile: "Profile name; default credential precedence",
88
+ help: "Show help" },
89
+ examples: ["tenable-axi finding summary"],
90
+ }]]),
55
91
  [`${kind} list`, { description: `Search ${inventoryKinds[kind]}${kind === "software" ? "; the pinned API exposes no stable software ID" : ""}`,
56
92
  operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
57
93
  flags: { ...common(listFields(kind)), ...collection, ...search,
@@ -66,7 +102,7 @@ export const inventoryCatalogue = Object.fromEntries(Object.keys(inventoryKinds)
66
102
  flags: { ...common(propertyFieldsHelp), ...collection, ...(kind === "asset" ? { "asset-classes": "Comma-separated documented asset classes" } : {}) },
67
103
  examples: [`tenable-axi ${kind} properties`, `tenable-axi ${kind} properties --full`] }],
68
104
  ...(kind === "software" ? [] : [[`${kind} show`, { description: `Find one ${kind} by exact ID search`,
69
- operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
70
- flags: { ...common(listFields(kind)), id: "Required exact inventory ID", "extra-properties": search["extra-properties"] },
105
+ operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: showFields[kind], evidence: "specs/exposure-management.json",
106
+ flags: { ...common(listFields(kind, showFields[kind])), id: "Required exact inventory ID", "extra-properties": search["extra-properties"] },
71
107
  examples: [`tenable-axi ${kind} show --id <id>`, `tenable-axi ${kind} show --id <id> --fields id,name,description --full`] }]]),
72
108
  ]));
@@ -2,7 +2,7 @@ import { AxiError } from "axi-sdk-js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { closeSync, openSync, readSync } from "node:fs";
4
4
  import { z } from "zod";
5
- import { aliases, assetClasses, filterExamples, filterSchema, inventoryCatalogue, inventoryKinds, inventoryPage, propertyFields, wireFields } from "./inventory-catalogue.js";
5
+ import { aliases, assetClasses, extraFields, filterExamples, filterSchema, findingCountValues, inventoryCatalogue, inventoryKinds, inventoryPage, propertyFields, sortAliases, sortableFields, wireFields } from "./inventory-catalogue.js";
6
6
  import { createTransport, TransportError } from "./transport.js";
7
7
  const integer = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
8
8
  const cursorSchema = z.strictObject({ version: z.literal(1), scope: z.string(), offset: integer,
@@ -36,7 +36,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
36
36
  const usage = (message) => {
37
37
  throw new AxiError(message, "VALIDATION_ERROR", [
38
38
  entry ? `Valid flags for ${name}: ${Object.keys(entry.flags).map((flag) => `--${flag}`).join(", ")}`
39
- : "Valid commands: asset list/show/properties, finding list/show/properties, software list/properties",
39
+ : "Valid commands: asset list/show/properties, finding list/show/properties/summary, software list/properties",
40
40
  ]);
41
41
  };
42
42
  if (!entry)
@@ -55,7 +55,8 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
55
55
  flags.set(flag, [...(flags.get(flag) ?? []), value]);
56
56
  }
57
57
  const get = (flag) => flags.get(`--${flag}`)?.[0];
58
- const command = (exclude = []) => ["tenable-axi", name, ...[...flags].flatMap(([flag, values]) => exclude.includes(flag) ? [] : values.flatMap((value) => [flag, ...(["--all", "--full", "--help"].includes(flag) ? [] : [JSON.stringify(value)])]))].join(" ");
58
+ const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
59
+ const command = (exclude = []) => ["tenable-axi", name, ...[...flags].flatMap(([flag, values]) => exclude.includes(flag) ? [] : values.flatMap((value) => [flag, ...(["--all", "--full", "--help"].includes(flag) ? [] : [quote(value)])]))].join(" ");
59
60
  if (get("help"))
60
61
  return { command: name, description: entry.description, flags: entry.flags,
61
62
  defaultFields: entry.defaultFields, examples: entry.examples };
@@ -101,9 +102,16 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
101
102
  if (!fields.includes(extra) && !projection.some(([, wire]) => wire === extra))
102
103
  projection.push([extra, extra]);
103
104
  }
104
- const sort = get("sort");
105
+ let sort = get("sort");
105
106
  if (sort !== undefined && !/^[A-Za-z0-9_]+:(asc|desc)$/.test(sort))
106
107
  usage("--sort must be property:asc or property:desc");
108
+ if (sort !== undefined) {
109
+ const [field, direction] = sort.split(":");
110
+ const wire = sortAliases[kind][field] ?? field;
111
+ if (!sortableFields[kind].includes(wire))
112
+ usage(`Sortable properties: ${[...Object.keys(sortAliases[kind]), ...sortableFields[kind]].join(", ")}`);
113
+ sort = `${wire}:${direction}`;
114
+ }
107
115
  const classes = get("asset-classes") ? names(get("asset-classes")) : get("class") ? [get("class")] : [];
108
116
  if (classes.some((value) => !assetClasses.includes(value)))
109
117
  usage(`Asset classes: ${assetClasses.join(", ")}`);
@@ -171,6 +179,26 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
171
179
  if (cursor && cursor.scope !== scope)
172
180
  usage("Cursor belongs to a different profile, operation, filters, sort, or fields");
173
181
  const transport = transportFactory({ origin: profile.origin, keys: store.credentials(profile) });
182
+ if (verb === "summary") {
183
+ const counts = { severity: [], sensor_type: [] };
184
+ try {
185
+ for (const [property, values] of Object.entries(findingCountValues))
186
+ for (const value of values) {
187
+ const response = await transport.request(operation, { query: { offset: 0, limit: 1 }, retry: false,
188
+ body: { filters: [{ property, operator: "=", value: [value] }] } });
189
+ const page = inventoryPage.parse(response.body);
190
+ if (page.pagination?.total === undefined)
191
+ throw new TransportError({ code: "RESPONSE_INVALID", message: "Finding count response is missing pagination.total", operation });
192
+ counts[property].push({ value, total: page.pagination.total });
193
+ }
194
+ }
195
+ catch (error) {
196
+ if (!(error instanceof TransportError))
197
+ throw error;
198
+ return { ...counts, complete: false, ...error.toJSON() };
199
+ }
200
+ return { ...counts, complete: true };
201
+ }
174
202
  offset = cursor?.offset ?? offset;
175
203
  let skip = cursor?.skip ?? 0;
176
204
  let total = cursor?.total ?? null;
@@ -192,16 +220,22 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
192
220
  return value;
193
221
  };
194
222
  const invalid = (message) => { throw new TransportError({ code: "RESPONSE_INVALID", message, operation }); };
195
- const project = (row) => Object.fromEntries(projection.map(([field, wire]) => {
196
- const native = verb === "properties" || Object.hasOwn(wireFields[kind], wire);
223
+ const project = (row) => {
197
224
  const extra = z.record(z.string(), z.unknown()).safeParse(row.extra_properties);
198
- const value = native ? row[wire] : extra.success ? extra.data[wire] : undefined;
199
- const schema = verb === "properties" ? propertyFields[field] : wireFields[kind][wire] ??
200
- (field === "version" || field === "description" ? z.string() : z.json());
201
- if (value === undefined || !schema.safeParse(value).success)
202
- invalid(`Missing or malformed selected property: ${field}`);
203
- return [field, preview(store.redactor.payload(value))];
204
- }));
225
+ return Object.fromEntries(projection.map(([field, wire]) => {
226
+ const native = verb === "properties" || Object.hasOwn(wireFields[kind], wire);
227
+ if (!native && row.extra_properties !== undefined && !extra.success)
228
+ invalid("Malformed extra_properties container");
229
+ const value = native ? row[wire] : extra.success ? extra.data[wire] : undefined;
230
+ const schema = verb === "properties" ? propertyFields[field] : wireFields[kind][wire] ?? extraFields[kind][wire] ??
231
+ (field === "version" || field === "description" ? z.string() : z.json());
232
+ if (value === undefined)
233
+ return [field, null];
234
+ if (!schema.safeParse(value).success)
235
+ invalid(`Malformed selected property: ${field}`);
236
+ return [field, preview(store.redactor.payload(value))];
237
+ }));
238
+ };
205
239
  const seen = new Set();
206
240
  try {
207
241
  while (rows.length < (verb === "show" ? 2 : rowLimit)) {
@@ -273,7 +307,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
273
307
  return { [kind]: rows[0], ...(truncated ? { help: [`Run ${command(["--full"])} --full to read complete text`] } : {}) };
274
308
  }
275
309
  const help = [];
276
- const selectors = [get("config") ? `--config ${JSON.stringify(get("config"))}` : "", get("profile") ? `--profile ${get("profile")}` : ""].filter(Boolean).join(" ");
310
+ const selectors = [get("config") ? `--config ${quote(get("config"))}` : "", get("profile") ? `--profile ${quote(get("profile"))}` : ""].filter(Boolean).join(" ");
277
311
  if (verb === "list")
278
312
  help.push(`Run tenable-axi ${kind} properties ${selectors}`.trim());
279
313
  if (verb === "list" && kind !== "software")
package/docs/commands.md CHANGED
@@ -17,7 +17,7 @@ Operation: `inventory-assets-search`.
17
17
  | `--config` | Config path; default credential precedence |
18
18
  | `--profile` | Profile name; default credential precedence |
19
19
  | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore; default compact view |
20
- | `--full` | Show full text; default false |
20
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
21
21
  | `--help` | Show help |
22
22
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
23
23
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -25,7 +25,7 @@ Operation: `inventory-assets-search`.
25
25
  | `--query` | Simple query text |
26
26
  | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. asset_class = ["DEVICE"] |
27
27
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
28
- | `--sort` | Wire property:asc\|desc |
28
+ | `--sort` | Sortable display or wire property:asc\|desc; unknown names report valid choices |
29
29
  | `--extra-properties` | Comma-separated extra wire properties |
30
30
  | `--offset` | Starting record; default 0; excludes --cursor |
31
31
  | `--class` | Server-side asset class filter |
@@ -47,7 +47,7 @@ Operation: `inventory-asset-properties-list`.
47
47
  | `--config` | Config path; default credential precedence |
48
48
  | `--profile` | Profile name; default credential precedence |
49
49
  | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
50
- | `--full` | Show full text; default false |
50
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
51
51
  | `--help` | Show help |
52
52
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
53
53
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -69,8 +69,8 @@ Operation: `inventory-assets-search`.
69
69
  |---|---|
70
70
  | `--config` | Config path; default credential precedence |
71
71
  | `--profile` | Profile name; default credential precedence |
72
- | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore; default compact view |
73
- | `--full` | Show full text; default false |
72
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore, fqdns, last_observed_at; default compact view |
73
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
74
74
  | `--help` | Show help |
75
75
  | `--id` | Required exact inventory ID |
76
76
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -354,7 +354,7 @@ tenable-axi config path --fields config
354
354
 
355
355
  ## connector logs
356
356
 
357
- Read connector sync logs; the API has no server paging parameters
357
+ Read connector sync logs with sync identity, trigger, first FAILED stage and first ERROR summary (falling back to text); the API has no server paging parameters
358
358
 
359
359
  Operation: `connectors-logs`.
360
360
 
@@ -380,7 +380,7 @@ tenable-axi connector logs --status FAILED --start-date 2026-01-01 --end-date 20
380
380
 
381
381
  ## doctor
382
382
 
383
- Check local security and one tag-properties read without retries
383
+ Check local security and read access to assets, findings, software, attack paths, attack techniques, initiatives, export jobs and connector logs without retries
384
384
 
385
385
  | Flag | Meaning |
386
386
  |---|---|
@@ -660,8 +660,8 @@ Operation: `inventory-findings-search`.
660
660
  |---|---|
661
661
  | `--config` | Config path; default credential precedence |
662
662
  | `--profile` | Profile name; default credential precedence |
663
- | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state; default compact view |
664
- | `--full` | Show full text; default false |
663
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state, sensor_type; default compact view |
664
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
665
665
  | `--help` | Show help |
666
666
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
667
667
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -669,7 +669,7 @@ Operation: `inventory-findings-search`.
669
669
  | `--query` | Simple query text |
670
670
  | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. severity = ["HIGH"] |
671
671
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
672
- | `--sort` | Wire property:asc\|desc |
672
+ | `--sort` | Sortable display or wire property:asc\|desc; unknown names report valid choices |
673
673
  | `--extra-properties` | Comma-separated extra wire properties |
674
674
  | `--offset` | Starting record; default 0; excludes --cursor |
675
675
 
@@ -692,7 +692,7 @@ Operation: `inventory-finding-properties-list`.
692
692
  | `--config` | Config path; default credential precedence |
693
693
  | `--profile` | Profile name; default credential precedence |
694
694
  | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
695
- | `--full` | Show full text; default false |
695
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
696
696
  | `--help` | Show help |
697
697
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
698
698
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -713,8 +713,8 @@ Operation: `inventory-findings-search`.
713
713
  |---|---|
714
714
  | `--config` | Config path; default credential precedence |
715
715
  | `--profile` | Profile name; default credential precedence |
716
- | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state; default compact view |
717
- | `--full` | Show full text; default false |
716
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state, sensor_type, asset_id, cves; default compact view |
717
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
718
718
  | `--help` | Show help |
719
719
  | `--id` | Required exact inventory ID |
720
720
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -724,6 +724,22 @@ tenable-axi finding show --id <id>
724
724
  tenable-axi finding show --id <id> --fields id,name,description --full
725
725
  ```
726
726
 
727
+ ## finding summary
728
+
729
+ Count findings by each published severity and sensor_type value using limit-1 searches; no per-asset grouping
730
+
731
+ Operation: `inventory-findings-search`.
732
+
733
+ | Flag | Meaning |
734
+ |---|---|
735
+ | `--config` | Config path; default credential precedence |
736
+ | `--profile` | Profile name; default credential precedence |
737
+ | `--help` | Show help |
738
+
739
+ ```sh
740
+ tenable-axi finding summary
741
+ ```
742
+
727
743
  ## home
728
744
 
729
745
  Show profile state and up to five live exposure cards
@@ -912,7 +928,7 @@ Operation: `inventory-software-search`.
912
928
  | `--config` | Config path; default credential precedence |
913
929
  | `--profile` | Profile name; default credential precedence |
914
930
  | `--fields` | Comma-separated display or wire properties; display names: name, version, publisher; default compact view |
915
- | `--full` | Show full text; default false |
931
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
916
932
  | `--help` | Show help |
917
933
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
918
934
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -920,7 +936,7 @@ Operation: `inventory-software-search`.
920
936
  | `--query` | Simple query text |
921
937
  | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. application = ["example-app"] |
922
938
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
923
- | `--sort` | Wire property:asc\|desc |
939
+ | `--sort` | Sortable display or wire property:asc\|desc; unknown names report valid choices |
924
940
  | `--extra-properties` | Comma-separated extra wire properties |
925
941
  | `--offset` | Starting record; default 0; excludes --cursor |
926
942
 
@@ -941,7 +957,7 @@ Operation: `inventory-software-properties-list`.
941
957
  | `--config` | Config path; default credential precedence |
942
958
  | `--profile` | Profile name; default credential precedence |
943
959
  | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
944
- | `--full` | Show full text; default false |
960
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
945
961
  | `--help` | Show help |
946
962
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
947
963
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowttl/tenable-axi",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Investigate Tenable One exposure and run explicitly guarded writes",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,8 +54,8 @@ See the [command reference](https://github.com/knowttl/tenable-axi/blob/main/doc
54
54
  | `npx -y @knowttl/tenable-axi combination show` | show combination |
55
55
  | `npx -y @knowttl/tenable-axi combination update` | Preview or update combination |
56
56
  | `npx -y @knowttl/tenable-axi config path` | Show selected config and state paths without reading files |
57
- | `npx -y @knowttl/tenable-axi connector logs` | Read connector sync logs; the API has no server paging parameters |
58
- | `npx -y @knowttl/tenable-axi doctor` | Check local security and one tag-properties read without retries |
57
+ | `npx -y @knowttl/tenable-axi connector logs` | Read connector sync logs with sync identity, trigger, first FAILED stage and first ERROR summary (falling back to text); the API has no server paging parameters |
58
+ | `npx -y @knowttl/tenable-axi doctor` | Check local security and read access to assets, findings, software, attack paths, attack techniques, initiatives, export jobs and connector logs without retries |
59
59
  | `npx -y @knowttl/tenable-axi export asset jobs` | List recent inventory asset export jobs |
60
60
  | `npx -y @knowttl/tenable-axi export asset start` | Preview or create an inventory asset export job |
61
61
  | `npx -y @knowttl/tenable-axi export attack download` | Download an attack export to a new file, redacting JSON/CSV within 128 MiB |
@@ -70,6 +70,7 @@ See the [command reference](https://github.com/knowttl/tenable-axi/blob/main/doc
70
70
  | `npx -y @knowttl/tenable-axi finding list` | Search findings |
71
71
  | `npx -y @knowttl/tenable-axi finding properties` | Discover finding properties and supported operators |
72
72
  | `npx -y @knowttl/tenable-axi finding show` | Find one finding by exact ID search |
73
+ | `npx -y @knowttl/tenable-axi finding summary` | Count findings by each published severity and sensor_type value using limit-1 searches; no per-asset grouping |
73
74
  | `npx -y @knowttl/tenable-axi home` | Show profile state and up to five live exposure cards |
74
75
  | `npx -y @knowttl/tenable-axi hook` | Show compact local profile context without resolving secrets or HTTP |
75
76
  | `npx -y @knowttl/tenable-axi initiative create` | Preview or create initiative |