-
Notifications
You must be signed in to change notification settings - Fork 21
Guard DIFC: add explicit label rules for notification writes and repository create/fork operations #4300
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
Guard DIFC: add explicit label rules for notification writes and repository create/fork operations #4300
Changes from all commits
bbc6fbd
4460784
1d85709
c2b28dd
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 |
|---|---|---|
|
|
@@ -466,17 +466,26 @@ pub fn apply_tool_labels( | |
| } | ||
|
|
||
| // === Notifications (user-scoped, private) === | ||
| "list_notifications" | "get_notification_details" | ||
| | "dismiss_notification" | "mark_all_notifications_read" | ||
| | "manage_notification_subscription" | ||
| | "manage_repository_notification_subscription" => { | ||
| "list_notifications" | "get_notification_details" => { | ||
| // Notifications are private to the authenticated user. | ||
| // S = private:user | ||
| // I = none (notifications reference external content of unknown trust) | ||
| secrecy = private_user_label(); | ||
| integrity = vec![]; | ||
| } | ||
|
|
||
| // === Notification management (account-scoped writes) === | ||
| "dismiss_notification" | ||
| | "mark_all_notifications_read" | ||
| | "manage_notification_subscription" | ||
| | "manage_repository_notification_subscription" => { | ||
| // These operations change notification/subscription state and return minimal metadata. | ||
| // S = public (empty); I = project:github | ||
| secrecy = vec![]; | ||
| baseline_scope = "github".to_string(); | ||
| integrity = project_github_label(ctx); | ||
| } | ||
|
Comment on lines
+477
to
+487
|
||
|
|
||
| // === Private GitHub-controlled metadata (user-associated): PII/org-structure sensitive === | ||
| "get_me" | ||
| | "get_teams" | ||
|
|
@@ -562,14 +571,23 @@ pub fn apply_tool_labels( | |
|
|
||
| // === Repo content and structure write operations === | ||
| "create_or_update_file" | "push_files" | "delete_file" | "create_branch" | ||
| | "update_pull_request_branch" | "create_repository" | "fork_repository" => { | ||
| | "update_pull_request_branch" => { | ||
| // Write operations that modify repo content/structure. | ||
| // S = S(repo) — response references repo-scoped content | ||
| // I = writer (agent-authored content) | ||
| secrecy = apply_repo_visibility_secrecy(&owner, &repo, repo_id, secrecy, ctx); | ||
| integrity = writer_integrity(repo_id, ctx); | ||
| } | ||
|
|
||
| // === Repository creation/fork (user/org-scoped writes) === | ||
| "create_repository" | "fork_repository" => { | ||
| // Creating/forking repositories is account-scoped and does not return repo content. | ||
| // S = public (empty); I = writer(github) | ||
| secrecy = vec![]; | ||
| baseline_scope = "github".to_string(); | ||
| integrity = writer_integrity("github", ctx); | ||
| } | ||
|
|
||
| // === Projects write operations (org-scoped) === | ||
| "projects_write" | ||
| // Deprecated aliases that map to projects_write | ||
|
|
||
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.
These tests assert
apply_tool_labels()output directly, but the production path inlabel_resourcere-appliesensure_integrity_baseline()usinginfer_scope_for_baseline(). For tools with emptyrepo_id, that second pass can change the final integrity labels (including potentially downgrading github-scoped integrity to unscopednone). Add coverage that exerciseslabel_resource(or at leastinfer_scope_for_baselinefor these tool names) so the intended end-to-end DIFC behavior is locked in.