BCR presubmit: run the outside-modules check when only metadata.json changes - #2771
Open
bilguunbicktivism wants to merge 1 commit into
Open
Conversation
validate_files_outside_of_modules_dir_are_not_modified() returned early when get_target_modules() was empty. That list is built from the modules/<name>/<version>/ pattern, so a pull request touching only modules/<name>/metadata.json produces no entries and the check is skipped — even though the same pull request may also change files outside modules/, and should_bcr_validation_block_presubmit() then runs //tools:bcr_validation from that checkout. Pass the metadata-change list to the check as well, and compute it before the call so both kinds of modules/ change are considered.
bilguunbicktivism
requested review from
Wyverald,
fweikert and
meteorcloudy
as code owners
August 10, 2026 05:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
validate_files_outside_of_modules_dir_are_not_modified()returns early whenget_target_modules()is empty:
get_target_modules()builds its list from themodules/<name>/<version>/pattern(
bcr_presubmit.py:87-90), so a pull request that touches onlymodules/<name>/metadata.jsonproduces an empty list and the check is skipped — even when the same pull request also changes files
outside
modules/.get_modules_with_metadata_change()does see that pull request, andshould_wait_bcr_maintainer_review()goes on to callshould_bcr_validation_block_presubmit(), whichruns
bazel run //tools:bcr_validationfrom the pull request's own checkout.The change passes the metadata-change list to the check as well, and moves the
get_modules_with_metadata_change()call above it so both kinds ofmodules/change are considered.Behaviour, before and after
Driven against real temporary git repositories, running the old and the new guard body over the same
diff. The first two rows are controls — the second exists to show the guard is not simply firing on
everything, and the first to show the patch does not make ordinary module pull requests noisy:
modules/modules/modules/Happy to attach the harness if it is useful, or to turn it into a test in whatever form you prefer —
I left it out to keep the diff to one file.
Context
I reported this through the Google OSS VRP as issue 543941141. It was closed as
"not severe enough for us to track it as a security bug", and the response said: "Please feel free
to publicly disclose this issue on GitHub as a public issue." This pull request is that disclosure,
with the fix attached rather than filed separately.
The behaviour is worth closing regardless of severity rating, because the skipped check is the one
that keeps a module pull request from carrying repository files, and the validation that follows it
executes
tools/from the pull request's checkout.