@@ -165,9 +165,6 @@ pub(crate) async fn handle_platform_a2a_push_endpoint(
165165 ) ;
166166 }
167167 } ;
168- if let Err ( response) = validate_platform_a2a_push_callback_payload_binding ( & head, & payload) {
169- return response;
170- }
171168 match record_platform_a2a_push_payload ( state, payload) . await {
172169 Ok ( accepted) => json_response ( 202 , & accepted) ,
173170 Err ( message) => a2a_error_response ( 400 , "INVALID_REQUEST" , & message) ,
@@ -205,33 +202,6 @@ fn validate_platform_a2a_push_callback_auth(head: &RequestHead) -> Result<(), Ve
205202 Err ( unauthorized_callback_token_response ( ) )
206203}
207204
208- fn validate_platform_a2a_push_callback_payload_binding (
209- head : & RequestHead ,
210- payload : & Value ,
211- ) -> Result < ( ) , Vec < u8 > > {
212- let Some ( expected) = platform_a2a_push_callback_token ( ) else {
213- return Ok ( ( ) ) ;
214- } ;
215- let Some ( provided) = platform_a2a_push_request_token ( head) else {
216- return Ok ( ( ) ) ;
217- } ;
218- if !provided. starts_with ( A2A_WORKSPACE_NOTIFICATION_TOKEN_PREFIX ) {
219- return Ok ( ( ) ) ;
220- }
221- let Some ( workspace_id) = platform_a2a_push_payload_workspace ( payload)
222- . or_else ( || platform_a2a_push_request_workspace ( head) )
223- else {
224- return Err ( unauthorized_callback_token_response ( ) ) ;
225- } ;
226- let Some ( derived) = workspace_notification_token ( & expected, & workspace_id) else {
227- return Err ( unauthorized_callback_token_response ( ) ) ;
228- } ;
229- if constant_time_eq ( provided. as_bytes ( ) , derived. as_bytes ( ) ) {
230- return Ok ( ( ) ) ;
231- }
232- Err ( unauthorized_callback_token_response ( ) )
233- }
234-
235205fn unauthorized_callback_token_response ( ) -> Vec < u8 > {
236206 json_response (
237207 401 ,
@@ -270,61 +240,6 @@ fn platform_a2a_push_request_workspace(head: &RequestHead) -> Option<String> {
270240 None
271241}
272242
273- fn platform_a2a_push_payload_workspace ( payload : & Value ) -> Option < String > {
274- let object = payload. as_object ( ) ?;
275- if let Some ( status_update) = object. get ( "statusUpdate" ) {
276- return first_platform_a2a_push_workspace ( & [
277- status_update,
278- payload,
279- status_update. get ( "status" ) . unwrap_or ( & Value :: Null ) ,
280- status_update
281- . get ( "status" )
282- . and_then ( |status| status. get ( "message" ) )
283- . unwrap_or ( & Value :: Null ) ,
284- ] ) ;
285- }
286- if let Some ( task) = object. get ( "task" ) {
287- return first_platform_a2a_push_workspace ( & [
288- task,
289- payload,
290- task. get ( "status" ) . unwrap_or ( & Value :: Null ) ,
291- task. get ( "status" )
292- . and_then ( |status| status. get ( "message" ) )
293- . unwrap_or ( & Value :: Null ) ,
294- task. get ( "artifact" ) . unwrap_or ( & Value :: Null ) ,
295- ] ) ;
296- }
297- if let Some ( artifact_update) = object. get ( "artifactUpdate" ) {
298- return first_platform_a2a_push_workspace ( & [
299- artifact_update,
300- payload,
301- artifact_update. get ( "artifact" ) . unwrap_or ( & Value :: Null ) ,
302- ] ) ;
303- }
304- None
305- }
306-
307- fn first_platform_a2a_push_workspace ( values : & [ & Value ] ) -> Option < String > {
308- values
309- . iter ( )
310- . find_map ( |value| platform_a2a_push_workspace_marker ( value) )
311- }
312-
313- fn platform_a2a_push_workspace_marker ( value : & Value ) -> Option < String > {
314- let object = value. as_object ( ) ?;
315- optional_string_field ( object, "workspaceId" )
316- . or_else ( || optional_string_field ( object, "workspace_id" ) )
317- . or_else ( || {
318- object
319- . get ( "metadata" )
320- . and_then ( Value :: as_object)
321- . and_then ( |metadata| {
322- optional_string_field ( metadata, "workspaceId" )
323- . or_else ( || optional_string_field ( metadata, "workspace_id" ) )
324- } )
325- } )
326- }
327-
328243fn platform_a2a_push_callback_token ( ) -> Option < String > {
329244 trimmed_env ( "MAESTRO_PLATFORM_A2A_CALLBACK_TOKEN" )
330245 . or_else ( || trimmed_env ( "MAESTRO_A2A_CALLBACK_TOKEN" ) )
0 commit comments