File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -348,9 +348,22 @@ async fn upload_hex_model_handler(
348348
349349pub async fn upload_cert_bundle_handler (
350350 State ( _state) : State < Arc < AppState > > ,
351- _headers : HeaderMap ,
351+ headers : HeaderMap ,
352352 RawBody ( body) : RawBody ,
353353) -> impl IntoResponse {
354+ // Validate Content-Type header
355+ let content_type = headers
356+ . get ( "content-type" )
357+ . and_then ( |ct| ct. to_str ( ) . ok ( ) )
358+ . unwrap_or ( "" ) ;
359+
360+ if content_type != "application/gzip" && content_type != "application/x-gzip" {
361+ return (
362+ StatusCode :: UNSUPPORTED_MEDIA_TYPE ,
363+ format ! ( "Unsupported Content-Type: {}" , content_type) ,
364+ ) ;
365+ }
366+
354367 // Read request body into bytes
355368 let body_bytes = match hyper:: body:: to_bytes ( body) . await {
356369 Ok ( bytes) => bytes,
You can’t perform that action at this time.
0 commit comments