diff --git a/crates/worker-runtime/src/http_server.rs b/crates/worker-runtime/src/http_server.rs index f345ae02..481c60fc 100644 --- a/crates/worker-runtime/src/http_server.rs +++ b/crates/worker-runtime/src/http_server.rs @@ -449,9 +449,19 @@ async fn store_config_bundle( async fn observe_workspace_prompt_projection( State(state): State, + auth: Option>, body: Result, JsonRejection>, ) -> RestResult { let Json(request) = body.map_err(RuntimeHttpRestError::json_rejection)?; + if let Some(scope) = auth_workspace_scope(&state, auth.as_ref())? + && request.projection.workspace_id != scope.workspace_id + { + return Err(RuntimeHttpRestError::new( + StatusCode::FORBIDDEN, + "workspace_scope_mismatch", + "Workspace Prompt projection is outside the authenticated Workspace scope", + )); + } let workspace_id = request.projection.workspace_id.clone(); let config_revision = request.projection.config_revision; state