securewithtrace 0.21.2 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/index.js +46 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,12 @@ tracecli vulnerabilities list --severity CRITICAL --status OPEN
|
|
|
129
129
|
# Increase result limit
|
|
130
130
|
tracecli vulnerabilities list --limit 100
|
|
131
131
|
|
|
132
|
+
# Filter by CWE ID
|
|
133
|
+
tracecli vulnerabilities list --filter cweId=CWE-89
|
|
134
|
+
|
|
135
|
+
# Filter by vulnerability type and scan mode (repeatable)
|
|
136
|
+
tracecli vulnerabilities list --filter vulnerabilityType=SAST --filter scanMode!=DAST
|
|
137
|
+
|
|
132
138
|
# JSON output for scripting
|
|
133
139
|
tracecli vulnerabilities list --output json | jq '.[].title'
|
|
134
140
|
|
|
@@ -146,6 +152,7 @@ Flags:
|
|
|
146
152
|
| `--repo <repo>` | | Filter by repository name or `owner/repo` |
|
|
147
153
|
| `--severity <level>` | | Filter by severity |
|
|
148
154
|
| `--status <status>` | | Filter by status |
|
|
155
|
+
| `--filter <expression>` | `-f` | Repeatable filter expression: `field=value` or `field!=value`. Supported fields: `repositoryId`, `severity`, `vulnerabilityType`, `status`, `cweId`, `scanMode` |
|
|
149
156
|
| `--limit <n>` | `-L` | Max results (default: 30, max: 100) |
|
|
150
157
|
| `--output <format>` | `-o` | Output format: `table` (default), `json`, `tsv` |
|
|
151
158
|
| `--web` | `-w` | Open vulnerabilities dashboard in browser |
|
|
@@ -222,6 +229,9 @@ tracecli upgrade --check
|
|
|
222
229
|
# Upgrade to the latest published CLI version
|
|
223
230
|
tracecli upgrade
|
|
224
231
|
|
|
232
|
+
# Non-interactive upgrade (CI/scripts)
|
|
233
|
+
tracecli upgrade --no-confirm
|
|
234
|
+
|
|
225
235
|
# Alias
|
|
226
236
|
tracecli self-update
|
|
227
237
|
```
|
|
@@ -231,7 +241,8 @@ Flags:
|
|
|
231
241
|
| Flag | Shorthand | Description |
|
|
232
242
|
|------|-----------|-------------|
|
|
233
243
|
| `--check` | | Check for updates without installing |
|
|
234
|
-
| `--
|
|
244
|
+
| `--no-confirm` | | Skip confirmation prompt (for CI/scripts) |
|
|
245
|
+
| `--yes` | `-y` | Skip confirmation prompt (alias: `--no-confirm`) |
|
|
235
246
|
|
|
236
247
|
## Security Notes
|
|
237
248
|
|
package/dist/index.js
CHANGED
|
@@ -28922,12 +28922,13 @@ async function promptForUpgradeConfirmation(latestVersion) {
|
|
|
28922
28922
|
}
|
|
28923
28923
|
}
|
|
28924
28924
|
function createUpgradeCommand() {
|
|
28925
|
-
return new Command("upgrade").alias("self-update").description("Upgrade tracecli to the latest version").option("--check", "Check whether an update is available").option("-y, --yes", "Skip upgrade confirmation prompt").addHelpText(
|
|
28925
|
+
return new Command("upgrade").alias("self-update").description("Upgrade tracecli to the latest version").option("--check", "Check whether an update is available").option("--no-confirm", "Skip upgrade confirmation prompt (for CI/scripts)").option("-y, --yes", "Skip upgrade confirmation prompt (alias: --no-confirm)").addHelpText(
|
|
28926
28926
|
"after",
|
|
28927
28927
|
`
|
|
28928
28928
|
Examples:
|
|
28929
28929
|
tracecli upgrade
|
|
28930
28930
|
tracecli upgrade --check
|
|
28931
|
+
tracecli upgrade --no-confirm
|
|
28931
28932
|
tracecli self-update`
|
|
28932
28933
|
).action(async (options) => {
|
|
28933
28934
|
const availability = await getUpdateAvailability(true);
|
|
@@ -28949,7 +28950,7 @@ Examples:
|
|
|
28949
28950
|
return;
|
|
28950
28951
|
}
|
|
28951
28952
|
const versionLabel = availability.latestVersion ?? "the latest available version";
|
|
28952
|
-
const shouldUpgrade = options.yes ? true : await promptForUpgradeConfirmation(versionLabel);
|
|
28953
|
+
const shouldUpgrade = !options.confirm || !!options.yes ? true : await promptForUpgradeConfirmation(versionLabel);
|
|
28953
28954
|
if (!shouldUpgrade) {
|
|
28954
28955
|
console.log("Upgrade cancelled.");
|
|
28955
28956
|
return;
|
|
@@ -28981,6 +28982,34 @@ Examples:
|
|
|
28981
28982
|
// src/vulnerabilities/commands.ts
|
|
28982
28983
|
var DEFAULT_LIMIT3 = 30;
|
|
28983
28984
|
var MAX_LIMIT3 = 100;
|
|
28985
|
+
var VULNERABILITY_FILTER_FIELDS = [
|
|
28986
|
+
"repositoryId",
|
|
28987
|
+
"severity",
|
|
28988
|
+
"vulnerabilityType",
|
|
28989
|
+
"status",
|
|
28990
|
+
"cweId",
|
|
28991
|
+
"scanMode"
|
|
28992
|
+
];
|
|
28993
|
+
function parseVulnerabilityFilter(expression) {
|
|
28994
|
+
const match = expression.match(/^([^!=]+)(!=|=)(.+)$/);
|
|
28995
|
+
if (!match?.[1] || !match[2] || !match[3]) {
|
|
28996
|
+
return {
|
|
28997
|
+
error: `Invalid filter expression '${expression}'. Expected format: field=value or field!=value (e.g. cweId=CWE-89).`
|
|
28998
|
+
};
|
|
28999
|
+
}
|
|
29000
|
+
const field = match[1].trim();
|
|
29001
|
+
const op = match[2];
|
|
29002
|
+
const value = match[3].trim();
|
|
29003
|
+
if (value.length === 0) {
|
|
29004
|
+
return { error: `Filter value cannot be empty in expression '${expression}'.` };
|
|
29005
|
+
}
|
|
29006
|
+
if (!VULNERABILITY_FILTER_FIELDS.includes(field)) {
|
|
29007
|
+
return {
|
|
29008
|
+
error: `Unknown filter field '${field}'. Supported fields: ${VULNERABILITY_FILTER_FIELDS.join(", ")}.`
|
|
29009
|
+
};
|
|
29010
|
+
}
|
|
29011
|
+
return { field, operator: op === "!=" ? "neq" : "eq", value };
|
|
29012
|
+
}
|
|
28984
29013
|
async function resolveRepositoryIdAuthenticated(organizationId, repoIdentifier) {
|
|
28985
29014
|
const result = await authenticatedRequest(
|
|
28986
29015
|
(client) => client.repository.listRepositories({
|
|
@@ -29098,6 +29127,11 @@ function createListCommand3() {
|
|
|
29098
29127
|
}
|
|
29099
29128
|
return Math.min(n, MAX_LIMIT3);
|
|
29100
29129
|
}
|
|
29130
|
+
).option(
|
|
29131
|
+
"-f, --filter <expression>",
|
|
29132
|
+
"Additional filter expression: field=value or field!=value. Repeatable. Supported fields: vulnerabilityType, cweId, scanMode (and any other API-supported field).",
|
|
29133
|
+
(value, previous) => [...previous, value],
|
|
29134
|
+
[]
|
|
29101
29135
|
).option("-o, --output <format>", "Output format: table, json, tsv (default: table)", "table").option("-w, --web", "Open the vulnerabilities dashboard in a browser").addHelpText(
|
|
29102
29136
|
"after",
|
|
29103
29137
|
`
|
|
@@ -29105,6 +29139,8 @@ Examples:
|
|
|
29105
29139
|
tracecli vulnerabilities list
|
|
29106
29140
|
tracecli vulnerabilities list --severity CRITICAL --status OPEN
|
|
29107
29141
|
tracecli vulnerabilities list --repo securewithtrace/trace --limit 50
|
|
29142
|
+
tracecli vulnerabilities list --filter cweId=CWE-89
|
|
29143
|
+
tracecli vulnerabilities list --filter vulnerabilityType=SAST --filter scanMode=sast
|
|
29108
29144
|
tracecli vulnerabilities list --output json | jq '.[].title'
|
|
29109
29145
|
tracecli vulnerabilities list --output tsv | cut -f1,7
|
|
29110
29146
|
tracecli vulnerabilities list --web`
|
|
@@ -29131,6 +29167,14 @@ Examples:
|
|
|
29131
29167
|
if (options.status) {
|
|
29132
29168
|
conditions.push({ field: "status", operator: "eq", value: options.status });
|
|
29133
29169
|
}
|
|
29170
|
+
for (const expression of options.filter) {
|
|
29171
|
+
const parsed = parseVulnerabilityFilter(expression);
|
|
29172
|
+
if ("error" in parsed) {
|
|
29173
|
+
console.error(parsed.error);
|
|
29174
|
+
process.exit(1);
|
|
29175
|
+
}
|
|
29176
|
+
conditions.push({ field: parsed.field, operator: parsed.operator, value: parsed.value });
|
|
29177
|
+
}
|
|
29134
29178
|
const filterBody = {
|
|
29135
29179
|
filters: conditions.length > 0 ? { operator: "and", conditions } : void 0,
|
|
29136
29180
|
defaultBranchOnly: true,
|