@knowttl/tenable-axi 0.1.1 → 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 |
@@ -183,14 +184,15 @@ Inventory reads and exports, attack searches and connector logs are implemented.
183
184
  Attack path, attack technique and MITRE heatmap exports support guarded creation, status and redacted file downloads.
184
185
  `tag list`, `tag properties`, `card list` and `card show` provide bounded Exposure Management reads.
185
186
  Platform tag categories, values, assignments, exclusions and dynamic filter definitions are implemented, including guarded mutations.
186
- Home shows up to five exposure cards when configured and setup guidance offline otherwise.
187
+ Home shows up to five exposure cards when configured and setup guidance offline otherwise, without printing the executable path.
187
188
  Exposure response initiatives and combinations support reads and guarded writes, including allowed combination filters.
188
189
  `hook` reports local profile context without resolving secrets or contacting Tenable.
189
190
  Help, version, `auth status`, `profile list` and `config path` remain local.
190
191
 
191
192
  Credentials use the strict versioned config and SecretRefs described in [profiles and authentication](docs/design.md#profiles-and-authentication).
192
193
  Run `tenable-axi config path` to find the platform config path, or set both `TENABLE_AXI_ACCESS_KEY` and `TENABLE_AXI_SECRET_KEY` for an environment profile.
193
- Run `tenable-axi auth status` to check sources and file security locally; it never contacts Tenable or prints key values.
194
+ Run `tenable-axi auth status` to check sources and file security locally without printing key values; `accessKey` and `secretKey` report only `env` or `file`.
195
+ Home and auth status omit environment variable names and private configuration/secret paths from output and guidance; auth status no longer exposes a `config` field, including through `--fields`.
194
196
  The package ships [axi-credential.schema.json](axi-credential.schema.json) for hosts.
195
197
 
196
198
  The internal transport enforces the exact commercial origin, reviewed catalogue bindings, escaped paths, scoped continuations, and redirect refusal.
@@ -242,16 +244,28 @@ Files are validated as JSON or CSV, scanned for secrets, redacted and published
242
244
  Inventory JSON chunks must contain arrays of objects.
243
245
  See [download bounds](docs/design.md#collections-jobs-and-bounded-reads) for file size and decompression limits.
244
246
 
245
- 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.
246
248
  Lists default to 100 rows, expose upstream totals when supplied, and return a cursor when more rows remain.
247
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.
248
250
  Offset paging does not provide snapshot isolation.
249
- `--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.
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.
250
261
  Simple filters use `--filter 'severity = ["HIGH"]'`; `--filter-file` accepts a flat JSON array of `{property, operator, value: string[]}` and rejects nested boolean expressions.
251
262
  Software defaults to name, version, and publisher because the pinned API exposes no stable software ID.
252
263
 
253
- `doctor` validates local configuration and file security, then performs exactly one tag-properties read without retries.
254
- 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.
255
269
  Collections expose returned count, upstream total when known, completeness and a scoped resume cursor.
256
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.
257
271
  Pages above 25 cards or cursors above this bound fail validation rather than dropping cards.
@@ -260,6 +274,7 @@ Ordinary lists default to 100 output rows.
260
274
  Resume with `--cursor` and the same profile, fields, filters and sort.
261
275
  Offset pagination does not promise snapshot isolation.
262
276
  Tag `value` maps to the documented `name`; `category` requests `tag_category_name` through extra properties and remains null when unavailable.
277
+ Explicit `--extra-properties tag_category_name` adds the `category` output field even when `--fields` omits it.
263
278
  Tag filter files contain the pinned API's strict array of `{property, operator, value}` filters, with string arrays for `value`; this endpoint does not define nested boolean filters.
264
279
  Use `--help` on each leaf for selectors and defaults.
265
280
 
@@ -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))];
@@ -116,7 +116,7 @@ export declare const catalogue: {
116
116
  readonly "auth status": {
117
117
  readonly description: "Check local credentials and file security without contacting Tenable";
118
118
  readonly flags: {
119
- readonly config: "Config path; default TENABLE_AXI_CONFIG or platform path";
119
+ readonly config: "Config path; default environment override or platform path";
120
120
  readonly profile: "Profile name; default credential precedence";
121
121
  readonly fields: "Comma-separated output fields; default all";
122
122
  readonly full: "Show full text; default false";
@@ -30,7 +30,7 @@ export const catalogue = {
30
30
  },
31
31
  "auth status": {
32
32
  description: "Check local credentials and file security without contacting Tenable",
33
- flags: { config: "Config path; default TENABLE_AXI_CONFIG or platform path", profile: "Profile name; default credential precedence", fields: "Comma-separated output fields; default all", full: "Show full text; default false", help: "Show help; default false" },
33
+ flags: { config: "Config path; default environment override or platform path", profile: "Profile name; default credential precedence", fields: "Comma-separated output fields; default all", full: "Show full text; default false", help: "Show help; default false" },
34
34
  examples: ["tenable-axi auth status", "tenable-axi auth status --profile example"],
35
35
  },
36
36
  "profile list": {
@@ -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
  }
@@ -1,10 +1,9 @@
1
1
  import { AxiError } from "axi-sdk-js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { closeSync, openSync, readSync } from "node:fs";
4
- import { homedir } from "node:os";
5
4
  import { z } from "zod";
6
- import { catalogue, DESCRIPTION, SETUP_GUIDANCE } from "./catalogue.js";
7
- 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";
8
7
  import { createTransport, TransportError } from "./transport.js";
9
8
  const operators = ["=", "!=", "<=", "between", "match", ">=", "<", ">", "contains", "not contains", "exists", "not exists", "older than", "newer than", "within last"];
10
9
  const filterSchema = z.array(z.strictObject({ property: z.string().min(1), operator: z.enum(operators), value: z.array(z.string()) }));
@@ -59,13 +58,14 @@ export async function exposureCommand(argv, store, factory = createTransport) {
59
58
  if (flags.has("help"))
60
59
  return { command: name, ...entry };
61
60
  const quote = (value) => `'${value.replaceAll("'", "'\"'\"'")}'`;
62
- const fullCommand = `tenable-axi ${argv.map(quote).join(" ")} --full`;
61
+ const displayArgs = argv.map((arg, index) => name === "home" && argv[index - 1] === "--config" ? "<config>" : arg);
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;
68
- const fields = flags.get("fields")?.split(",") ?? defaults;
68
+ const fields = [...(flags.get("fields")?.split(",") ?? defaults)];
69
69
  if (fields.some((field) => !available.includes(field) && !(name === "tag list" && /^[a-zA-Z0-9_]+$/.test(field))) || new Set(fields).size !== fields.length)
70
70
  usage("Unknown or duplicate output field");
71
71
  const integer = (flag, fallback, minimum, maximum) => {
@@ -165,6 +165,11 @@ export async function exposureCommand(argv, store, factory = createTransport) {
165
165
  const extras = flags.get("extra-properties")?.split(",") ?? [];
166
166
  if (extras.some((property) => !/^[a-zA-Z0-9_]+$/.test(property)))
167
167
  usage("Invalid --extra-properties");
168
+ for (const extra of extras) {
169
+ const field = extra === "tag_category_name" ? "category" : extra;
170
+ if (!fields.includes(field))
171
+ fields.push(field);
172
+ }
168
173
  if (fields.includes("category"))
169
174
  extras.push("tag_category_name");
170
175
  extras.push(...fields.filter((field) => !tagFields.includes(field)));
@@ -188,7 +193,8 @@ export async function exposureCommand(argv, store, factory = createTransport) {
188
193
  }
189
194
  }
190
195
  const config = flags.get("config"), selected = flags.get("profile");
191
- const identity = { bin: process.argv[1]?.replace(homedir(), "~"), description: DESCRIPTION };
196
+ // Never print the executable path: on a hosted server it is an absolute server path.
197
+ const identity = { description: DESCRIPTION };
192
198
  let profile;
193
199
  try {
194
200
  store.readOnly();
@@ -214,15 +220,34 @@ export async function exposureCommand(argv, store, factory = createTransport) {
214
220
  const keys = store.credentials(profile, name === "doctor");
215
221
  const transport = factory({ keys, origin: profile.origin });
216
222
  if (name === "doctor") {
217
- try {
218
- await transport.request("inventory-tag-properties-list", { retry: false });
219
- }
220
- catch (error) {
221
- if (error instanceof TransportError && error.error.status === 401)
222
- throw new TransportError(error.error, [...error.help, `This check requires ${TAG_PRIVILEGE}; authentication failure does not establish module access`]);
223
- 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
+ }
224
246
  }
225
- 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 });
226
251
  }
227
252
  const truncated = [];
228
253
  function preview(value, path) {
@@ -312,8 +337,8 @@ export async function exposureCommand(argv, store, factory = createTransport) {
312
337
  if (failure)
313
338
  process.exitCode = 1;
314
339
  const noun = name === "tag list" ? "tags" : "cards";
315
- const suffix = [config ? `--config ${quote(config)}` : "", selected ? `--profile ${quote(selected)}` : ""].filter(Boolean).join(" ");
316
- const resumeArgs = argv.slice(start).filter((arg, index, args) => !["--cursor", "--offset"].includes(arg) && !["--cursor", "--offset"].includes(args[index - 1] ?? ""));
340
+ const suffix = [config ? `--config ${quote(name === "home" ? "<config>" : config)}` : "", selected ? `--profile ${quote(selected)}` : ""].filter(Boolean).join(" ");
341
+ const resumeArgs = displayArgs.slice(start).filter((arg, index, args) => !["--cursor", "--offset"].includes(arg) && !["--cursor", "--offset"].includes(args[index - 1] ?? ""));
317
342
  const cursor = Buffer.from(JSON.stringify({ scope, offset, ...(pending.length ? { pending } : {}), ...(total === undefined ? {} : { total }) })).toString("base64url");
318
343
  return { ...(name === "home" ? { ...identity, ...context } : {}), [noun]: rows, count: rows.length, ...(total === undefined ? {} : { total }), complete,
319
344
  ...(!rows.length ? { message: `0 ${noun} matched the selected filters` } : {}),
@@ -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<{
@@ -45,6 +52,7 @@ export declare const inventoryPage: z.ZodObject<{
45
52
  }, z.core.$strip>>;
46
53
  }, z.core.$strip>;
47
54
  export declare const inventoryBindings: Readonly<Record<string, OperationBinding>>;
55
+ export declare const filterExamples: Record<InventoryKind, string>;
48
56
  export declare const inventoryCatalogue: Record<string, {
49
57
  description: string;
50
58
  flags: Record<string, string>;
@@ -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"];
@@ -39,24 +68,41 @@ export const inventoryBindings = Object.freeze(Object.fromEntries(Object.keys(in
39
68
  z.object({ data: properties })]) : z.object({ data: properties }) }],
40
69
  ];
41
70
  })));
42
- const common = { config: "Config path; default credential precedence", profile: "Profile name; default credential precedence",
43
- fields: "Comma-separated display or wire properties; default compact view", full: "Show full text; default false", help: "Show help" };
71
+ export const filterExamples = {
72
+ asset: 'asset_class = ["DEVICE"]', finding: 'severity = ["HIGH"]', software: 'application = ["example-app"]',
73
+ };
74
+ const common = (fields) => ({ config: "Config path; default credential precedence", profile: "Profile name; default credential precedence",
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`;
77
+ const propertyFieldsHelp = `Comma-separated output fields; accepted: ${Object.keys(propertyFields).join(", ")}; default compact view`;
44
78
  const collection = { limit: "Maximum emitted rows, 1-10000; default 100", all: "Read up to 10000 rows within invocation budgets; excludes --limit",
45
79
  cursor: "Opaque resume cursor; retain the original selectors and filters" };
46
80
  const search = { query: "Simple query text", filter: "Repeatable: <property> <operator> <JSON string array>",
47
81
  "filter-file": "JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter",
48
- 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" };
49
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
+ }]]),
50
91
  [`${kind} list`, { description: `Search ${inventoryKinds[kind]}${kind === "software" ? "; the pinned API exposes no stable software ID" : ""}`,
51
92
  operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
52
- flags: { ...common, ...collection, ...search, ...(kind === "asset" ? { class: "Server-side asset class filter" } : {}) },
53
- examples: [`tenable-axi ${kind} list --limit 20`, `tenable-axi ${kind} list --query example`] }],
93
+ flags: { ...common(listFields(kind)), ...collection, ...search,
94
+ filter: `Repeatable: <property> <operator> <JSON string array>, e.g. ${filterExamples[kind]}`,
95
+ ...(kind === "asset" ? { class: "Server-side asset class filter" } : {}) },
96
+ examples: [`tenable-axi ${kind} list --limit 20`, `tenable-axi ${kind} list --query example`,
97
+ `tenable-axi ${kind} list --filter '${filterExamples[kind]}'`,
98
+ ...(kind === "finding" ? [`tenable-axi finding list --filter 'sensor_type = ["NESSUS"]'`,
99
+ "tenable-axi finding list --limit 10000 --offset 10000 --sort finding_id:asc"] : [])] }],
54
100
  [`${kind} properties`, { description: `Discover ${kind} properties and supported operators`,
55
101
  operationId: `inventory-${kind}-properties-list`, defaultFields: ["key", "readable_name", "operators", "sortable", "filterable"], evidence: "specs/exposure-management.json",
56
- flags: { ...common, ...collection, ...(kind === "asset" ? { "asset-classes": "Comma-separated documented asset classes" } : {}) },
102
+ flags: { ...common(propertyFieldsHelp), ...collection, ...(kind === "asset" ? { "asset-classes": "Comma-separated documented asset classes" } : {}) },
57
103
  examples: [`tenable-axi ${kind} properties`, `tenable-axi ${kind} properties --full`] }],
58
104
  ...(kind === "software" ? [] : [[`${kind} show`, { description: `Find one ${kind} by exact ID search`,
59
- operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
60
- flags: { ...common, 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"] },
61
107
  examples: [`tenable-axi ${kind} show --id <id>`, `tenable-axi ${kind} show --id <id> --fields id,name,description --full`] }]]),
62
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, 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 };
@@ -94,14 +95,29 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
94
95
  if (!Object.hasOwn(wireFields[kind], wire))
95
96
  extras.add(wire);
96
97
  }
97
- const sort = get("sort");
98
+ // Project requested extras even without a matching --fields entry, instead of fetching then silently dropping them.
99
+ const projection = fields.map((field) => [field, verb === "properties" ? field : aliases[kind][field] ?? field]);
100
+ if (verb !== "properties")
101
+ for (const extra of extras) {
102
+ if (!fields.includes(extra) && !projection.some(([, wire]) => wire === extra))
103
+ projection.push([extra, extra]);
104
+ }
105
+ let sort = get("sort");
98
106
  if (sort !== undefined && !/^[A-Za-z0-9_]+:(asc|desc)$/.test(sort))
99
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
+ }
100
115
  const classes = get("asset-classes") ? names(get("asset-classes")) : get("class") ? [get("class")] : [];
101
116
  if (classes.some((value) => !assetClasses.includes(value)))
102
117
  usage(`Asset classes: ${assetClasses.join(", ")}`);
103
118
  const filters = [];
104
- const invalidFilters = () => usage("Filters must be a flat array of {property, operator, value: string[]}; nested boolean expressions are unsupported; use a documented operator");
119
+ const invalidFilterFile = () => usage("Filters must be a flat array of {property, operator, value: string[]}; nested boolean expressions are unsupported; use a documented operator");
120
+ const invalidFilter = () => usage(`--filter must be '<property> <operator> <JSON string array>' with a documented operator, e.g. --filter '${filterExamples[kind]}'; run tenable-axi ${kind} properties to discover properties and operators, or use --filter-file for a JSON array of {property, operator, value: string[]}`);
105
121
  if (get("filter-file")) {
106
122
  let value;
107
123
  try {
@@ -112,23 +128,23 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
112
128
  }
113
129
  const parsed = z.array(filterSchema).safeParse(value);
114
130
  if (!parsed.success)
115
- invalidFilters();
131
+ invalidFilterFile();
116
132
  filters.push(...parsed.data);
117
133
  }
118
134
  for (const text of flags.get("--filter") ?? []) {
119
135
  const match = /^(\S+)\s+(.+?)\s+(\[.*\])$/s.exec(text);
120
136
  if (!match)
121
- invalidFilters();
137
+ invalidFilter();
122
138
  let value;
123
139
  try {
124
140
  value = JSON.parse(match[3]);
125
141
  }
126
142
  catch {
127
- invalidFilters();
143
+ invalidFilter();
128
144
  }
129
145
  const parsed = filterSchema.safeParse({ property: match[1], operator: match[2], value });
130
146
  if (!parsed.success)
131
- invalidFilters();
147
+ invalidFilter();
132
148
  filters.push(parsed.data);
133
149
  }
134
150
  if (get("class"))
@@ -159,10 +175,30 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
159
175
  const loaded = store.load(get("config"));
160
176
  const profile = store.select(loaded.config, get("profile"));
161
177
  const scope = createHash("sha256").update(JSON.stringify([profile.origin, profile.name, profile.accessKey, profile.secretKey,
162
- loaded.path, operation, body, query, fields])).digest("hex");
178
+ loaded.path, operation, body, query, projection])).digest("hex");
163
179
  if (cursor && cursor.scope !== scope)
164
180
  usage("Cursor belongs to a different profile, operation, filters, sort, or fields");
165
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
+ }
166
202
  offset = cursor?.offset ?? offset;
167
203
  let skip = cursor?.skip ?? 0;
168
204
  let total = cursor?.total ?? null;
@@ -184,17 +220,22 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
184
220
  return value;
185
221
  };
186
222
  const invalid = (message) => { throw new TransportError({ code: "RESPONSE_INVALID", message, operation }); };
187
- const project = (row) => Object.fromEntries(fields.map((field) => {
188
- const wire = verb === "properties" ? field : aliases[kind][field] ?? field;
189
- const native = verb === "properties" || Object.hasOwn(wireFields[kind], wire);
223
+ const project = (row) => {
190
224
  const extra = z.record(z.string(), z.unknown()).safeParse(row.extra_properties);
191
- const value = native ? row[wire] : extra.success ? extra.data[wire] : undefined;
192
- const schema = verb === "properties" ? propertyFields[field] : wireFields[kind][wire] ??
193
- (field === "version" || field === "description" ? z.string() : z.json());
194
- if (value === undefined || !schema.safeParse(value).success)
195
- invalid(`Missing or malformed selected property: ${field}`);
196
- return [field, preview(store.redactor.payload(value))];
197
- }));
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
+ };
198
239
  const seen = new Set();
199
240
  try {
200
241
  while (rows.length < (verb === "show" ? 2 : rowLimit)) {
@@ -266,7 +307,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
266
307
  return { [kind]: rows[0], ...(truncated ? { help: [`Run ${command(["--full"])} --full to read complete text`] } : {}) };
267
308
  }
268
309
  const help = [];
269
- 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(" ");
270
311
  if (verb === "list")
271
312
  help.push(`Run tenable-axi ${kind} properties ${selectors}`.trim());
272
313
  if (verb === "list" && kind !== "software")
@@ -27,7 +27,7 @@ export function localCommand(argv, store) {
27
27
  if (flags.has("--help"))
28
28
  return { command: name, ...entry };
29
29
  // Validation, including output selection, must finish before reading credentials.
30
- const available = name === "auth status" ? ["profile", "source", "origin", "config", "accessKey", "secretKey", "readOnly"]
30
+ const available = name === "auth status" ? ["profile", "source", "origin", "accessKey", "secretKey", "readOnly"]
31
31
  : name === "profile list" ? ["profiles", "count", "config"] : ["config", "state"];
32
32
  const fields = flags.get("--fields")?.split(",") ?? available;
33
33
  if (fields.some((field) => !available.includes(field)) || new Set(fields).size !== fields.length)
@@ -27,25 +27,25 @@ export function toolDirectory(kind, env = process.env, platform = process.platfo
27
27
  export function privateFiles(options = {}) {
28
28
  const platform = options.platform ?? process.platform;
29
29
  const acl = options.acl ?? windowsAcl;
30
- const insecure = (path) => {
31
- throw new AxiError(`Insecure private file: ${path}`, "CONFIG_INSECURE", [
32
- platform === "win32" ? `Apply a protected DACL granting only the current user, SYSTEM and Administrators to ${path}` : `chmod 600 '${path.replaceAll("'", "'\\''")}'`,
30
+ const insecure = () => {
31
+ throw new AxiError("Insecure private file", "CONFIG_INSECURE", [
32
+ platform === "win32" ? "Apply a protected DACL granting only the current user, SYSTEM and Administrators to the private file" : "Ensure the private file is regular, owned by the current user and has mode 600",
33
33
  ]);
34
34
  };
35
- function validate(stat, path, secret) {
35
+ function validate(stat, secret) {
36
36
  if (!stat.isFile() || stat.isSymbolicLink())
37
- insecure(path);
37
+ insecure();
38
38
  if (platform !== "win32" && (stat.uid !== (options.uid ?? process.getuid()) || (stat.mode & (secret ? 0o077 : 0o022)) !== 0))
39
- insecure(path);
39
+ insecure();
40
40
  }
41
41
  function check(path, secret = false, verifyAcl = false) {
42
- validate(lstatSync(path), path, secret);
42
+ validate(lstatSync(path), secret);
43
43
  if (platform === "win32") {
44
44
  try {
45
45
  acl(path, verifyAcl ? "verify" : "check", false);
46
46
  }
47
47
  catch {
48
- insecure(path);
48
+ insecure();
49
49
  }
50
50
  }
51
51
  }
@@ -53,7 +53,7 @@ export function privateFiles(options = {}) {
53
53
  check(path, secret, verifyAcl);
54
54
  const fd = openSync(path, constants.O_RDONLY | (platform === "win32" ? 0 : constants.O_NOFOLLOW));
55
55
  try {
56
- validate(fstatSync(fd), path, secret);
56
+ validate(fstatSync(fd), secret);
57
57
  return readFileSync(fd, "utf8");
58
58
  }
59
59
  finally {
@@ -77,7 +77,7 @@ export function privateFiles(options = {}) {
77
77
  for (;;) {
78
78
  const stat = lstatSync(current);
79
79
  if (stat.isSymbolicLink() || !stat.isDirectory() || (platform !== "win32" && stat.uid !== (options.uid ?? process.getuid())))
80
- insecure(current);
80
+ insecure();
81
81
  try {
82
82
  if (platform === "win32")
83
83
  acl(current, "restrict", true);
@@ -85,7 +85,7 @@ export function privateFiles(options = {}) {
85
85
  chmodSync(current, 0o700);
86
86
  }
87
87
  catch {
88
- insecure(current);
88
+ insecure();
89
89
  }
90
90
  if (first)
91
91
  flushDirectory(current);
@@ -109,7 +109,7 @@ export function privateFiles(options = {}) {
109
109
  acl(temporary, "restrict", false);
110
110
  }
111
111
  catch {
112
- insecure(temporary);
112
+ insecure();
113
113
  }
114
114
  }
115
115
  writeFileSync(fd, content, "utf8");
@@ -89,17 +89,8 @@ export declare function credentialStore(options?: CredentialContext, redactor?:
89
89
  profile: string;
90
90
  source: "env" | "flag" | "env-profile" | "config-default" | "sole";
91
91
  origin: "https://cloud.tenable.com";
92
- config: string;
93
- accessKey: {
94
- env: string;
95
- } | {
96
- file: string;
97
- };
98
- secretKey: {
99
- env: string;
100
- } | {
101
- file: string;
102
- };
92
+ accessKey: string;
93
+ secretKey: string;
103
94
  readOnly: boolean;
104
95
  };
105
96
  list: (explicit?: string) => {
@@ -48,7 +48,7 @@ export function credentialStore(options = {}, redactor = new SecretRedactor()) {
48
48
  return false;
49
49
  if (value === "1" || value === "true")
50
50
  return true;
51
- return invalid("TENABLE_AXI_READ_ONLY must be 1, true, 0 or false");
51
+ return invalid("Read-only override must be 1, true, 0 or false");
52
52
  }
53
53
  function load(explicit, verifyAcl = false) {
54
54
  const path = configPath(explicit);
@@ -91,7 +91,7 @@ export function credentialStore(options = {}, redactor = new SecretRedactor()) {
91
91
  invalid("Invalid selected profile name");
92
92
  if (selected === undefined && ["TENABLE_AXI_ACCESS_KEY", "TENABLE_AXI_SECRET_KEY", "TENABLE_AXI_ORIGIN"].some((name) => env[name] !== undefined)) {
93
93
  if (!env.TENABLE_AXI_ACCESS_KEY?.trim() || !env.TENABLE_AXI_SECRET_KEY?.trim() || (env.TENABLE_AXI_ORIGIN !== undefined && env.TENABLE_AXI_ORIGIN !== ORIGIN)) {
94
- return invalid("Incomplete or invalid TENABLE_AXI env profile; set both ACCESS_KEY and SECRET_KEY and use the allowed ORIGIN");
94
+ return invalid("Incomplete or invalid env profile; set both credential sources and use the allowed origin");
95
95
  }
96
96
  return { origin: ORIGIN, accessKey: { env: "TENABLE_AXI_ACCESS_KEY" }, secretKey: { env: "TENABLE_AXI_SECRET_KEY" },
97
97
  writes: { allowWrites: false, operations: [] }, name: "env", source: "env-profile" };
@@ -99,7 +99,7 @@ export function credentialStore(options = {}, redactor = new SecretRedactor()) {
99
99
  const names = Object.keys(config.profiles);
100
100
  const name = selected ?? config.defaultProfile ?? (names.length === 1 ? names[0] : undefined);
101
101
  if (name === undefined)
102
- throw new AxiError(names.length ? "Select one of the configured profiles" : "No profiles are configured", names.length ? "PROFILE_AMBIGUOUS" : "PROFILE_REQUIRED", ["Pass --profile <name>, set TENABLE_AXI_PROFILE, or configure defaultProfile; run tenable-axi config path"]);
102
+ throw new AxiError(names.length ? "Select one of the configured profiles" : "No profiles are configured", names.length ? "PROFILE_AMBIGUOUS" : "PROFILE_REQUIRED", ["Pass --profile <name> or configure defaultProfile; run tenable-axi config path"]);
103
103
  if (!Object.hasOwn(config.profiles, name))
104
104
  throw new AxiError("Selected profile is not configured", "PROFILE_NOT_FOUND", ["Run tenable-axi profile list"]);
105
105
  return { ...config.profiles[name], name, source: flag !== undefined ? "flag" : env.TENABLE_AXI_PROFILE !== undefined ? "env" : config.defaultProfile !== undefined ? "config-default" : "sole" };
@@ -133,8 +133,9 @@ export function credentialStore(options = {}, redactor = new SecretRedactor()) {
133
133
  const loaded = load(explicit, true);
134
134
  const profile = select(loaded.config, flag);
135
135
  credentials(profile, true);
136
- return { profile: profile.name, source: profile.source, origin: profile.origin, config: loaded.path,
137
- accessKey: profile.accessKey, secretKey: profile.secretKey,
136
+ return { profile: profile.name, source: profile.source, origin: profile.origin,
137
+ // Report only the SecretRef kind: env variable names and secret file paths must not leak into status output.
138
+ accessKey: "env" in profile.accessKey ? "env" : "file", secretKey: "env" in profile.secretKey ? "env" : "file",
138
139
  readOnly: forced || !profile.writes.allowWrites || profile.writes.operations.length === 0 };
139
140
  }
140
141
  function list(explicit) {
package/docs/commands.md CHANGED
@@ -16,16 +16,16 @@ Operation: `inventory-assets-search`.
16
16
  |---|---|
17
17
  | `--config` | Config path; default credential precedence |
18
18
  | `--profile` | Profile name; default credential precedence |
19
- | `--fields` | Comma-separated display or wire properties; default compact view |
20
- | `--full` | Show full text; default false |
19
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore; default compact view |
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 |
24
24
  | `--cursor` | Opaque resume cursor; retain the original selectors and filters |
25
25
  | `--query` | Simple query text |
26
- | `--filter` | Repeatable: <property> <operator> <JSON string array> |
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 |
@@ -33,6 +33,7 @@ Operation: `inventory-assets-search`.
33
33
  ```sh
34
34
  tenable-axi asset list --limit 20
35
35
  tenable-axi asset list --query example
36
+ tenable-axi asset list --filter 'asset_class = ["DEVICE"]'
36
37
  ```
37
38
 
38
39
  ## asset properties
@@ -45,8 +46,8 @@ Operation: `inventory-asset-properties-list`.
45
46
  |---|---|
46
47
  | `--config` | Config path; default credential precedence |
47
48
  | `--profile` | Profile name; default credential precedence |
48
- | `--fields` | Comma-separated display or wire properties; default compact view |
49
- | `--full` | Show full text; default false |
49
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
50
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
50
51
  | `--help` | Show help |
51
52
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
52
53
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -68,8 +69,8 @@ Operation: `inventory-assets-search`.
68
69
  |---|---|
69
70
  | `--config` | Config path; default credential precedence |
70
71
  | `--profile` | Profile name; default credential precedence |
71
- | `--fields` | Comma-separated display or wire properties; default compact view |
72
- | `--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 |
73
74
  | `--help` | Show help |
74
75
  | `--id` | Required exact inventory ID |
75
76
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -140,7 +141,7 @@ Check local credentials and file security without contacting Tenable
140
141
 
141
142
  | Flag | Meaning |
142
143
  |---|---|
143
- | `--config` | Config path; default TENABLE_AXI_CONFIG or platform path |
144
+ | `--config` | Config path; default environment override or platform path |
144
145
  | `--profile` | Profile name; default credential precedence |
145
146
  | `--fields` | Comma-separated output fields; default all |
146
147
  | `--full` | Show full text; default false |
@@ -353,7 +354,7 @@ tenable-axi config path --fields config
353
354
 
354
355
  ## connector logs
355
356
 
356
- 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
357
358
 
358
359
  Operation: `connectors-logs`.
359
360
 
@@ -379,7 +380,7 @@ tenable-axi connector logs --status FAILED --start-date 2026-01-01 --end-date 20
379
380
 
380
381
  ## doctor
381
382
 
382
- 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
383
384
 
384
385
  | Flag | Meaning |
385
386
  |---|---|
@@ -659,22 +660,25 @@ Operation: `inventory-findings-search`.
659
660
  |---|---|
660
661
  | `--config` | Config path; default credential precedence |
661
662
  | `--profile` | Profile name; default credential precedence |
662
- | `--fields` | Comma-separated display or wire properties; default compact view |
663
- | `--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 |
664
665
  | `--help` | Show help |
665
666
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
666
667
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
667
668
  | `--cursor` | Opaque resume cursor; retain the original selectors and filters |
668
669
  | `--query` | Simple query text |
669
- | `--filter` | Repeatable: <property> <operator> <JSON string array> |
670
+ | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. severity = ["HIGH"] |
670
671
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
671
- | `--sort` | Wire property:asc\|desc |
672
+ | `--sort` | Sortable display or wire property:asc\|desc; unknown names report valid choices |
672
673
  | `--extra-properties` | Comma-separated extra wire properties |
673
674
  | `--offset` | Starting record; default 0; excludes --cursor |
674
675
 
675
676
  ```sh
676
677
  tenable-axi finding list --limit 20
677
678
  tenable-axi finding list --query example
679
+ tenable-axi finding list --filter 'severity = ["HIGH"]'
680
+ tenable-axi finding list --filter 'sensor_type = ["NESSUS"]'
681
+ tenable-axi finding list --limit 10000 --offset 10000 --sort finding_id:asc
678
682
  ```
679
683
 
680
684
  ## finding properties
@@ -687,8 +691,8 @@ Operation: `inventory-finding-properties-list`.
687
691
  |---|---|
688
692
  | `--config` | Config path; default credential precedence |
689
693
  | `--profile` | Profile name; default credential precedence |
690
- | `--fields` | Comma-separated display or wire properties; default compact view |
691
- | `--full` | Show full text; default false |
694
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
695
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
692
696
  | `--help` | Show help |
693
697
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
694
698
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
@@ -709,8 +713,8 @@ Operation: `inventory-findings-search`.
709
713
  |---|---|
710
714
  | `--config` | Config path; default credential precedence |
711
715
  | `--profile` | Profile name; default credential precedence |
712
- | `--fields` | Comma-separated display or wire properties; default compact view |
713
- | `--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 |
714
718
  | `--help` | Show help |
715
719
  | `--id` | Required exact inventory ID |
716
720
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -720,6 +724,22 @@ tenable-axi finding show --id <id>
720
724
  tenable-axi finding show --id <id> --fields id,name,description --full
721
725
  ```
722
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
+
723
743
  ## home
724
744
 
725
745
  Show profile state and up to five live exposure cards
@@ -907,22 +927,23 @@ Operation: `inventory-software-search`.
907
927
  |---|---|
908
928
  | `--config` | Config path; default credential precedence |
909
929
  | `--profile` | Profile name; default credential precedence |
910
- | `--fields` | Comma-separated display or wire properties; default compact view |
911
- | `--full` | Show full text; default false |
930
+ | `--fields` | Comma-separated display or wire properties; display names: name, version, publisher; default compact view |
931
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
912
932
  | `--help` | Show help |
913
933
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
914
934
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
915
935
  | `--cursor` | Opaque resume cursor; retain the original selectors and filters |
916
936
  | `--query` | Simple query text |
917
- | `--filter` | Repeatable: <property> <operator> <JSON string array> |
937
+ | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. application = ["example-app"] |
918
938
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
919
- | `--sort` | Wire property:asc\|desc |
939
+ | `--sort` | Sortable display or wire property:asc\|desc; unknown names report valid choices |
920
940
  | `--extra-properties` | Comma-separated extra wire properties |
921
941
  | `--offset` | Starting record; default 0; excludes --cursor |
922
942
 
923
943
  ```sh
924
944
  tenable-axi software list --limit 20
925
945
  tenable-axi software list --query example
946
+ tenable-axi software list --filter 'application = ["example-app"]'
926
947
  ```
927
948
 
928
949
  ## software properties
@@ -935,8 +956,8 @@ Operation: `inventory-software-properties-list`.
935
956
  |---|---|
936
957
  | `--config` | Config path; default credential precedence |
937
958
  | `--profile` | Profile name; default credential precedence |
938
- | `--fields` | Comma-separated display or wire properties; default compact view |
939
- | `--full` | Show full text; default false |
959
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
960
+ | `--full` | Show untruncated text; does not add fields or rows; default false |
940
961
  | `--help` | Show help |
941
962
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
942
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.1",
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 |