Commit 6ec277e
authored
[no-ci] Use collaborator permission API for restricted-paths-guard trust check (#1930)
* Use collaborator permission API instead of event payload author_association
The webhook event payload's author_association field is unreliable for PRs
originating from forks: even if the author is an org member or explicit
collaborator with maintain/write permissions, fork PRs receive CONTRIBUTOR.
This change queries the collaborator permission API directly to get the
author's actual permission level (admin/maintain/write/triage/read/none),
which is authoritative regardless of whether the PR comes from a fork or
a branch in the main repo.
Requires contents:write permission to access the collaborator API endpoint.
Made-with: Cursor
* TEMPORARY: Switch to pull_request trigger for testing
This commit is for testing the collaborator permission check and must be
reverted before merge:
1. Changes trigger from pull_request_target to pull_request so this
branch's workflow definition runs instead of main's.
2. Adds a dummy change to cuda_bindings/pyproject.toml to trigger the
restricted-paths detection.
REVERT THIS COMMIT BEFORE MERGE.
Made-with: Cursor
* Revert "TEMPORARY: Switch to pull_request trigger for testing"
This reverts commit b814323.
* Add explicit handling for non-trusted permission levels
Address review feedback: explicitly handle the fallthrough case in the
permission check to make it clear that triage, read, none, and API errors
are not trusted signals.
Made-with: Cursor
* TEMPORARY: Switch to pull_request trigger for testing
This commit is for testing the collaborator permission check and must be
reverted before merge:
1. Changes trigger from pull_request_target to pull_request so this
branch's workflow definition runs instead of main's.
2. Adds a dummy change to cuda_bindings/pyproject.toml to trigger the
restricted-paths detection.
REVERT THIS COMMIT BEFORE MERGE.
Made-with: Cursor
* Revert "TEMPORARY: Switch to pull_request trigger for testing"
This reverts commit 8686adb.
* Fail restricted-paths guard on collaborator API errors
Treat 404 responses from the collaborator permission API as the expected
non-collaborator case, but fail the workflow for any other API error so
restricted-paths review labels are not added based on an unknown result.
Made-with: Cursor
* TEMPORARY: Switch to pull_request trigger for testing
This commit is for testing the collaborator permission check and must be
reverted before merge:
1. Changes trigger from pull_request_target to pull_request so this
branch's workflow definition runs instead of main's.
2. Adds a dummy change to cuda_bindings/pyproject.toml to trigger the
restricted-paths detection.
REVERT THIS COMMIT BEFORE MERGE.
Made-with: Cursor
* Revert "TEMPORARY: Switch to pull_request trigger for testing"
This reverts commit 2a019b6.1 parent 355fcaa commit 6ec277e
1 file changed
+54
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
108 | 119 | | |
109 | 120 | | |
110 | | - | |
111 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
112 | 153 | | |
113 | | - | |
114 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
115 | 159 | | |
116 | 160 | | |
117 | 161 | | |
| |||
136 | 180 | | |
137 | 181 | | |
138 | 182 | | |
139 | | - | |
| 183 | + | |
140 | 184 | | |
141 | 185 | | |
142 | 186 | | |
| |||
154 | 198 | | |
155 | 199 | | |
156 | 200 | | |
157 | | - | |
| 201 | + | |
158 | 202 | | |
159 | 203 | | |
160 | 204 | | |
| |||
0 commit comments