🩹(backend) ignore non-recording uploads in storage webhook handler

With the introduction of background file uploads, a misconfigured
MinIO webhook could trigger the storage hook endpoint for unrelated
files.

While the dev setup now filters events via the MinIO lifecycle
configuration, add a safeguard at the application level.

Enforce a stricter filepath regex when parsing storage hook events
and ignore files outside the recording output directory.

Return a clean 200 response to acknowledge the webhook while
avoiding unnecessary processing.
This commit is contained in:
lebaudantoine
2026-03-12 14:57:41 +01:00
parent f8b0746e73
commit cb4ed3c9d7
5 changed files with 42 additions and 9 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ class MinioParser:
# pylint: disable=line-too-long
self._filepath_regex = re.compile(
rf"(?P<url_encoded_folder_path>(?:[^%]+%2F)+)?(?P<recording_id>{UUID_REGEX})\.(?P<extension>{FILE_EXT_REGEX})"
rf"(?P<url_encoded_folder_path>(?:[^%]+%2F)+)?{settings.RECORDING_OUTPUT_FOLDER}%2F(?P<recording_id>{UUID_REGEX})\.(?P<extension>{FILE_EXT_REGEX})"
)
@staticmethod