-
Notifications
You must be signed in to change notification settings - Fork 28
rust-guard: fix configured trusted bot elevation in apply_tool_labels + deduplicate item collection #2574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust-guard: fix configured trusted bot elevation in apply_tool_labels + deduplicate item collection #2574
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,9 +9,10 @@ use super::constants::{field_names, SENSITIVE_FILE_KEYWORDS, SENSITIVE_FILE_PATT | |
| use super::helpers::{ | ||
| author_association_floor_from_str, ensure_integrity_baseline, extract_number_as_string, | ||
| extract_repo_info, extract_repo_info_from_search_query, format_repo_id, | ||
| is_default_branch_commit_context, is_default_branch_ref, is_trusted_first_party_bot, | ||
| max_integrity, merged_integrity, policy_private_scope_label, private_user_label, | ||
| project_github_label, reader_integrity, secret_label, writer_integrity, PolicyContext, | ||
| is_configured_trusted_bot, is_default_branch_commit_context, is_default_branch_ref, | ||
| is_trusted_first_party_bot, max_integrity, merged_integrity, policy_private_scope_label, | ||
| private_user_label, project_github_label, reader_integrity, secret_label, writer_integrity, | ||
| PolicyContext, | ||
| }; | ||
|
|
||
| fn apply_repo_visibility_secrecy( | ||
|
|
@@ -127,7 +128,9 @@ pub fn apply_tool_labels( | |
| ); | ||
| // Elevate trusted first-party bots to approved | ||
| if let Some(ref login) = info.author_login { | ||
| if is_trusted_first_party_bot(login) { | ||
| if is_trusted_first_party_bot(login) | ||
| || is_configured_trusted_bot(login, ctx) | ||
| { | ||
|
Comment on lines
129
to
+133
|
||
| floor = max_integrity( | ||
| repo_id, | ||
| floor, | ||
|
|
@@ -185,7 +188,9 @@ pub fn apply_tool_labels( | |
|
|
||
| // Elevate trusted first-party bots to approved | ||
| if let Some(ref login) = facts.author_login { | ||
| if is_trusted_first_party_bot(login) { | ||
| if is_trusted_first_party_bot(login) | ||
| || is_configured_trusted_bot(login, ctx) | ||
| { | ||
| integrity = max_integrity( | ||
| repo_id, | ||
| integrity, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collect_items_simpleis now a core piece of response item collection, but there are no unit tests that pin down its behavior (array passthrough vs. single-object promotion vs. returning empty for MCP text wrappers and search-result metadata). Adding small, direct tests for this helper would help prevent future regressions when response shapes change.