@knowttl/tenable-axi 0.1.1 → 0.1.2

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
@@ -183,14 +183,15 @@ Inventory reads and exports, attack searches and connector logs are implemented.
183
183
  Attack path, attack technique and MITRE heatmap exports support guarded creation, status and redacted file downloads.
184
184
  `tag list`, `tag properties`, `card list` and `card show` provide bounded Exposure Management reads.
185
185
  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.
186
+ Home shows up to five exposure cards when configured and setup guidance offline otherwise, without printing the executable path.
187
187
  Exposure response initiatives and combinations support reads and guarded writes, including allowed combination filters.
188
188
  `hook` reports local profile context without resolving secrets or contacting Tenable.
189
189
  Help, version, `auth status`, `profile list` and `config path` remain local.
190
190
 
191
191
  Credentials use the strict versioned config and SecretRefs described in [profiles and authentication](docs/design.md#profiles-and-authentication).
192
192
  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.
193
+ Run `tenable-axi auth status` to check sources and file security locally without printing key values; `accessKey` and `secretKey` report only `env` or `file`.
194
+ 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
195
  The package ships [axi-credential.schema.json](axi-credential.schema.json) for hosts.
195
196
 
196
197
  The internal transport enforces the exact commercial origin, reviewed catalogue bindings, escaped paths, scoped continuations, and redirect refusal.
@@ -247,6 +248,7 @@ Lists default to 100 rows, expose upstream totals when supplied, and return a cu
247
248
  `--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
249
  Offset paging does not provide snapshot isolation.
249
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
+ For inventory reads and `tag list`, `--extra-properties` also adds the requested properties to the output, even when omitted from `--fields`.
250
252
  Simple filters use `--filter 'severity = ["HIGH"]'`; `--filter-file` accepts a flat JSON array of `{property, operator, value: string[]}` and rejects nested boolean expressions.
251
253
  Software defaults to name, version, and publisher because the pinned API exposes no stable software ID.
252
254
 
@@ -260,6 +262,7 @@ Ordinary lists default to 100 output rows.
260
262
  Resume with `--cursor` and the same profile, fields, filters and sort.
261
263
  Offset pagination does not promise snapshot isolation.
262
264
  Tag `value` maps to the documented `name`; `category` requests `tag_category_name` through extra properties and remains null when unavailable.
265
+ Explicit `--extra-properties tag_category_name` adds the `category` output field even when `--fields` omits it.
263
266
  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
267
  Use `--help` on each leaf for selectors and defaults.
265
268
 
@@ -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": {
@@ -1,7 +1,6 @@
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
5
  import { catalogue, DESCRIPTION, SETUP_GUIDANCE } from "./catalogue.js";
7
6
  import { cardDetails, cardRecord, properties, tagRecord, TAG_PRIVILEGE } from "./exposure-contracts.js";
@@ -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
64
  : name === "doctor" ? ["profile", "origin", "readOnly", "check", "status", "scope"]
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();
@@ -312,8 +318,8 @@ export async function exposureCommand(argv, store, factory = createTransport) {
312
318
  if (failure)
313
319
  process.exitCode = 1;
314
320
  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] ?? ""));
321
+ const suffix = [config ? `--config ${quote(name === "home" ? "<config>" : config)}` : "", selected ? `--profile ${quote(selected)}` : ""].filter(Boolean).join(" ");
322
+ const resumeArgs = displayArgs.slice(start).filter((arg, index, args) => !["--cursor", "--offset"].includes(arg) && !["--cursor", "--offset"].includes(args[index - 1] ?? ""));
317
323
  const cursor = Buffer.from(JSON.stringify({ scope, offset, ...(pending.length ? { pending } : {}), ...(total === undefined ? {} : { total }) })).toString("base64url");
318
324
  return { ...(name === "home" ? { ...identity, ...context } : {}), [noun]: rows, count: rows.length, ...(total === undefined ? {} : { total }), complete,
319
325
  ...(!rows.length ? { message: `0 ${noun} matched the selected filters` } : {}),
@@ -45,6 +45,7 @@ export declare const inventoryPage: z.ZodObject<{
45
45
  }, z.core.$strip>>;
46
46
  }, z.core.$strip>;
47
47
  export declare const inventoryBindings: Readonly<Record<string, OperationBinding>>;
48
+ export declare const filterExamples: Record<InventoryKind, string>;
48
49
  export declare const inventoryCatalogue: Record<string, {
49
50
  description: string;
50
51
  flags: Record<string, string>;
@@ -39,8 +39,13 @@ export const inventoryBindings = Object.freeze(Object.fromEntries(Object.keys(in
39
39
  z.object({ data: properties })]) : z.object({ data: properties }) }],
40
40
  ];
41
41
  })));
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" };
42
+ export const filterExamples = {
43
+ asset: 'asset_class = ["DEVICE"]', finding: 'severity = ["HIGH"]', software: 'application = ["example-app"]',
44
+ };
45
+ 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`;
48
+ const propertyFieldsHelp = `Comma-separated output fields; accepted: ${Object.keys(propertyFields).join(", ")}; default compact view`;
44
49
  const collection = { limit: "Maximum emitted rows, 1-10000; default 100", all: "Read up to 10000 rows within invocation budgets; excludes --limit",
45
50
  cursor: "Opaque resume cursor; retain the original selectors and filters" };
46
51
  const search = { query: "Simple query text", filter: "Repeatable: <property> <operator> <JSON string array>",
@@ -49,14 +54,19 @@ const search = { query: "Simple query text", filter: "Repeatable: <property> <op
49
54
  export const inventoryCatalogue = Object.fromEntries(Object.keys(inventoryKinds).flatMap((kind) => [
50
55
  [`${kind} list`, { description: `Search ${inventoryKinds[kind]}${kind === "software" ? "; the pinned API exposes no stable software ID" : ""}`,
51
56
  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`] }],
57
+ flags: { ...common(listFields(kind)), ...collection, ...search,
58
+ filter: `Repeatable: <property> <operator> <JSON string array>, e.g. ${filterExamples[kind]}`,
59
+ ...(kind === "asset" ? { class: "Server-side asset class filter" } : {}) },
60
+ examples: [`tenable-axi ${kind} list --limit 20`, `tenable-axi ${kind} list --query example`,
61
+ `tenable-axi ${kind} list --filter '${filterExamples[kind]}'`,
62
+ ...(kind === "finding" ? [`tenable-axi finding list --filter 'sensor_type = ["NESSUS"]'`,
63
+ "tenable-axi finding list --limit 10000 --offset 10000 --sort finding_id:asc"] : [])] }],
54
64
  [`${kind} properties`, { description: `Discover ${kind} properties and supported operators`,
55
65
  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" } : {}) },
66
+ flags: { ...common(propertyFieldsHelp), ...collection, ...(kind === "asset" ? { "asset-classes": "Comma-separated documented asset classes" } : {}) },
57
67
  examples: [`tenable-axi ${kind} properties`, `tenable-axi ${kind} properties --full`] }],
58
68
  ...(kind === "software" ? [] : [[`${kind} show`, { description: `Find one ${kind} by exact ID search`,
59
69
  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"] },
70
+ flags: { ...common(listFields(kind)), id: "Required exact inventory ID", "extra-properties": search["extra-properties"] },
61
71
  examples: [`tenable-axi ${kind} show --id <id>`, `tenable-axi ${kind} show --id <id> --fields id,name,description --full`] }]]),
62
72
  ]));
@@ -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, filterExamples, filterSchema, inventoryCatalogue, inventoryKinds, inventoryPage, propertyFields, 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,
@@ -94,6 +94,13 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
94
94
  if (!Object.hasOwn(wireFields[kind], wire))
95
95
  extras.add(wire);
96
96
  }
97
+ // Project requested extras even without a matching --fields entry, instead of fetching then silently dropping them.
98
+ const projection = fields.map((field) => [field, verb === "properties" ? field : aliases[kind][field] ?? field]);
99
+ if (verb !== "properties")
100
+ for (const extra of extras) {
101
+ if (!fields.includes(extra) && !projection.some(([, wire]) => wire === extra))
102
+ projection.push([extra, extra]);
103
+ }
97
104
  const sort = get("sort");
98
105
  if (sort !== undefined && !/^[A-Za-z0-9_]+:(asc|desc)$/.test(sort))
99
106
  usage("--sort must be property:asc or property:desc");
@@ -101,7 +108,8 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
101
108
  if (classes.some((value) => !assetClasses.includes(value)))
102
109
  usage(`Asset classes: ${assetClasses.join(", ")}`);
103
110
  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");
111
+ const invalidFilterFile = () => usage("Filters must be a flat array of {property, operator, value: string[]}; nested boolean expressions are unsupported; use a documented operator");
112
+ 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
113
  if (get("filter-file")) {
106
114
  let value;
107
115
  try {
@@ -112,23 +120,23 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
112
120
  }
113
121
  const parsed = z.array(filterSchema).safeParse(value);
114
122
  if (!parsed.success)
115
- invalidFilters();
123
+ invalidFilterFile();
116
124
  filters.push(...parsed.data);
117
125
  }
118
126
  for (const text of flags.get("--filter") ?? []) {
119
127
  const match = /^(\S+)\s+(.+?)\s+(\[.*\])$/s.exec(text);
120
128
  if (!match)
121
- invalidFilters();
129
+ invalidFilter();
122
130
  let value;
123
131
  try {
124
132
  value = JSON.parse(match[3]);
125
133
  }
126
134
  catch {
127
- invalidFilters();
135
+ invalidFilter();
128
136
  }
129
137
  const parsed = filterSchema.safeParse({ property: match[1], operator: match[2], value });
130
138
  if (!parsed.success)
131
- invalidFilters();
139
+ invalidFilter();
132
140
  filters.push(parsed.data);
133
141
  }
134
142
  if (get("class"))
@@ -159,7 +167,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
159
167
  const loaded = store.load(get("config"));
160
168
  const profile = store.select(loaded.config, get("profile"));
161
169
  const scope = createHash("sha256").update(JSON.stringify([profile.origin, profile.name, profile.accessKey, profile.secretKey,
162
- loaded.path, operation, body, query, fields])).digest("hex");
170
+ loaded.path, operation, body, query, projection])).digest("hex");
163
171
  if (cursor && cursor.scope !== scope)
164
172
  usage("Cursor belongs to a different profile, operation, filters, sort, or fields");
165
173
  const transport = transportFactory({ origin: profile.origin, keys: store.credentials(profile) });
@@ -184,8 +192,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
184
192
  return value;
185
193
  };
186
194
  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;
195
+ const project = (row) => Object.fromEntries(projection.map(([field, wire]) => {
189
196
  const native = verb === "properties" || Object.hasOwn(wireFields[kind], wire);
190
197
  const extra = z.record(z.string(), z.unknown()).safeParse(row.extra_properties);
191
198
  const value = native ? row[wire] : extra.success ? extra.data[wire] : undefined;
@@ -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,14 +16,14 @@ 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 |
19
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore; default compact view |
20
20
  | `--full` | Show full text; 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
28
  | `--sort` | Wire property:asc\|desc |
29
29
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -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,7 +46,7 @@ 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
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
49
50
  | `--full` | Show full text; default false |
50
51
  | `--help` | Show help |
51
52
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
@@ -68,7 +69,7 @@ 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
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, class, exposureScore; default compact view |
72
73
  | `--full` | Show full text; default false |
73
74
  | `--help` | Show help |
74
75
  | `--id` | Required exact inventory ID |
@@ -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 |
@@ -659,14 +660,14 @@ 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
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state; default compact view |
663
664
  | `--full` | Show full text; 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
672
  | `--sort` | Wire property:asc\|desc |
672
673
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -675,6 +676,9 @@ Operation: `inventory-findings-search`.
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,7 +691,7 @@ 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 |
694
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
691
695
  | `--full` | Show full text; default false |
692
696
  | `--help` | Show help |
693
697
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
@@ -709,7 +713,7 @@ 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 |
716
+ | `--fields` | Comma-separated display or wire properties; display names: id, name, severity, state; default compact view |
713
717
  | `--full` | Show full text; default false |
714
718
  | `--help` | Show help |
715
719
  | `--id` | Required exact inventory ID |
@@ -907,14 +911,14 @@ Operation: `inventory-software-search`.
907
911
  |---|---|
908
912
  | `--config` | Config path; default credential precedence |
909
913
  | `--profile` | Profile name; default credential precedence |
910
- | `--fields` | Comma-separated display or wire properties; default compact view |
914
+ | `--fields` | Comma-separated display or wire properties; display names: name, version, publisher; default compact view |
911
915
  | `--full` | Show full text; default false |
912
916
  | `--help` | Show help |
913
917
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
914
918
  | `--all` | Read up to 10000 rows within invocation budgets; excludes --limit |
915
919
  | `--cursor` | Opaque resume cursor; retain the original selectors and filters |
916
920
  | `--query` | Simple query text |
917
- | `--filter` | Repeatable: <property> <operator> <JSON string array> |
921
+ | `--filter` | Repeatable: <property> <operator> <JSON string array>, e.g. application = ["example-app"] |
918
922
  | `--filter-file` | JSON flat array of {property, operator, value: string[]}; '-' reads stdin; excludes --filter |
919
923
  | `--sort` | Wire property:asc\|desc |
920
924
  | `--extra-properties` | Comma-separated extra wire properties |
@@ -923,6 +927,7 @@ Operation: `inventory-software-search`.
923
927
  ```sh
924
928
  tenable-axi software list --limit 20
925
929
  tenable-axi software list --query example
930
+ tenable-axi software list --filter 'application = ["example-app"]'
926
931
  ```
927
932
 
928
933
  ## software properties
@@ -935,7 +940,7 @@ Operation: `inventory-software-properties-list`.
935
940
  |---|---|
936
941
  | `--config` | Config path; default credential precedence |
937
942
  | `--profile` | Profile name; default credential precedence |
938
- | `--fields` | Comma-separated display or wire properties; default compact view |
943
+ | `--fields` | Comma-separated output fields; accepted: key, readable_name, operators, sortable, filterable, control, description; default compact view |
939
944
  | `--full` | Show full text; default false |
940
945
  | `--help` | Show help |
941
946
  | `--limit` | Maximum emitted rows, 1-10000; default 100 |
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.2",
4
4
  "description": "Investigate Tenable One exposure and run explicitly guarded writes",
5
5
  "license": "MIT",
6
6
  "type": "module",