remotion-lambda 4.0.535__tar.gz → 4.0.537__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/PKG-INFO +1 -1
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/__init__.py +1 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/version.py +1 -1
- remotion_lambda-4.0.537/remotion_lambda/webhook.py +62 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/PKG-INFO +1 -1
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/SOURCES.txt +1 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/LICENSE +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/README.md +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/asyncremotionclient.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/exception.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/models.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda/remotionclient.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/dependency_links.txt +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/requires.txt +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/top_level.txt +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/setup.cfg +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/setup.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/__init__.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/conftest.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/constants.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_get_render_progress_client.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_large_payload_compression.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_remotion_client.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_render_client_render_media.py +0 -0
- {remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_render_client_render_still.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# pylint: disable=missing-module-docstring, missing-final-newline
|
|
2
|
-
VERSION = "4.0.
|
|
2
|
+
VERSION = "4.0.537"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# pylint: disable=missing-module-docstring
|
|
2
|
+
import hashlib
|
|
3
|
+
import hmac
|
|
4
|
+
from typing import Union
|
|
5
|
+
|
|
6
|
+
from .exception import RemotionException, RemotionInvalidArgumentException
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def validate_webhook_signature(
|
|
10
|
+
secret: str,
|
|
11
|
+
body: Union[str, bytes],
|
|
12
|
+
signature_header: str,
|
|
13
|
+
) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Validate that an incoming webhook request was sent by Remotion and that its
|
|
16
|
+
body was not modified in transit.
|
|
17
|
+
|
|
18
|
+
Pass the webhook secret that was configured when the render was started, the
|
|
19
|
+
raw request body exactly as it was received, and the value of the
|
|
20
|
+
``X-Remotion-Signature`` header. The function raises an exception if the
|
|
21
|
+
request cannot be verified and returns ``None`` if it is authentic.
|
|
22
|
+
|
|
23
|
+
The signature covers the raw JSON bytes, so pass the body as it arrived
|
|
24
|
+
(``request.get_data()`` in Flask, ``request.body`` in Django) and decode it
|
|
25
|
+
only after this function returns. Decoding and re-encoding first can change
|
|
26
|
+
key order and whitespace, which would break the comparison even for a
|
|
27
|
+
genuine request.
|
|
28
|
+
|
|
29
|
+
This mirrors ``validateWebhookSignature()`` from ``@remotion/lambda/client``
|
|
30
|
+
and uses the same scheme: ``"sha512="`` followed by the hex digest of an
|
|
31
|
+
HMAC-SHA512 over the request body, keyed with the webhook secret.
|
|
32
|
+
"""
|
|
33
|
+
if not secret:
|
|
34
|
+
raise RemotionInvalidArgumentException(
|
|
35
|
+
"No 'secret' was provided to validate_webhook_signature()."
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
if body is None or body == '' or body == b'':
|
|
39
|
+
raise RemotionInvalidArgumentException(
|
|
40
|
+
"No 'body' was provided to validate_webhook_signature()."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
if not signature_header or signature_header == 'NO_SECRET_PROVIDED':
|
|
44
|
+
raise RemotionException('No webhook signature was provided')
|
|
45
|
+
|
|
46
|
+
body_bytes = body.encode('utf-8') if isinstance(body, str) else body
|
|
47
|
+
|
|
48
|
+
expected = (
|
|
49
|
+
'sha512='
|
|
50
|
+
+ hmac.new(
|
|
51
|
+
secret.encode('utf-8'), body_bytes, hashlib.sha512
|
|
52
|
+
).hexdigest()
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Compare as bytes: `compare_digest()` rejects two `str` values when either
|
|
56
|
+
# side contains non-ASCII characters, and the signature header is
|
|
57
|
+
# attacker-controlled, so a non-ASCII value must fail the check with a
|
|
58
|
+
# `RemotionException` instead of raising an uncaught `TypeError`.
|
|
59
|
+
if not hmac.compare_digest(
|
|
60
|
+
expected.encode('utf-8'), signature_header.encode('utf-8')
|
|
61
|
+
):
|
|
62
|
+
raise RemotionException('Signatures do not match')
|
|
@@ -7,6 +7,7 @@ remotion_lambda/exception.py
|
|
|
7
7
|
remotion_lambda/models.py
|
|
8
8
|
remotion_lambda/remotionclient.py
|
|
9
9
|
remotion_lambda/version.py
|
|
10
|
+
remotion_lambda/webhook.py
|
|
10
11
|
remotion_lambda.egg-info/PKG-INFO
|
|
11
12
|
remotion_lambda.egg-info/SOURCES.txt
|
|
12
13
|
remotion_lambda.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/remotion_lambda.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_get_render_progress_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_render_client_render_media.py
RENAMED
|
File without changes
|
{remotion_lambda-4.0.535 → remotion_lambda-4.0.537}/tests/test_render_client_render_still.py
RENAMED
|
File without changes
|