Skip to content

Commit 6b7bd8a

Browse files
RoiGlinikclaude
andauthored
ROB-3783 patch 6 high CVEs (Go stdlib + glibc) (#111)
* add claude skill Signed-off-by: Roi Glinik <groi.tech@gmail.com> * FIX: patch CVE-2026-32280, CVE-2026-32281, CVE-2026-32283, CVE-2026-33810, CVE-2026-4046, CVE-2026-4437 - Upgrade Go builder from 1.26 to 1.26.2 (fixes 4 stdlib CVEs in crypto/x509 and crypto/tls) - go.mod bumped to go 1.26.2 to match builder - Fresh pull of cgr.dev/chainguard/bash:latest provides glibc >= 2.44 (fixes CVE-2026-4046, CVE-2026-4437) - Verified: docker scout reports 0C 0H 0M 0L on rebuilt image Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * add upgrade guidelines to patch-cves skill per PR review Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Signed-off-by: Roi Glinik <groi.tech@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3f9df6d commit 6b7bd8a

3 files changed

Lines changed: 193 additions & 2 deletions

File tree

.claude/skills/patch-cves/SKILL.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Patching CVEs in Robusta: Automated Workflow
2+
3+
This skill automates the process of identifying and patching CVE vulnerabilities in the Robusta Docker image and Python dependencies, focusing on critical, high, and medium severity issues.
4+
5+
## Overview
6+
7+
The workflow follows this systematic process:
8+
9+
1. **Vulnerability Scanning** - Identify all CVEs in dependencies and Docker image
10+
2. **Severity Filtering** - Focus on critical, high, and medium severity issues
11+
3. **Root Cause Analysis** - Determine which packages/dependencies introduce vulnerabilities
12+
4. **Upstream Research** - Check if newer releases already include fixes
13+
5. **Patch Implementation** - Apply fixes via dependency upgrades or Dockerfile changes
14+
6. **Validation** - Verify CVE fixes and ensure application functionality
15+
16+
## Step-by-Step Process
17+
18+
### 1. Vulnerability Scanning
19+
20+
Use multiple scanning tools to identify vulnerabilities:
21+
22+
```bash
23+
# Scan Docker image for vulnerabilities
24+
docker build -t robusta:latest .
25+
docker scout cves robusta:latest
26+
27+
# Scan Python dependencies for vulnerabilities
28+
pip-audit
29+
safety check
30+
31+
# Validate pyproject.toml metadata and lockfile consistency (does not perform vulnerability scanning)
32+
poetry check
33+
# For CVE scanning of Python dependencies, use pip-audit, safety, or poetry-audit-plugin
34+
```
35+
36+
**What to extract:**
37+
- Affected package name and version
38+
- CVE ID and severity level
39+
- Fixed version (if available)
40+
- Affected version range
41+
42+
### 2. Severity Filtering
43+
44+
Process vulnerabilities in this order:
45+
1. **Critical** - Must be fixed before release
46+
2. **High** - Should be fixed before release
47+
3. **Medium** - Fix when safe and non-breaking
48+
49+
Create a prioritized list and document each CVE:
50+
51+
```
52+
CVE-XXXX-XXXXX (Critical): Package X - affects >=1.0.0,<1.2.0
53+
Fixed in: 1.2.5
54+
Status: Needs patching
55+
56+
CVE-YYYY-YYYYY (High): Package Y - affects >=2.0.0,<2.1.0
57+
Fixed in: 2.1.3
58+
Status: Needs patching
59+
```
60+
61+
### 3. Python Dependency Patches
62+
63+
Two main strategies:
64+
65+
**Strategy A: Direct Upgrade (Preferred)**
66+
- Check `poetry.lock` for affected packages
67+
- Update `pyproject.toml` with patched version
68+
- Run `poetry update package-name`
69+
- Verify in `poetry.lock` that lock file has updated to fixed version
70+
71+
**Strategy B: Transitive Dependency Fix**
72+
- Identify the parent package bringing in vulnerable version
73+
- Upgrade parent package to one with updated dependencies
74+
- This automatically pulls in the fixed transitive dependency
75+
76+
77+
### 4. Dockerfile Patches
78+
79+
For system-level vulnerabilities (non-Python packages):
80+
81+
**Strategy A: Upgrade Base Image**
82+
- Check if newer Python 3.11-slim image includes fixes
83+
- Update FROM statement: `FROM python:3.11-slim` → newer version
84+
85+
**Strategy B: Explicit Package Installation**
86+
- Add specific package upgrade in RUN commands
87+
- Example: `apt-get install -y libssl3` for OpenSSL CVEs
88+
89+
**Strategy C: Apply Patches**
90+
- Use patching tools for targeted fixes in builder stage
91+
- Document with comments explaining which CVEs are fixed
92+
93+
### 5. Validation Checklist
94+
95+
**CVE Verification**
96+
- Run `docker scout cves` again on patched image
97+
- Confirm target CVE no longer appears
98+
- Note any remaining high/critical issues for tracking
99+
100+
**Build Verification**
101+
```bash
102+
# Build the Docker image
103+
docker build -t robusta:test .
104+
105+
# Verify build succeeds with no errors
106+
echo "Build successful"
107+
```
108+
109+
**Functional Testing**
110+
```bash
111+
# Run basic smoke tests
112+
pytest tests/ -v
113+
```
114+
115+
**Dependency Check**
116+
```bash
117+
# Verify no new vulnerabilities introduced
118+
docker scout cves robusta:test --no-cache
119+
120+
# Validate pyproject.toml metadata and lockfile consistency
121+
poetry check --lock
122+
```
123+
124+
### 6. Documentation
125+
126+
Update these files with CVE fix details:
127+
128+
**Dockerfile Comments:**
129+
```dockerfile
130+
# Patching CVE-XXXX-XXXXX (Critical): Package X
131+
RUN apt-get install -y package-name
132+
```
133+
134+
## Key Considerations
135+
136+
### Upgrade Guidelines
137+
- **Research CVEs first** - Read about each CVE online to understand affected version ranges and what versions are considered safe
138+
- **Minimum required upgrades** - Do not bump major versions unless strictly necessary to fix the CVE; prefer the smallest version bump that resolves the issue
139+
- **Prefer known stable versions** - When possible, avoid patching to a version released less than a month ago; choose the most recent stable release that is at least a month old
140+
- **Preserve version operators** - Keep the same constraint operator (`==`, `>=`, `>`, etc.) when updating version pins; switching between `>` and `>=` is acceptable only when it improves clarity
141+
142+
### Python Package CVEs
143+
- Check if vulnerability is in the installed wheel vs source
144+
- For indirect dependencies, finding the transitive source is critical
145+
- Use `poetry why package-name` to understand dependency relationships
146+
- Go version matters for Go-based Python bindings (e.g., Cryptography)
147+
148+
### System Library CVEs
149+
- libexpat1, libssl, libc vulnerabilities are common
150+
- These often have fixes in newer base images
151+
- When possible, upgrade the base Python image before manual fixes
152+
153+
### Testing Strategy
154+
- Always rebuild and scan after each patch
155+
- One CVE at a time is safer; group similar fixes together
156+
- Document any CVEs that can't be patched with reasoning
157+
158+
### Breaking Changes
159+
- Verify patched versions don't introduce breaking changes
160+
- Check release notes and migration guides
161+
- Run full test suite, not just smoke tests for major upgrades
162+
163+
## Implementation Notes
164+
165+
1. Work through CVEs in severity order (Critical → High → Medium)
166+
2. For each CVE, follow the complete cycle: identify → research → patch → validate
167+
3. Commit each logical group of fixes separately
168+
4. Keep diagnostics available: `docker scout cves` output, dependency trees, test results
169+
5. If a patch can't be safely applied, document why in the code comments
170+
171+
## Common Issues and Solutions
172+
173+
### Issue: Patch introduces breaking changes
174+
**Solution:**
175+
1. Check if breaking change is in major version bump
176+
2. Review if dependency needs to be pinned differently
177+
3. Consider if a workaround exists (e.g., compatibility shim)
178+
179+
### Issue: Transitive dependency is vulnerable
180+
**Solution:**
181+
1. Find which package brings it in: `poetry why vulnerable-package`
182+
2. Update the parent package instead
183+
3. Re-lock dependencies and verify fix
184+
185+
### Issue: CVE disappears after unrelated patch
186+
**Solution:**
187+
1. Good sign - often due to transitive dependency updates
188+
2. Still verify with `docker scout cves` on final image
189+
3. Update documentation to credit upstream fixes

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM golang:1.26 AS builder
1+
# Patching CVE-2026-32280, CVE-2026-32281, CVE-2026-32283, CVE-2026-33810: requires Go >= 1.26.2
2+
FROM golang:1.26.2 AS builder
23

34
RUN apt-get update && \
45
dpkg --add-architecture arm64 &&\
@@ -11,6 +12,7 @@ ADD . "$GOPATH/src/github.com/bitnami-labs/kubewatch"
1112
RUN cd "$GOPATH/src/github.com/bitnami-labs/kubewatch" && \
1213
CGO_ENABLED=0 GOOS=linux GOARCH=$(dpkg --print-architecture) go build -a --installsuffix cgo --ldflags="-s" -o /kubewatch
1314

15+
# Patching CVE-2026-4046, CVE-2026-4437: requires glibc >= 2.44, provided by chainguard/bash built after May 2026
1416
FROM cgr.dev/chainguard/bash:latest
1517

1618
COPY --from=builder /kubewatch /bin/kubewatch

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/bitnami-labs/kubewatch
22

3-
go 1.26.0
3+
go 1.26.2
44

55
require (
66
github.com/fatih/structtag v1.2.0

0 commit comments

Comments
 (0)