fix(execute): match safe-output repository by name or alias#469
fix(execute): match safe-output repository by name or alias#469jamesadevine merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/b3852306-e7cc-4774-9ce9-b53eaedaa4e3 Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
|
/rust-review |
|
✅ Rust PR Reviewer completed successfully! |
🔍 Rust PR ReviewSummary: Good fix with solid test coverage — one meaningful logic inconsistency and a minor robustness gap to address. Findings🐛 Bugs / Logic Issues
|
|
@copilot implement bug fixes and suggestions |
…full-value match; tests for resolve_repo_name Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/8f2f7644-0e82-411f-873e-6dccd8ce881f Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Addressed rust-review feedback in f0d9cf0:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
Safe-output executors looked up the agent-supplied
repositoryfield only by pipeline-resource alias key, so an otherwise valid ADO repository name (e.g.sdk-FtdiDeviceControlfor the resourcerepo-sdk-ftdidevicecontrol → 4x4/sdk-FtdiDeviceControl) was rejected withRepository '…' not in allowed list.Changes:
lookup_allowed_repositoryinsrc/safeoutputs/mod.rsthat resolves an input againstctx.allowed_repositoriesby (1) exact alias key, (2) case-insensitive value match (fullproject/repo), or (3) case-insensitive trailing repo-name match (ADO repo names are case-insensitive).input_refers_to_self(pub(crate)) insrc/safeoutputs/mod.rsthat returnstruefor"self", the empty string (with a debug log), or a case-insensitive match againstctx.repository_name(full value or trailing part).resolve_repo_nameand the inline lookups increate_pr,add_pr_comment,reply_to_pr_comment,create_branch, andcreate_git_tag.create_prcalls the sharedinput_refers_to_selfhelper rather than inlining equivalent logic.docs/safe-outputs.mdupdated to document the accepted forms for therepositoryfield.Per-tool operator allowlists (
config.allowed_repositories: Vec<String>in front matter) are unchanged — those continue to be matched against the agent-supplied value as configured.Example — all four of these now resolve to the same repository:
{"repository": "self"} // pipeline's own repo {"repository": "repo-sdk-ftdidevicecontrol"} // alias key {"repository": "4x4/sdk-FtdiDeviceControl"} // full ADO name {"repository": "sdk-FtdiDeviceControl"} // bare repo name (case-insensitive)Test plan
lookup_allowed_repositorycovering alias / full-value (exact and case-insensitive) / trailing-name (exact and case-insensitive) / no-match / no-slash-value cases.resolve_repo_namecovering theselfliteral,None, trailing-name and full-value matches againstctx.repository_name, alias resolution, and the unknown-repository failure path.cargo buildclean;cargo test --bin ado-aw safeoutputs::→ 447 passed.