Skip to content

Commit 8ce98b4

Browse files
vmrh21claude
andcommitted
feat: add subcomponent filter to cve.find
Allow users to optionally scope cve.find to a specific subcomponent: /cve.find llm-d autoscaler /cve.find "AI Evaluations" trustyai-ragas Reverse-looks up all containers for the given subcomponent from component-repository-mappings.json and adds pscomponent: label filters to the JQL using OR when multiple containers exist (e.g. lm-evaluation-harness has both odh-ta-lmes-driver and odh-ta-lmes-job containers). cve.fix requires no changes — it reads from the scoped find output and its container-based repo scoping handles the rest automatically. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent dd5593f commit 8ce98b4

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

workflows/cve-fixer/.claude/commands/cve.find.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,26 @@ Report: artifacts/cve-fixer/find/cve-issues-20260226-145018.md
3131
## Process
3232

3333
1. **Parse Arguments and Flags**
34-
- Parse the command arguments for both the component name and optional flags
34+
- Parse the command arguments for the component name, optional subcomponent, and optional flags
3535
- **Supported flags:**
3636
- `--ignore-resolved` — Exclude issues with Jira status "Resolved" from results
37-
- The component name is any argument that is not a flag
37+
- The component name is the first argument that is not a flag
38+
- The subcomponent is the second positional argument that is not a flag (optional)
3839
- If component is not provided, ask the user to type the component name
3940
- **IMPORTANT**: Let the user type the component name freely as text input
4041
- **DO NOT** provide multiple-choice options or suggestions
4142
- **DO NOT** use AskUserQuestion tool with predefined options
4243
- Simply ask: "What is the component name?" and wait for user's text response
4344
- Store the `--ignore-resolved` flag as a boolean for use in step 3
4445

46+
**Examples:**
47+
```bash
48+
/cve.find llm-d # all llm-d CVEs
49+
/cve.find llm-d autoscaler # only autoscaler CVEs
50+
/cve.find llm-d autoscaler --ignore-resolved
51+
/cve.find "AI Evaluations" trustyai-ragas
52+
```
53+
4554
2. **Check JIRA API Token (REQUIRED - User Setup)**
4655
- **This is the ONLY thing the user must configure manually before proceeding**
4756

@@ -120,6 +129,28 @@ Report: artifacts/cve-fixer/find/cve-issues-20260226-145018.md
120129
# Build JQL query
121130
JQL="component = \"${COMPONENT_NAME}\" AND summary ~ \"CVE*\" AND labels = SecurityTracking"
122131
132+
# Append subcomponent filter if provided
133+
if [ -n "$SUBCOMPONENT" ] && [ -n "$MAPPING_FILE" ] && [ -f "$MAPPING_FILE" ]; then
134+
# Reverse lookup: find ALL containers whose primary repo has matching subcomponent
135+
PSCOMPONENTS=$(jq -r --arg comp "$COMPONENT_NAME" --arg sub "$SUBCOMPONENT" '
136+
.components[$comp] as $c |
137+
$c.container_to_repo_mapping | to_entries[] |
138+
select($c.repositories[.value].subcomponent == $sub) |
139+
"pscomponent:" + .key
140+
' "$MAPPING_FILE")
141+
142+
if [ -n "$PSCOMPONENTS" ]; then
143+
# Build OR clause for all matching containers
144+
LABEL_FILTERS=$(echo "$PSCOMPONENTS" | \
145+
awk '{print "labels = \"" $0 "\""}' | \
146+
paste -sd ' OR ' -)
147+
JQL="${JQL} AND (${LABEL_FILTERS})"
148+
echo "Filtering by subcomponent '${SUBCOMPONENT}': ${PSCOMPONENTS}"
149+
else
150+
echo "⚠️ Subcomponent '${SUBCOMPONENT}' not found in mapping for '${COMPONENT_NAME}' — running without subcomponent filter"
151+
fi
152+
fi
153+
123154
# Append resolved filter if --ignore-resolved flag was provided
124155
if [ "$IGNORE_RESOLVED" = "true" ]; then
125156
JQL="${JQL} AND status not in (\"Resolved\")"

0 commit comments

Comments
 (0)