Skip to content

Commit da8f20d

Browse files
jwm4claude
andcommitted
fix: resolve merge conflict with upstream cve-fixer changes
Take upstream's updated systemPrompt (adds component mapping note and team onboarding reference) and our startupPrompt rewrite (directive style). Also incorporated the onboarding reference into the directive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 parents ed5bf98 + 4bfd9e5 commit da8f20d

4 files changed

Lines changed: 511 additions & 17 deletions

File tree

workflows/cve-fixer/.ambient/ambient.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "CVE Fixer",
33
"description": "Automate remediation of CVE issues reported by ProdSec team in Jira by creating pull requests with dependency updates and patches",
4-
"systemPrompt": "You are a CVE remediation assistant for the Ambient Code Platform. Your role is to help users remediate CVE issues that have been reported by the ProdSec team in Jira by automatically creating pull requests with fixes.\n\nKEY RESPONSIBILITIES:\n- Guide users through the CVE remediation workflow for Jira-tracked vulnerabilities\n- Execute slash commands to perform specific security tasks\n- Find CVE issues opened by ProdSec team in Jira\n- Implement secure fixes that resolve vulnerabilities without breaking functionality\n- Create pull requests with dependency updates, patches, and comprehensive test results\n\nWORKFLOW METHODOLOGY:\n1. FIND - Find CVEs already reported in Jira for a component\n2. FIX - Implement remediation strategies (dependency updates, patches, code changes, PR creation)\n\nAVAILABLE COMMANDS:\n/cve.find - Find CVEs reported in Jira for a specific component\n/cve.fix - Implement fixes for discovered CVEs and create pull requests\n\nOUTPUT LOCATIONS:\n- Create all Jira CVE findings in: artifacts/cve-fixer/find/\n- Create all fix implementations in: artifacts/cve-fixer/fixes/\n\nFIRST TIME SETUP:\nBefore using any slash commands, ensure the workspace is initialized and security scanning tools are available.",
5-
"startupPrompt": "Greet the user and introduce yourself as a CVE remediation assistant. Explain that you help remediate CVE issues reported by ProdSec in Jira by creating pull requests. Mention the two commands: /cve.find to discover CVEs and /cve.fix to implement fixes. Suggest starting with /cve.find and ask what they'd like to work on.",
4+
"systemPrompt": "You are a CVE remediation assistant for the Ambient Code Platform. Your role is to help users remediate CVE issues that have been reported by the ProdSec team in Jira by automatically creating pull requests with fixes.\n\nKEY RESPONSIBILITIES:\n- Guide users through the CVE remediation workflow for Jira-tracked vulnerabilities\n- Execute slash commands to perform specific security tasks\n- Find CVE issues opened by ProdSec team in Jira\n- Implement secure fixes that resolve vulnerabilities without breaking functionality\n- Create pull requests with dependency updates, patches, and comprehensive test results\n\nWORKFLOW METHODOLOGY:\n1. FIND - Find CVEs already reported in Jira for a component\n2. FIX - Implement remediation strategies (dependency updates, patches, code changes, PR creation)\n\nAVAILABLE COMMANDS:\n/cve.find - Find CVEs reported in Jira for a specific component\n/cve.fix - Implement fixes for discovered CVEs and create pull requests\n\nOUTPUT LOCATIONS:\n- Create all Jira CVE findings in: artifacts/cve-fixer/find/\n- Create all fix implementations in: artifacts/cve-fixer/fixes/\n\nNote: Commands will guide you through required setup steps on first use. If the user's component is not in component-repository-mappings.json, direct them to the \"Team Onboarding\" section in README.md.",
5+
"startupPrompt": "Greet the user and introduce yourself as a CVE remediation assistant. Explain that you help remediate CVE issues reported by ProdSec in Jira by creating pull requests. Mention the two commands: /cve.find to discover CVEs and /cve.fix to implement fixes. If this is their first time, point them to README.md Team Onboarding for setup. Suggest starting with /cve.find and ask what they'd like to work on.",
66
"results": {
77
"Jira CVE Issues": "artifacts/cve-fixer/find/**/*.md",
88
"Fix Implementations": "artifacts/cve-fixer/fixes/**/*"

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,26 @@ Report: artifacts/cve-fixer/find/cve-issues-20260226-145018.md
9999
100100
b. Construct JQL query and execute API call:
101101
```bash
102+
# Normalize component name with case-insensitive lookup against mapping file
103+
# Try relative to cwd (workflow root), then repo-relative fallback
104+
if [ -f "component-repository-mappings.json" ]; then
105+
MAPPING_FILE="component-repository-mappings.json"
106+
elif [ -f "workflows/cve-fixer/component-repository-mappings.json" ]; then
107+
MAPPING_FILE="workflows/cve-fixer/component-repository-mappings.json"
108+
else
109+
MAPPING_FILE=""
110+
fi
111+
if [ -n "$MAPPING_FILE" ] && [ -f "$MAPPING_FILE" ]; then
112+
CANONICAL_NAME=$(jq -r --arg name "${COMPONENT_NAME}" \
113+
'.components | keys[] | select(ascii_downcase == ($name | ascii_downcase))' \
114+
"$MAPPING_FILE" | head -1)
115+
if [ -n "$CANONICAL_NAME" ]; then
116+
COMPONENT_NAME="$CANONICAL_NAME"
117+
fi
118+
fi
119+
102120
# Build JQL query
103-
JQL="project = RHOAIENG AND component = \"${COMPONENT_NAME}\" AND summary ~ \"CVE*\""
121+
JQL="component = \"${COMPONENT_NAME}\" AND summary ~ \"CVE*\" AND labels = SecurityTracking"
104122
105123
# Append resolved filter if --ignore-resolved flag was provided
106124
if [ "$IGNORE_RESOLVED" = "true" ]; then
@@ -332,7 +350,7 @@ Report: artifacts/cve-fixer/find/cve-issues-20260226-145018.md
332350
**Ignored Issues:** ${IGNORED_COUNT}
333351
334352
## Query Parameters
335-
- **JQL Query:** project = RHOAIENG AND component = "${COMPONENT_NAME}" AND summary ~ "CVE*"$( [ "$IGNORE_RESOLVED" = "true" ] && echo ' AND status not in ("Resolved")' )
353+
- **JQL Query:** component = "${COMPONENT_NAME}" AND summary ~ "CVE*" AND labels = SecurityTracking$( [ "$IGNORE_RESOLVED" = "true" ] && echo ' AND status not in ("Resolved")' )
336354
- **Columns:** KEY, SUMMARY, STATUS, PRIORITY, CREATED, COMPONENTS
337355
- **Jira Instance:** ${JIRA_BASE_URL}
338356

workflows/cve-fixer/README.md

Lines changed: 144 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,139 @@ This workflow helps you remediate CVE vulnerabilities that have been reported by
1111

1212
The workflow is designed for both interactive use and scheduled automation (GitHub Actions, Ambient scheduled sessions).
1313

14+
## Team Onboarding
15+
16+
**⚠️ IMPORTANT:** New teams must complete the onboarding process before using this workflow.
17+
18+
### Onboarding Requirements
19+
20+
Before your team can use the CVE Fixer workflow, the following setup must be completed:
21+
22+
#### 1. Component-to-Repository Mapping
23+
24+
Your team's Jira components must be mapped to GitHub repositories in `component-repository-mappings.json`.
25+
26+
**What you need to provide:**
27+
- Jira component name (as it appears in your Jira project)
28+
- GitHub repository URLs (upstream, midstream, and/or downstream)
29+
- Default and active release branches for each repository
30+
31+
**Example mapping:**
32+
```json
33+
{
34+
"Your Component Name": {
35+
"container_to_repo_mapping": {
36+
"rhoai/odh-your-container-rhel9": "org/upstream-repo"
37+
},
38+
"repositories": {
39+
"org/upstream-repo": {
40+
"github_url": "https://github.com/org/upstream-repo",
41+
"default_branch": "main",
42+
"active_release_branches": ["release-1.0"],
43+
"branch_strategy": "Fix in main. Release branches follow pattern release-X.Y.",
44+
"repo_type": "upstream"
45+
},
46+
"org/downstream-repo": {
47+
"github_url": "https://github.com/org/downstream-repo",
48+
"default_branch": "main",
49+
"active_release_branches": ["rhoai-3.4"],
50+
"branch_strategy": "Fork of midstream. RHOAI release branches follow pattern rhoai-X.Y.",
51+
"repo_type": "downstream"
52+
}
53+
}
54+
}
55+
}
56+
```
57+
58+
#### 2. ProdSec Team Coordination
59+
60+
The Product Security (ProdSec) team must:
61+
- Create Jira component for your team in your Jira project
62+
- Configure CVE issue templates for your component
63+
- Set up automated CVE discovery and Jira issue creation
64+
65+
**Contact:** Make sure your component repos are actively scanned by ProdSec team. If your component is not onboarded please follow the feature refinement process.
66+
67+
#### 3. GitHub Access Configuration
68+
69+
The workflow requires GitHub CLI (`gh`) authentication to create pull requests.
70+
71+
**Required permissions:**
72+
- Read access to your upstream/downstream repositories
73+
- Write access (PR creation) to repositories where fixes will be applied
74+
- Ability to run `gh auth login` or use `GITHUB_TOKEN` environment variable
75+
76+
**Setup:**
77+
```bash
78+
# Option 1: Interactive login
79+
gh auth login
80+
81+
# Option 2: Use token (for automation)
82+
export GITHUB_TOKEN="your-personal-access-token"
83+
```
84+
85+
#### 4. Jira API Access
86+
87+
Each team member using the workflow needs:
88+
- Red Hat Jira account with access to your Jira project
89+
- Jira API token for authentication
90+
- Read access to CVE issues for their component
91+
92+
**Setup:**
93+
1. Generate API token at https://id.atlassian.com/manage-profile/security/api-tokens
94+
2. Export credentials:
95+
```bash
96+
export JIRA_API_TOKEN="your-token-here"
97+
export JIRA_EMAIL="your-email@redhat.com"
98+
```
99+
100+
### Onboarding Steps
101+
102+
1. **Submit Onboarding Request**
103+
- Contact the workflow maintainers with your component details
104+
- Provide GitHub repository URLs and target branches
105+
- Specify upstream/downstream repository structure
106+
107+
2. **Wait for Mapping Update**
108+
- Maintainers will add your component to `component-repository-mappings.json`
109+
- PR will be created and merged
110+
- You'll be notified when ready
111+
112+
3. **Coordinate with ProdSec**
113+
- Ensure your Jira component exists in your Jira project
114+
- Verify CVE issues are being filed against your component
115+
- Test with a sample CVE issue
116+
117+
4. **Set Up Personal Credentials**
118+
- Configure Jira API access (step 4 above)
119+
- Configure GitHub access (step 3 above)
120+
- Test with `/cve.find` command
121+
122+
5. **Test Workflow**
123+
- Run `/cve.find` for your component
124+
- Review discovered issues
125+
- Test `/cve.fix` on a non-critical CVE
126+
- Verify PR creation and formatting
127+
128+
### Onboarding Checklist
129+
130+
Before using the workflow, verify:
131+
132+
- [ ] Component mapped in `component-repository-mappings.json`
133+
- [ ] ProdSec filing CVEs against your Jira component
134+
- [ ] JIRA_API_TOKEN and JIRA_EMAIL configured
135+
- [ ] GitHub CLI authenticated (`gh auth status`)
136+
- [ ] Test repository access with `gh repo view <org/repo>`
137+
- [ ] Tested `/cve.find` returns issues for your component
138+
- [ ] Tested `/cve.fix` creates a PR successfully
139+
140+
### Who to Contact
141+
142+
- **Workflow Mapping Updates**: Open PR against this repository or contact workflow maintainers (@angaduom, @vmrh21)
143+
- **ProdSec Component Setup**: Contact your ProdSec team representative
144+
- **Jira Access Issues**: Contact Red Hat IT Support
145+
- **GitHub Access Issues**: Contact your GitHub org administrators
146+
14147
## Getting Started
15148

16149
### Prerequisites
@@ -104,18 +237,23 @@ The workflow uses `component-repository-mappings.json` to map Jira components to
104237
```json
105238
{
106239
"Model as a Service": {
240+
"container_to_repo_mapping": {
241+
"rhoai/odh-maas-api-rhel9": "opendatahub-io/models-as-a-service"
242+
},
107243
"repositories": {
108244
"opendatahub-io/models-as-a-service": {
109245
"github_url": "https://github.com/opendatahub-io/models-as-a-service",
110-
"repo_type": "upstream",
111-
"primary_target": "main",
112-
"build_location": "."
246+
"default_branch": "main",
247+
"active_release_branches": [],
248+
"branch_strategy": "Fix in main.",
249+
"repo_type": "upstream"
113250
},
114251
"red-hat-data-services/models-as-a-service": {
115252
"github_url": "https://github.com/red-hat-data-services/models-as-a-service",
116-
"repo_type": "downstream",
117-
"primary_target": "rhoai-2.19",
118-
"build_location": "."
253+
"default_branch": "rhoai-3.0",
254+
"active_release_branches": ["rhoai-3.0"],
255+
"branch_strategy": "Fork of midstream. Fixes backported from upstream.",
256+
"repo_type": "downstream"
119257
}
120258
}
121259
}

0 commit comments

Comments
 (0)