Skip to content

chore: regenerate fixture results for Trivy DB update#297

Merged
andrzej-janczak merged 3 commits into
masterfrom
worktree-fix-trivy-fixtures
May 29, 2026
Merged

chore: regenerate fixture results for Trivy DB update#297
andrzej-janczak merged 3 commits into
masterfrom
worktree-fix-trivy-fixtures

Conversation

@andrzej-janczak
Copy link
Copy Markdown
Contributor

Summary

  • Regenerates all results.xml fixture files to match the current Trivy vulnerability DB
  • Fixes failing plugins_test CI on the dependabot/go_modules/golang.org/x/mod-0.36.0 PR (and on master if it hasn't been fixed there yet)
  • Adds scripts/regenerate_fixtures.py for future DB updates

Root cause

The Trivy DB is downloaded fresh on every CI run. Since the fixtures were last generated:

  • CVE descriptions changed (e.g. CVE-2024-24790, CVE-2024-36039 have different text in the DB)
  • New CVEs added: axios CVE-2026-42038, CVE-2026-42039, CVE-2026-42041, CVE-2026-42042
  • CVE-2025-61730 (golang stdlib, medium) no longer reported by the current DB

The golang.org/x/mod version bump is unrelated — only go.mod/go.sum changed in the dependabot branch.

Test plan

  • CI plugins_test passes on this branch
  • No source code changes — fixture data only

🤖 Generated with Claude Code

dependabot Bot and others added 2 commits May 18, 2026 19:54
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.35.0 to 0.36.0.
- [Commits](golang/mod@v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
CVE descriptions changed in Trivy DB; new CVEs added (axios 2026-42038/39/41/42,
golang stdlib CVE-2025-61730 reclassified). Also adds regenerate_fixtures.py
script for future DB updates.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@andrzej-janczak andrzej-janczak requested a review from a team as a code owner May 29, 2026 07:50
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several test fixture XML files with new vulnerability descriptions and formatting, bumps Go dependencies in go.mod, and introduces a Python script to automate fixture regeneration. The review feedback recommends making the script more robust by resolving paths relative to the script's location and using POSIX-compliant paths to prevent compatibility issues on Windows when running Docker.

Comment thread scripts/regenerate_fixtures.py Outdated
Comment thread scripts/regenerate_fixtures.py Outdated
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 29, 2026

Not up to standards ⛔

🔴 Issues 2 critical · 1 high · 4 medium · 2 minor

Alerts:
⚠ 7 issues (≤ 1 issue of at least medium severity)
⚠ 7 issues (≤ 0 issues of at least minor severity)

Results:
9 new issues

Category Results
Security 1 minor (1 false positive)
1 high (1 false positive)
2 critical (2 false positives)
3 medium (3 false positives)
CodeStyle 1 minor
Complexity 1 medium

View in Codacy

🟢 Metrics 26 complexity · 0 duplication

Metric Results
Complexity 26
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown

@codacy-production codacy-production Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fails to meet quality standards primarily due to the introduction of a high-complexity, uncovered script (scripts/regenerate_fixtures.py) and the use of a Go version (1.25.8) that is vulnerable to critical security issues (CVE-2026-39826, CVE-2026-39823, CVE-2026-39825).

While the automation of fixture regeneration is beneficial, the current implementation of the script is fragile—using string concatenation for XML and failing to flush temporary files before subprocess execution. Furthermore, there is a contradiction in the logic regarding CVE-2025-61730, which the description claims is removed but remains present in the code changes. Missing unit tests for the script's parsing and deterministic sorting must be addressed before merging.

About this PR

  • The PR description states that CVE-2025-61730 is no longer reported, yet it remains included in the diff for 'pattern-vulnerability-medium/results.xml'. Please verify if the fixture regeneration was successful or if the description needs updating.
  • The regeneration script relies on the 'codacy-trivy:latest' docker image. Using a fixed version or digest would ensure more deterministic fixture generation over time and prevent unexpected breakage if the latest image changes.
1 comment outside of the diff
go.mod

line 3 🔴 HIGH RISK
Update the Go version to 1.25.10 to address critical security vulnerabilities in the standard library (CVE-2026-39826, CVE-2026-39823, CVE-2026-39825) affecting html/template escaping and URL/ReverseProxy handling.

Test suggestions

  • The regeneration script correctly extracts pattern IDs from patterns.xml files
  • The regeneration script correctly maps pattern levels to Checkstyle severities
  • The regeneration script handles XML special characters escaping in vulnerability messages
  • The regeneration script produces deterministic output by sorting issues by filename and line
  • Unit tests for run_tool to ensure correct .codacyrc generation (missing coverage)
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. The regeneration script correctly extracts pattern IDs from patterns.xml files
2. The regeneration script correctly maps pattern levels to Checkstyle severities
3. The regeneration script handles XML special characters escaping in vulnerability messages
4. The regeneration script produces deterministic output by sorting issues by filename and line
5. Unit tests for run_tool to ensure correct .codacyrc generation (missing coverage)

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread scripts/regenerate_fixtures.py
Comment thread scripts/regenerate_fixtures.py
Comment thread scripts/regenerate_fixtures.py
Comment thread docs/multiple-tests/pattern-vulnerability-medium/results.xml
Comment thread scripts/regenerate_fixtures.py Outdated
- Use __file__-relative DOCS_DIR so script runs from any directory
- Use .as_posix() for cross-platform path separators in file list
- Call f.flush() before passing temp file path to subprocess
- Remove unnecessary f-prefix from static strings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@stefanvacareanu7 stefanvacareanu7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are passing, good to go

@andrzej-janczak andrzej-janczak merged commit 0c43d2b into master May 29, 2026
8 checks passed
@andrzej-janczak andrzej-janczak deleted the worktree-fix-trivy-fixtures branch May 29, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants