@knowttl/tenable-axi 0.1.0 → 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 +12 -3
- package/dist/src/catalogue.d.ts +1 -1
- package/dist/src/catalogue.js +1 -1
- package/dist/src/exposure.js +40 -16
- package/dist/src/inventory-catalogue.d.ts +1 -0
- package/dist/src/inventory-catalogue.js +18 -7
- package/dist/src/inventory-export-catalogue.js +1 -1
- package/dist/src/inventory-export.js +2 -0
- package/dist/src/inventory.js +17 -10
- package/dist/src/local-commands.js +1 -1
- package/dist/src/platform-tag-catalogue.js +2 -2
- package/dist/src/platform-tag.js +11 -1
- package/dist/src/private-file.js +12 -12
- package/dist/src/profiles.d.ts +2 -11
- package/dist/src/profiles.js +6 -5
- package/dist/src/transport-core.js +1 -1
- package/docs/commands.md +19 -14
- package/package.json +40 -9
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ tenable-axi finding list --profile example --filter 'severity = ["HIGH"]'
|
|
|
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.
|
|
52
|
+
HTTP 403 returns `PERMISSION_DENIED` with “Not licensed or not permitted for this key” and advice naming the required privilege where documented.
|
|
52
53
|
Inventory needs `EXPOSURE_MANAGEMENT.INVENTORY.INVENTORY.READ`; inventory exports need its `EXPORT` privilege and attack exports need `EXPOSURE_MANAGEMENT.ATTACK_PATH.ATTACK_PATH.WRITE`.
|
|
53
54
|
Connector logs have elevated permissions; their denial does not imply ordinary inventory users need Administrator.
|
|
54
55
|
|
|
@@ -182,14 +183,15 @@ Inventory reads and exports, attack searches and connector logs are implemented.
|
|
|
182
183
|
Attack path, attack technique and MITRE heatmap exports support guarded creation, status and redacted file downloads.
|
|
183
184
|
`tag list`, `tag properties`, `card list` and `card show` provide bounded Exposure Management reads.
|
|
184
185
|
Platform tag categories, values, assignments, exclusions and dynamic filter definitions are implemented, including guarded mutations.
|
|
185
|
-
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.
|
|
186
187
|
Exposure response initiatives and combinations support reads and guarded writes, including allowed combination filters.
|
|
187
188
|
`hook` reports local profile context without resolving secrets or contacting Tenable.
|
|
188
189
|
Help, version, `auth status`, `profile list` and `config path` remain local.
|
|
189
190
|
|
|
190
191
|
Credentials use the strict versioned config and SecretRefs described in [profiles and authentication](docs/design.md#profiles-and-authentication).
|
|
191
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.
|
|
192
|
-
Run `tenable-axi auth status` to check sources and file security locally;
|
|
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`.
|
|
193
195
|
The package ships [axi-credential.schema.json](axi-credential.schema.json) for hosts.
|
|
194
196
|
|
|
195
197
|
The internal transport enforces the exact commercial origin, reviewed catalogue bindings, escaped paths, scoped continuations, and redirect refusal.
|
|
@@ -231,6 +233,7 @@ Use `export asset start` or `export finding start` to preview the filters, prope
|
|
|
231
233
|
The selected file profile must configure `writes.allowWrites: true` and allow the exact `inventory-export-assets` or `inventory-export-findings` operation, including for previews.
|
|
232
234
|
Optional `--body-file` accepts strict documented query/filters JSON, or `-` for stdin, within 1 MiB.
|
|
233
235
|
Query options use `--properties`, `--use-readable-name true|false`, `--max-chunk-file-size`, `--sort`, `--file-format JSON|CSV` and `--compress true|false`.
|
|
236
|
+
Choose comma-separated `--properties` names from `asset properties` or `finding properties`; `id` maps to `asset_id` or `finding_id` respectively, while other names pass through unchanged.
|
|
234
237
|
Run again with `--execute --confirm '<exact preview confirmation>'` to create once and return immediately; exports have no server dry run or idempotency guarantee.
|
|
235
238
|
`TENABLE_AXI_READ_ONLY=true` overrides every configured write policy.
|
|
236
239
|
`export asset jobs` and `export finding jobs` expose `--status` and `--limit` (default 100, maximum 1000), returning only the last three days without server paging or a claim of complete history.
|
|
@@ -245,17 +248,21 @@ Lists default to 100 rows, expose upstream totals when supplied, and return a cu
|
|
|
245
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.
|
|
246
249
|
Offset paging does not provide snapshot isolation.
|
|
247
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`.
|
|
248
252
|
Simple filters use `--filter 'severity = ["HIGH"]'`; `--filter-file` accepts a flat JSON array of `{property, operator, value: string[]}` and rejects nested boolean expressions.
|
|
249
253
|
Software defaults to name, version, and publisher because the pinned API exposes no stable software ID.
|
|
250
254
|
|
|
251
255
|
`doctor` validates local configuration and file security, then performs exactly one tag-properties read without retries.
|
|
252
256
|
It checks `EXPOSURE_MANAGEMENT.TAG.TAG.READ`, without claiming access to other modules.
|
|
253
257
|
Collections expose returned count, upstream total when known, completeness and a scoped resume cursor.
|
|
254
|
-
Card
|
|
258
|
+
Card lists and home accept upstream pages of up to 25 cards even when fewer are requested, emit only the requested limit, and preserve overflow in a scoped, redacted cursor bounded at 64 KiB.
|
|
259
|
+
Pages above 25 cards or cursors above this bound fail validation rather than dropping cards.
|
|
260
|
+
Ordinary lists default to 100 output rows.
|
|
255
261
|
`--all` remains subject to invocation budgets and the 10,000-row ceiling.
|
|
256
262
|
Resume with `--cursor` and the same profile, fields, filters and sort.
|
|
257
263
|
Offset pagination does not promise snapshot isolation.
|
|
258
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.
|
|
259
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.
|
|
260
267
|
Use `--help` on each leaf for selectors and defaults.
|
|
261
268
|
|
|
@@ -280,6 +287,8 @@ Input files accept `-` for stdin, with only one stdin consumer and a 1 MiB bound
|
|
|
280
287
|
State reads, including per-target checks for bulk operations, share invocation budgets; narrow large target sets when those budgets are exhausted.
|
|
281
288
|
Identical verified updates/creates and already desired assignments return successful no-ops; an unverified missing-resource response remains an error.
|
|
282
289
|
Deleting a category also deletes its values and assignments; deleting values removes their assignments while retaining the category.
|
|
290
|
+
Value delete and bulk-delete accept unconstrained or undecodable HTTP 2xx replies as exit-0 success once the `SUCCESS` journal outcome is durably recorded.
|
|
291
|
+
An undecodable reply includes a warning, audit ID and status; read back the target before retrying.
|
|
283
292
|
|
|
284
293
|
Use `attack-path list`, `attack-technique list`, and `connector logs` with `--help` for their flags and examples.
|
|
285
294
|
Attack paths use the published `/api/v1/t1/apa/top-attack-paths/search` route; the pyTenable route disagreement remains a live-acceptance check in the design.
|
package/dist/src/catalogue.d.ts
CHANGED
|
@@ -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
|
|
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";
|
package/dist/src/catalogue.js
CHANGED
|
@@ -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
|
|
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": {
|
package/dist/src/exposure.js
CHANGED
|
@@ -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";
|
|
@@ -12,6 +11,9 @@ const cardFields = ["id", "name", "score", "card_type", "is_global_card", "tag_c
|
|
|
12
11
|
const detailFields = [...cardFields.filter((field) => !["sla_percentage", "exposure_class"].includes(field)), "ces_scores", "exposures", "exposure_classes_details"];
|
|
13
12
|
const tagFields = ["id", "category", "value", "name", "product", "asset_count", "weakness_severity_counts", "total_weakness_count", "type", "extra_properties"];
|
|
14
13
|
const propertyFields = ["property", "operators", "readable_name", "control", "sortable", "filterable", "description"];
|
|
14
|
+
const cursorSchema = z.strictObject({ scope: z.string(), offset: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
15
|
+
pending: z.array(cardRecord).max(24).optional(), total: z.number().int().nonnegative().optional() });
|
|
16
|
+
const cursorMaxLength = 64 * 1024;
|
|
15
17
|
const fieldTypes = {
|
|
16
18
|
id: z.string(), name: z.string(), value: z.string(), category: z.string(), score: z.number(),
|
|
17
19
|
product: z.string(), type: z.string(), card_type: z.string(), is_global_card: z.boolean(),
|
|
@@ -56,13 +58,14 @@ export async function exposureCommand(argv, store, factory = createTransport) {
|
|
|
56
58
|
if (flags.has("help"))
|
|
57
59
|
return { command: name, ...entry };
|
|
58
60
|
const quote = (value) => `'${value.replaceAll("'", "'\"'\"'")}'`;
|
|
59
|
-
const
|
|
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`;
|
|
60
63
|
const defaults = name === "tag list" ? ["id", "category", "value"] : name === "tag properties" ? ["property", "operators"]
|
|
61
64
|
: name === "doctor" ? ["profile", "origin", "readOnly", "check", "status", "scope"]
|
|
62
65
|
: name === "hook" ? ["profile", "origin", "readOnly"] : name === "card show" ? ["id", "name", "score", "ces_scores", "ces_trend", "exposure_classes_details"] : ["id", "name", "score"];
|
|
63
66
|
const available = name === "tag list" ? tagFields : name === "tag properties" ? propertyFields : name === "card show" ? detailFields
|
|
64
67
|
: ["doctor", "hook"].includes(name) ? defaults : cardFields;
|
|
65
|
-
const fields = flags.get("fields")?.split(",") ?? defaults;
|
|
68
|
+
const fields = [...(flags.get("fields")?.split(",") ?? defaults)];
|
|
66
69
|
if (fields.some((field) => !available.includes(field) && !(name === "tag list" && /^[a-zA-Z0-9_]+$/.test(field))) || new Set(fields).size !== fields.length)
|
|
67
70
|
usage("Unknown or duplicate output field");
|
|
68
71
|
const integer = (flag, fallback, minimum, maximum) => {
|
|
@@ -162,6 +165,11 @@ export async function exposureCommand(argv, store, factory = createTransport) {
|
|
|
162
165
|
const extras = flags.get("extra-properties")?.split(",") ?? [];
|
|
163
166
|
if (extras.some((property) => !/^[a-zA-Z0-9_]+$/.test(property)))
|
|
164
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
|
+
}
|
|
165
173
|
if (fields.includes("category"))
|
|
166
174
|
extras.push("tag_category_name");
|
|
167
175
|
extras.push(...fields.filter((field) => !tagFields.includes(field)));
|
|
@@ -174,16 +182,19 @@ export async function exposureCommand(argv, store, factory = createTransport) {
|
|
|
174
182
|
if (flags.has("cursor")) {
|
|
175
183
|
try {
|
|
176
184
|
const text = flags.get("cursor");
|
|
177
|
-
if (text.length >
|
|
185
|
+
if (text.length > cursorMaxLength)
|
|
186
|
+
usage("Invalid cursor");
|
|
187
|
+
parsedCursor = cursorSchema.parse(JSON.parse(Buffer.from(text, "base64url").toString("utf8")));
|
|
188
|
+
if (parsedCursor.pending && (name !== "card list" && name !== "home" || parsedCursor.pending.length > parsedCursor.offset))
|
|
178
189
|
usage("Invalid cursor");
|
|
179
|
-
parsedCursor = z.strictObject({ scope: z.string(), offset: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER) }).parse(JSON.parse(Buffer.from(text, "base64url").toString("utf8")));
|
|
180
190
|
}
|
|
181
191
|
catch {
|
|
182
192
|
usage("Cursor does not match this profile, operation, fields or filters");
|
|
183
193
|
}
|
|
184
194
|
}
|
|
185
195
|
const config = flags.get("config"), selected = flags.get("profile");
|
|
186
|
-
|
|
196
|
+
// Never print the executable path: on a hosted server it is an absolute server path.
|
|
197
|
+
const identity = { description: DESCRIPTION };
|
|
187
198
|
let profile;
|
|
188
199
|
try {
|
|
189
200
|
store.readOnly();
|
|
@@ -262,22 +273,35 @@ export async function exposureCommand(argv, store, factory = createTransport) {
|
|
|
262
273
|
}
|
|
263
274
|
const rows = [];
|
|
264
275
|
const pages = new Set();
|
|
265
|
-
let
|
|
266
|
-
|
|
276
|
+
let pending = parsedCursor?.pending ?? [];
|
|
277
|
+
let total = parsedCursor?.total, complete = false, reason = "limit", failure;
|
|
278
|
+
const buffered = pending.map((record) => project(record));
|
|
279
|
+
rows.push(...buffered.slice(0, limit));
|
|
280
|
+
pending = pending.slice(rows.length);
|
|
281
|
+
complete = !pending.length && total !== undefined && offset >= total;
|
|
282
|
+
for (let page = 0; page < 20 && !complete && rows.length < limit; page++) {
|
|
267
283
|
const window = Math.min(name === "tag list" ? 1000 : 25, limit - rows.length);
|
|
268
284
|
try {
|
|
269
285
|
const response = (await transport.request(operation, { query: { ...query, limit: window, offset }, ...(body ? { body } : {}) })).body;
|
|
270
|
-
if (response.data.length > window)
|
|
271
|
-
throw new TransportError({ code: "RESPONSE_INVALID", message: "Tenable returned more rows than
|
|
286
|
+
if (response.data.length > (name === "tag list" ? window : 25))
|
|
287
|
+
throw new TransportError({ code: "RESPONSE_INVALID", message: "Tenable returned more rows than the page bound", operation });
|
|
272
288
|
const records = response.data.map((record) => project(name === "tag list" ? tagRecord.parse(record) : cardRecord.parse(record)));
|
|
273
289
|
const pageIdentity = JSON.stringify(response.data.map((record) => record.id));
|
|
274
290
|
if (records.length && pages.has(pageIdentity))
|
|
275
291
|
throw new TransportError({ code: "CONTINUATION_REPEATED", message: "Tenable repeated a result page; resume after checking the collection", operation });
|
|
276
292
|
pages.add(pageIdentity);
|
|
277
|
-
|
|
293
|
+
const remainder = response.data.slice(window);
|
|
294
|
+
// Redact before encoding: base64 cursors must not bypass output redaction.
|
|
295
|
+
const nextPending = store.redactor.payload(remainder);
|
|
296
|
+
const nextTotal = response.pagination?.total_record_count ?? response.pagination?.total ?? total;
|
|
297
|
+
const nextCursor = Buffer.from(JSON.stringify({ scope, offset: offset + records.length, pending: nextPending, total: nextTotal })).toString("base64url");
|
|
298
|
+
if (nextCursor.length > cursorMaxLength)
|
|
299
|
+
throw new TransportError({ code: "RESPONSE_INVALID", message: "Card continuation exceeds the cursor byte bound", operation });
|
|
300
|
+
pending = nextPending;
|
|
301
|
+
rows.push(...records.slice(0, window));
|
|
278
302
|
offset += records.length;
|
|
279
|
-
total =
|
|
280
|
-
complete = records.length === 0 || total !== undefined && offset >= total;
|
|
303
|
+
total = nextTotal;
|
|
304
|
+
complete = !pending.length && (records.length === 0 || total !== undefined && offset >= total);
|
|
281
305
|
if (complete || rows.length >= limit || name === "home")
|
|
282
306
|
break;
|
|
283
307
|
reason = "request budget";
|
|
@@ -294,9 +318,9 @@ export async function exposureCommand(argv, store, factory = createTransport) {
|
|
|
294
318
|
if (failure)
|
|
295
319
|
process.exitCode = 1;
|
|
296
320
|
const noun = name === "tag list" ? "tags" : "cards";
|
|
297
|
-
const suffix = [config ? `--config ${quote(config)}` : "", selected ? `--profile ${quote(selected)}` : ""].filter(Boolean).join(" ");
|
|
298
|
-
const resumeArgs =
|
|
299
|
-
const cursor = Buffer.from(JSON.stringify({ scope, offset })).toString("base64url");
|
|
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] ?? ""));
|
|
323
|
+
const cursor = Buffer.from(JSON.stringify({ scope, offset, ...(pending.length ? { pending } : {}), ...(total === undefined ? {} : { total }) })).toString("base64url");
|
|
300
324
|
return { ...(name === "home" ? { ...identity, ...context } : {}), [noun]: rows, count: rows.length, ...(total === undefined ? {} : { total }), complete,
|
|
301
325
|
...(!rows.length ? { message: `0 ${noun} matched the selected filters` } : {}),
|
|
302
326
|
...(!complete ? { reason, cursor } : {}),
|
|
@@ -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>;
|
|
@@ -35,11 +35,17 @@ export const inventoryBindings = Object.freeze(Object.fromEntries(Object.keys(in
|
|
|
35
35
|
effect: "read", query: ["offset", "limit", "sort", "extra_properties"], paging: ["offset", "limit"], decoder: inventoryPage }],
|
|
36
36
|
[`inventory-${kind}-properties-list`, { ...advice, method: "GET", path: `/api/v1/t1/inventory/${noun}/properties`,
|
|
37
37
|
effect: "read", query: kind === "asset" ? ["asset_classes"] : [],
|
|
38
|
-
decoder: kind === "asset" ? z.object({ properties })
|
|
38
|
+
decoder: kind === "asset" ? z.union([z.object({ properties }).transform(({ properties }) => ({ data: properties })),
|
|
39
|
+
z.object({ data: properties })]) : z.object({ data: properties }) }],
|
|
39
40
|
];
|
|
40
41
|
})));
|
|
41
|
-
const
|
|
42
|
-
|
|
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`;
|
|
43
49
|
const collection = { limit: "Maximum emitted rows, 1-10000; default 100", all: "Read up to 10000 rows within invocation budgets; excludes --limit",
|
|
44
50
|
cursor: "Opaque resume cursor; retain the original selectors and filters" };
|
|
45
51
|
const search = { query: "Simple query text", filter: "Repeatable: <property> <operator> <JSON string array>",
|
|
@@ -48,14 +54,19 @@ const search = { query: "Simple query text", filter: "Repeatable: <property> <op
|
|
|
48
54
|
export const inventoryCatalogue = Object.fromEntries(Object.keys(inventoryKinds).flatMap((kind) => [
|
|
49
55
|
[`${kind} list`, { description: `Search ${inventoryKinds[kind]}${kind === "software" ? "; the pinned API exposes no stable software ID" : ""}`,
|
|
50
56
|
operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
|
|
51
|
-
flags: { ...common, ...collection, ...search,
|
|
52
|
-
|
|
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"] : [])] }],
|
|
53
64
|
[`${kind} properties`, { description: `Discover ${kind} properties and supported operators`,
|
|
54
65
|
operationId: `inventory-${kind}-properties-list`, defaultFields: ["key", "readable_name", "operators", "sortable", "filterable"], evidence: "specs/exposure-management.json",
|
|
55
|
-
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" } : {}) },
|
|
56
67
|
examples: [`tenable-axi ${kind} properties`, `tenable-axi ${kind} properties --full`] }],
|
|
57
68
|
...(kind === "software" ? [] : [[`${kind} show`, { description: `Find one ${kind} by exact ID search`,
|
|
58
69
|
operationId: `inventory-${inventoryKinds[kind]}-search`, defaultFields: defaultFields[kind], evidence: "specs/exposure-management.json",
|
|
59
|
-
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"] },
|
|
60
71
|
examples: [`tenable-axi ${kind} show --id <id>`, `tenable-axi ${kind} show --id <id> --fields id,name,description --full`] }]]),
|
|
61
72
|
]));
|
|
@@ -37,7 +37,7 @@ const common = { config: "Config path; default platform path", profile: "Profile
|
|
|
37
37
|
export const inventoryExportCatalogue = {};
|
|
38
38
|
for (const kind of ["asset", "finding"]) {
|
|
39
39
|
inventoryExportCatalogue[`export ${kind} start`] = { description: `Preview or create an inventory ${kind} export job`, operationId: `inventory-export-${kind}s`,
|
|
40
|
-
flags: { ...common, "body-file": "Optional strict query/filters JSON file, '-' for stdin; maximum 1 MiB", properties:
|
|
40
|
+
flags: { ...common, "body-file": "Optional strict query/filters JSON file, '-' for stdin; maximum 1 MiB", properties: `Comma-separated names from ${kind} properties; id maps to ${kind}_id`, "use-readable-name": "true|false; API default true",
|
|
41
41
|
"max-chunk-file-size": "5242880-104857600 bytes; API default 20971520", sort: "property:asc|desc", "file-format": "JSON|CSV; API default JSON", compress: "true|false; API default false",
|
|
42
42
|
execute: "Create once; default preview", "dry-run": "Explicit preview; excludes --execute", confirm: "Exact confirmation from preview", "intent-id": "Unique execution intent for replay protection" },
|
|
43
43
|
defaultFields: ["id", "state"], examples: [`tenable-axi export ${kind} start --body-file scope.json`, `tenable-axi export ${kind} start --body-file scope.json --execute --confirm <confirmation>`] };
|
|
@@ -91,6 +91,8 @@ export async function inventoryExportCommand(argv, store, factory = createTransp
|
|
|
91
91
|
usage("Invalid chunk size");
|
|
92
92
|
value = Number(raw);
|
|
93
93
|
}
|
|
94
|
+
if (key === "properties")
|
|
95
|
+
value = raw.split(",").map((property) => property === "id" ? `${argv[1]}_id` : property).join(",");
|
|
94
96
|
return [[key.replaceAll("-", "_"), value]];
|
|
95
97
|
}));
|
|
96
98
|
const input = exportInput.safeParse({ ...(body === undefined ? {} : { body }), query });
|
package/dist/src/inventory.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
129
|
+
invalidFilter();
|
|
122
130
|
let value;
|
|
123
131
|
try {
|
|
124
132
|
value = JSON.parse(match[3]);
|
|
125
133
|
}
|
|
126
134
|
catch {
|
|
127
|
-
|
|
135
|
+
invalidFilter();
|
|
128
136
|
}
|
|
129
137
|
const parsed = filterSchema.safeParse({ property: match[1], operator: match[2], value });
|
|
130
138
|
if (!parsed.success)
|
|
131
|
-
|
|
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,
|
|
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(
|
|
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;
|
|
@@ -206,7 +213,7 @@ export async function inventoryCommand(argv, store, transportFactory = createTra
|
|
|
206
213
|
let data;
|
|
207
214
|
let exhausted;
|
|
208
215
|
if (verb === "properties") {
|
|
209
|
-
data = response.body
|
|
216
|
+
data = response.body.data;
|
|
210
217
|
exhausted = true;
|
|
211
218
|
}
|
|
212
219
|
else {
|
|
@@ -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", "
|
|
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)
|
|
@@ -41,8 +41,8 @@ const definitions = [
|
|
|
41
41
|
["tags-list-tag-values", "GET", "/tags/values", "read", ["f", "ft", "wf", "w", "limit", "offset", "sort"], list("values"), "Basic [16]"],
|
|
42
42
|
["tags-tag-value-details", "GET", "/tags/values/{tag_value_uuid}", "read", [], detail, "Basic [16]"],
|
|
43
43
|
["tags-update-tag-value", "PUT", "/tags/values/{tag_value_uuid}", "write", [], detail, "Scan Operator [24] or PS.ACCT_MGMT.TAGS.EDIT"],
|
|
44
|
-
["tags-delete-tag-value", "DELETE", "/tags/values/{tag_value_uuid}", "write", [],
|
|
45
|
-
["tags-delete-tag-values-bulk", "POST", "/tags/values/delete-requests", "write", [],
|
|
44
|
+
["tags-delete-tag-value", "DELETE", "/tags/values/{tag_value_uuid}", "write", [], z.unknown(), "Scan Operator [24] or PS.ACCT_MGMT.TAGS.DELETE; edit permission on the value"],
|
|
45
|
+
["tags-delete-tag-values-bulk", "POST", "/tags/values/delete-requests", "write", [], z.unknown(), "Scan Operator [24] or PS.ACCT_MGMT.TAGS.DELETE"],
|
|
46
46
|
["tags-assign-asset-tags", "POST", "/tags/assets/assignments", "write", [], z.object({ job_uuid: z.string().min(1) }), "Basic [16]"],
|
|
47
47
|
["tags-list-asset-tags", "GET", "/tags/assets/{asset_uuid}/assignments", "read", [], z.object({ tags: z.array(z.object({ asset_uuid: uuid, value_uuid: uuid }).passthrough()) }), "Basic [16] or PS.ACCT_MGMT.TAGS.READ"],
|
|
48
48
|
["tags-list-exclusions", "GET", "/tags/values/{tag_value_uuid}/exclusions", "read", ["target_type", "limit", "offset"], list("excluded_targets"), "Basic [16] or PS.ACCT_MGMT.TAGS.READ"],
|
package/dist/src/platform-tag.js
CHANGED
|
@@ -126,7 +126,17 @@ export async function platformTagCommand(argv, store, factory = createTransport,
|
|
|
126
126
|
const input = platformTagInputs[operation].safeParse({ ...(get("id") ? { id: get("id") } : {}), ...(body === undefined ? {} : { body }) });
|
|
127
127
|
if (!input.success)
|
|
128
128
|
usage("Invalid tag input; use documented fields and UUID arrays, at most 40 dynamic rules and 1024 values per rule; security fields are forbidden");
|
|
129
|
-
const
|
|
129
|
+
const readBack = "The write succeeded; read back the target before retrying";
|
|
130
|
+
const result = await writeFactory({ config: get("config"), profile: get("profile") }).run(operation, input.data, { execute: !!get("execute"), dryRun: !!get("dry-run"), confirm: get("confirm"), intentId: get("intent-id") }).catch((error) => {
|
|
131
|
+
if (!value || !["delete", "bulk-delete"].includes(verb)
|
|
132
|
+
|| !(error instanceof TransportError) || error.error.code !== "RESPONSE_INVALID" || !error.error.auditId
|
|
133
|
+
|| error.error.status === undefined || error.error.status < 200 || error.error.status >= 300)
|
|
134
|
+
throw error;
|
|
135
|
+
return { kind: "success", auditId: error.error.auditId, status: error.error.status,
|
|
136
|
+
warning: "Write succeeded, but its response could not be decoded", help: [readBack] };
|
|
137
|
+
});
|
|
138
|
+
if ("warning" in result)
|
|
139
|
+
return result;
|
|
130
140
|
if (result.kind !== "success") {
|
|
131
141
|
const output = preview(result);
|
|
132
142
|
return { ...output, ...(truncated ? { help: [`Run ${command(["--full"])} --full to read complete text`] } : {}) };
|
package/dist/src/private-file.js
CHANGED
|
@@ -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 = (
|
|
31
|
-
throw new AxiError(
|
|
32
|
-
platform === "win32" ?
|
|
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,
|
|
35
|
+
function validate(stat, secret) {
|
|
36
36
|
if (!stat.isFile() || stat.isSymbolicLink())
|
|
37
|
-
insecure(
|
|
37
|
+
insecure();
|
|
38
38
|
if (platform !== "win32" && (stat.uid !== (options.uid ?? process.getuid()) || (stat.mode & (secret ? 0o077 : 0o022)) !== 0))
|
|
39
|
-
insecure(
|
|
39
|
+
insecure();
|
|
40
40
|
}
|
|
41
41
|
function check(path, secret = false, verifyAcl = false) {
|
|
42
|
-
validate(lstatSync(path),
|
|
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(
|
|
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),
|
|
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(
|
|
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(
|
|
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(
|
|
112
|
+
insecure();
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
writeFileSync(fd, content, "utf8");
|
package/dist/src/profiles.d.ts
CHANGED
|
@@ -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
|
-
|
|
93
|
-
|
|
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) => {
|
package/dist/src/profiles.js
CHANGED
|
@@ -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("
|
|
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
|
|
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
|
|
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,
|
|
137
|
-
|
|
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) {
|
|
@@ -224,7 +224,7 @@ export function constructTransport(options, dependencies) {
|
|
|
224
224
|
const hint = status === 401 ? "Check both SecretRefs and run tenable-axi auth status"
|
|
225
225
|
: status === 403 ? record.permissionHelp : status === 404 ? "Check the resource identifier and operation scope"
|
|
226
226
|
: status === 429 ? "Retry after the reported delay; narrow reads to reduce requests" : record.validationHelp;
|
|
227
|
-
const message = errorMessage(text) ?? `Tenable returned HTTP ${status}`;
|
|
227
|
+
const message = status === 403 ? "Not licensed or not permitted for this key" : errorMessage(text) ?? `Tenable returned HTTP ${status}`;
|
|
228
228
|
fail(code, redact(message), operation, [hint], { status,
|
|
229
229
|
...(lastRetryAfter === undefined ? {} : { retryAfter: lastRetryAfter }) });
|
|
230
230
|
}
|
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
|
|
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
|
|
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 |
|
|
@@ -429,7 +430,7 @@ Operation: `inventory-export-assets`.
|
|
|
429
430
|
| `--full` | Full output; default false |
|
|
430
431
|
| `--help` | Show help |
|
|
431
432
|
| `--body-file` | Optional strict query/filters JSON file, '-' for stdin; maximum 1 MiB |
|
|
432
|
-
| `--properties` | Comma-separated
|
|
433
|
+
| `--properties` | Comma-separated names from asset properties; id maps to asset_id |
|
|
433
434
|
| `--use-readable-name` | true\|false; API default true |
|
|
434
435
|
| `--max-chunk-file-size` | 5242880-104857600 bytes; API default 20971520 |
|
|
435
436
|
| `--sort` | property:asc\|desc |
|
|
@@ -568,7 +569,7 @@ Operation: `inventory-export-findings`.
|
|
|
568
569
|
| `--full` | Full output; default false |
|
|
569
570
|
| `--help` | Show help |
|
|
570
571
|
| `--body-file` | Optional strict query/filters JSON file, '-' for stdin; maximum 1 MiB |
|
|
571
|
-
| `--properties` | Comma-separated
|
|
572
|
+
| `--properties` | Comma-separated names from finding properties; id maps to finding_id |
|
|
572
573
|
| `--use-readable-name` | true\|false; API default true |
|
|
573
574
|
| `--max-chunk-file-size` | 5242880-104857600 bytes; API default 20971520 |
|
|
574
575
|
| `--sort` | property:asc\|desc |
|
|
@@ -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
|
|
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
|
|
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,15 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowttl/tenable-axi",
|
|
3
|
-
"version": "0.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",
|
|
7
|
-
"bin": {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
7
|
+
"bin": {
|
|
8
|
+
"tenable-axi": "bin/tenable-axi.js",
|
|
9
|
+
"tenable-axi-hook": "bin/tenable-axi-hook.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
"./catalogue": "./dist/src/catalogue.js",
|
|
13
|
+
"./inventory": "./inventory/capabilities.json",
|
|
14
|
+
"./axi-credential.schema.json": "./axi-credential.schema.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin",
|
|
18
|
+
"dist/src",
|
|
19
|
+
"inventory/capabilities.json",
|
|
20
|
+
"axi-credential.schema.json",
|
|
21
|
+
"docs/commands.md",
|
|
22
|
+
"skills"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/knowttl/tenable-axi.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.12.0"
|
|
33
|
+
},
|
|
13
34
|
"packageManager": "pnpm@10.34.6",
|
|
14
35
|
"scripts": {
|
|
15
36
|
"build": "tsc -p tsconfig.json",
|
|
@@ -21,6 +42,16 @@
|
|
|
21
42
|
"spec:generate": "node scripts/specs.mjs --generate",
|
|
22
43
|
"spec:check": "node scripts/specs.mjs --check"
|
|
23
44
|
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@toon-format/toon": "2.3.1",
|
|
47
|
+
"axi-sdk-js": "0.1.13",
|
|
48
|
+
"zod": "4.3.6",
|
|
49
|
+
"smol-toml": "1.9.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "22.20.5",
|
|
53
|
+
"typescript": "5.9.3",
|
|
54
|
+
"vitest": "5.0.2",
|
|
55
|
+
"openapi-typescript": "7.13.0"
|
|
56
|
+
}
|
|
26
57
|
}
|