Skip to content

multiple fixes in cve-corrector and extractor#14

Merged
danielturull merged 8 commits into
mainfrom
fix/plugin-input-source-validation
Jun 9, 2026
Merged

multiple fixes in cve-corrector and extractor#14
danielturull merged 8 commits into
mainfrom
fix/plugin-input-source-validation

Conversation

@danielturull

Copy link
Copy Markdown
Contributor

Plugins that provide CVE input were rejected with 'At least one input
source required' because is_enabled() was called before setup(), and
the old heuristic excluded sources with empty names or names in the
data-source list.

Changes:

  • Add is_input_source attribute to CveSource base class
  • Update input validation to check is_input_source plugins directly
  • Add test covering plugin input source detection

Testing:

  • All 105 extractor tests pass

@danielturull danielturull changed the title extractor: fix input validation for plugin-provided input sources multiple fixes in cve-corrector and extractor Jun 9, 2026
danielturull and others added 7 commits June 9, 2026 11:54
…handling

Two issues causing agent failures in integration tests:

1. cve_corrector --continue used 'git status --porcelain' to detect
   conflicts, but ANY dirty file (including autotools-generated
   configure, config.guess) triggered a false 'Conflicts still present'
   error. Fix: check specifically for unmerged entries (U/DD/AA in
   porcelain status) rather than any non-empty output.

2. Monorepo subprojects/ prefix (used by gstreamer) not handled in
   _expand_path_variants. The agent works on gst/isomp4/qtdemux.c but
   the allowed list only has subprojects/gst-plugins-good/gst/isomp4/qtdemux.c.
   revert_unauthorized_changes then removes the agent's work. Fix: strip
   subprojects/<name>/ prefix when expanding path variants.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
get_repo_subdir() only checked for CMakeLists.txt, configure.ac,
configure, and meson.build as root build markers. Python projects
(with setup.py, setup.cfg, pyproject.toml at root) were not recognized,
causing false monorepo detection when an ancillary subdirectory like
launcher/ contained a CMakeLists.txt.

This caused CVE-2025-47273 (python3-setuptools) to fail: the corrector
incorrectly set strip_level=2 and subdir=launcher, then git-am failed
with 'lacks filename information when removing 3 leading pathname
components'.

Fix: expand build_files set to include Python, Rust, Go, and Makefile
project markers at root level.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
When the devtool branch has commits that were squash-merged (e.g. PR
merges), the CVE branch may include cherry-picked individual commits
from that PR. format-patch original-version..CVE produces patches for
ALL commits including those already on devtool, causing git-am to fail.

Fix with two improvements:
1. Use devtool (or merge-base) as the format-patch base instead of
   original-version, so only CVE-specific commits are captured.
2. When git-am fails at all strip levels, fall back to direct
   cherry-pick of CVE commits onto the devtool branch.

This fixes CVE-2025-47273 (python3-setuptools) where a merged PR
reorganized package_index.py and made the format-patch output
incompatible with the devtool branch layout.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
Scope git ls-files output to the current recipe's directory when
renaming patches. Previously, untracked patches from other recipes
were counted, causing incorrect -N suffixes (e.g. CVE-XXXX-2.patch
instead of CVE-XXXX.patch for a single-patch fix).

Signed-off-by: Adarsh Jagadish Kamini <adarsh.jagadish.kamini@est.tech>
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
When both git-am (all strip levels) and direct cherry-pick fail to
transfer the CVE fix to the devtool branch, fall back to git-apply
with --3way. This handles cases where the devtool branch has diverged
significantly (e.g. squash-merged PRs that changed file content) but
the patch can still be applied with fuzz.

Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
Plugins that provide CVE input were rejected with 'At least one input
source required' because is_enabled() was called before setup(), and
the old heuristic excluded sources with empty names or names in the
data-source list.

Add is_input_source attribute to CveSource base class. Plugins that
provide CVE input set is_input_source=True and implement is_enabled()
purely from parsed args (no setup() dependency).

Assisted-by: Kiro:claude-opus-4.6
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
@danielturull danielturull force-pushed the fix/plugin-input-source-validation branch from 7799fd5 to 6b7ab68 Compare June 9, 2026 11:55
- Remove unused variable assignment in cve_agent/session.py (F841)
- Rename ambiguous variable 'l' to 'ln' in cherry_pick.py (E741)
- Remove duplicate import block in test_patch.py (F811, I001)

Assisted-by: Kiro:claude-opus-4.6
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
@danielturull danielturull force-pushed the fix/plugin-input-source-validation branch from 6b7ab68 to e4da696 Compare June 9, 2026 11:57
@danielturull danielturull merged commit 8f0ac7d into main Jun 9, 2026
6 checks passed
@danielturull danielturull deleted the fix/plugin-input-source-validation branch June 9, 2026 12:18
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.

2 participants