Skip to content

Commit 833b5a2

Browse files
authored
fix(audio): strict base64 body input decoding (#120)
1 parent 2d4f7f1 commit 833b5a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/huggingface_inference_toolkit/webservice_starlette.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ async def predict(request):
101101
"automatic-speech-recognition",
102102
"audio-classification",
103103
}:
104+
# Be more strict on base64 decoding, the provided string should valid base64 encoded data
104105
deserialized_body["inputs"] = base64.b64decode(
105-
deserialized_body["inputs"]
106+
deserialized_body["inputs"], validate=True
106107
)
107108

108109
# check for query parameter and add them to the body

0 commit comments

Comments
 (0)