fix(safeoutputs): enforce add-build-tag scope for build IDs > i32::MAX#379
Merged
Conversation
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/dd6d4958-4570-4099-8fcc-bf3d38eb7aa9 Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/dd6d4958-4570-4099-8fcc-bf3d38eb7aa9 Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jamesadevine
May 1, 2026 19:49
View session
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.
Summary
The
add-build-tagscope check insrc/safeoutputs/add_build_tag.rsnarrowedctx.build_id(u64, sourced fromBUILD_BUILDID) toi32viai32::try_from(id).ok(). For any ADO build ID greater thani32::MAX(~2.1B), the conversion returnedNone, theif let Some(...)branch was skipped, and the scope check fell through silently — letting an agent tag arbitrary builds even whenallow-any-build: false.u64space: widen the validated-positiveself.build_id: i32withas u64and compare directly againstctx.build_id: Option<u64>. Values that don't fit ini32simply cannot match, so the scope check now correctly rejects them.Test plan
cargo test add_build_tag(existing tests pass)cargo buildandcargo clippy --all-targets --all-featuresclean (only pre-existing warnings)