fix: align runtime attachment authorization

This commit is contained in:
2026-09-24 18:37:11 +09:00
parent e69aa03f5d
commit 58d43af3e6
2 changed files with 16 additions and 1 deletions
+4
View File
@@ -3013,6 +3013,10 @@ mod tests {
), ),
Some("workers:input") Some("workers:input")
); );
assert_eq!(
required_runtime_permission(&Method::POST, "/v1/workers/7/workdir-attachments"),
Some("workers:input")
);
} }
fn test_bundle(profile: ProfileSelector) -> ConfigBundle { fn test_bundle(profile: ProfileSelector) -> ConfigBundle {
+12 -1
View File
@@ -3569,7 +3569,11 @@ fn workspace_runtime_operation(method: &str, path_and_query: &str) -> &'static s
if path.ends_with("/workspace-api") { if path.ends_with("/workspace-api") {
return "workers:create"; return "workers:create";
} }
if path.ends_with("/input") || path.ends_with("/restore") || path.contains("/attachments") { if path.ends_with("/input")
|| path.ends_with("/restore")
|| path.contains("/attachments")
|| path.contains("/workdir-attachments")
{
return "workers:input"; return "workers:input";
} }
if path.ends_with("/stop") || path.ends_with("/cancel") { if path.ends_with("/stop") || path.ends_with("/cancel") {
@@ -7300,6 +7304,13 @@ mod tests {
workspace_runtime_operation("GET", &format!("/v1/workers/{worker_id}/protocol/ws")), workspace_runtime_operation("GET", &format!("/v1/workers/{worker_id}/protocol/ws")),
"workers:protocol" "workers:protocol"
); );
assert_eq!(
workspace_runtime_operation(
"POST",
&format!("/v1/workers/{worker_id}/workdir-attachments")
),
"workers:input"
);
assert_eq!( assert_eq!(
workspace_runtime_operation("POST", SSH_HOST_KEY_PROBE_PATH), workspace_runtime_operation("POST", SSH_HOST_KEY_PROBE_PATH),
SSH_HOST_KEY_PROBE_OPERATION SSH_HOST_KEY_PROBE_OPERATION