Skip to content

Commit 208acce

Browse files
lpcoxCopilot
andcommitted
Add create_pull_request_with_copilot to WRITE_OPERATIONS and add test
Address review feedback: - Add create_pull_request_with_copilot to WRITE_OPERATIONS in tools.rs so label_resource emits operation="write", matching DIFC enforcement for other PR creation tools. - Add unit test for create_pull_request_with_copilot writer integrity in tool_rules, mirroring the existing create_pull_request test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e42ce71 commit 208acce

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

guards/github-guard/rust-guard/src/labels/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4381,6 +4381,31 @@ mod tests {
43814381
assert_eq!(integrity, writer_integrity(repo_id, &ctx), "create_pull_request should have writer integrity");
43824382
}
43834383

4384+
#[test]
4385+
fn test_apply_tool_labels_create_pull_request_with_copilot_writer_integrity() {
4386+
let ctx = default_ctx();
4387+
let repo_id = "github/copilot";
4388+
let tool_args = json!({
4389+
"owner": "github",
4390+
"repo": "copilot",
4391+
"title": "test PR",
4392+
"head": "feature",
4393+
"base": "main"
4394+
});
4395+
4396+
let (_secrecy, integrity, _desc) = apply_tool_labels(
4397+
"create_pull_request_with_copilot",
4398+
&tool_args,
4399+
repo_id,
4400+
vec![],
4401+
vec![],
4402+
String::new(),
4403+
&ctx,
4404+
);
4405+
4406+
assert_eq!(integrity, writer_integrity(repo_id, &ctx), "create_pull_request_with_copilot should have writer integrity");
4407+
}
4408+
43844409
#[test]
43854410
fn test_apply_tool_labels_merge_pull_request_writer_integrity() {
43864411
let ctx = default_ctx();

guards/github-guard/rust-guard/src/tools.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub const WRITE_OPERATIONS: &[&str] = &[
1212
"delete_file",
1313
"fork_repository",
1414
"create_pull_request",
15+
"create_pull_request_with_copilot",
1516
"add_comment_to_pending_review",
1617
"add_reply_to_pull_request_comment",
1718
"request_copilot_review",

0 commit comments

Comments
 (0)