remotion_lambda 4.0.536 → 4.0.538
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.
- checksums.yaml +4 -4
- data/lib/remotion_lambda/version.rb +1 -1
- data/lib/remotion_lambda/webhook.rb +50 -0
- data/lib/remotion_lambda.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45759df0fd53af971ef1e706655f36975e8ca436d281dfee927901a65c8c8df7
|
|
4
|
+
data.tar.gz: ceef2060641769982f71e75b4b440b26bc70160c560fd79cc7c68d56baf1316c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c650d48456a61d127bd534b8097f53d11e43e24a9dd03216bdfccd8f0021caef5a4ad466412e032b3b3a650f386f4f12da8e4cb78b1e40d9c5b1e23337c76830
|
|
7
|
+
data.tar.gz: 980729ecb7eccdcf9f71ec4f2fe3b864cfafb4e59f90e14020e50fa6abd15268f52144bab86289dc93d40289247a0ba115e9e6401decd42bd894ad3181a468e4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "4.0.
|
|
1
|
+
VERSION = "4.0.538"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'openssl'
|
|
2
|
+
|
|
3
|
+
module RemotionLambda
|
|
4
|
+
# Validates that an incoming webhook request was sent by Remotion and that its
|
|
5
|
+
# body was not modified in transit.
|
|
6
|
+
#
|
|
7
|
+
# Pass the webhook secret that was configured when the render was started, the
|
|
8
|
+
# raw request body exactly as it was received, and the value of the
|
|
9
|
+
# X-Remotion-Signature header. Raises if the request cannot be verified and
|
|
10
|
+
# returns nil if it is authentic.
|
|
11
|
+
#
|
|
12
|
+
# The signature covers the raw JSON bytes, so pass the body as it arrived
|
|
13
|
+
# (request.body.read in Sinatra, request.raw_post in Rails) and parse it only
|
|
14
|
+
# after this method returns. Parsing and regenerating the JSON first can change
|
|
15
|
+
# whitespace and how numbers are formatted, which would break the comparison
|
|
16
|
+
# even for a genuine request.
|
|
17
|
+
#
|
|
18
|
+
# This mirrors validateWebhookSignature() from @remotion/lambda/client and uses
|
|
19
|
+
# the same scheme: "sha512=" followed by the hex digest of an HMAC-SHA512 over
|
|
20
|
+
# the request body, keyed with the webhook secret.
|
|
21
|
+
def self.validate_webhook_signature(secret, body, signature_header)
|
|
22
|
+
if secret.nil? || secret.empty?
|
|
23
|
+
raise ArgumentError, "No 'secret' was provided to validate_webhook_signature()."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
if body.nil? || body.empty?
|
|
27
|
+
raise ArgumentError, "No 'body' was provided to validate_webhook_signature()."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
if signature_header.nil? || signature_header.empty? ||
|
|
31
|
+
signature_header == 'NO_SECRET_PROVIDED'
|
|
32
|
+
raise 'No webhook signature was provided'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
expected = "sha512=#{OpenSSL::HMAC.hexdigest('SHA512', secret, body)}"
|
|
36
|
+
|
|
37
|
+
# The header is attacker-controlled, so force both sides to binary before
|
|
38
|
+
# comparing: fixed_length_secure_compare() compares bytes and must fail the
|
|
39
|
+
# check instead of raising when the header has an unexpected encoding.
|
|
40
|
+
signature = signature_header.b
|
|
41
|
+
|
|
42
|
+
matches =
|
|
43
|
+
expected.bytesize == signature.bytesize &&
|
|
44
|
+
OpenSSL.fixed_length_secure_compare(expected.b, signature)
|
|
45
|
+
|
|
46
|
+
raise 'Signatures do not match' unless matches
|
|
47
|
+
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/remotion_lambda.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative 'remotion_lambda/render_frames_on_lambda_payload'
|
|
|
7
7
|
require_relative 'remotion_lambda/render_progress_payload'
|
|
8
8
|
require_relative 'remotion_lambda/render_still_on_lambda_payload'
|
|
9
9
|
require_relative 'remotion_lambda/s3_output_provider'
|
|
10
|
+
require_relative 'remotion_lambda/webhook'
|
|
10
11
|
require_relative 'remotion_lambda/sdk'
|
|
11
12
|
|
|
12
13
|
module RemotionLambda
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: remotion_lambda
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.538
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonny Burger
|
|
@@ -98,6 +98,7 @@ files:
|
|
|
98
98
|
- lib/remotion_lambda/s3_output_provider.rb
|
|
99
99
|
- lib/remotion_lambda/sdk.rb
|
|
100
100
|
- lib/remotion_lambda/version.rb
|
|
101
|
+
- lib/remotion_lambda/webhook.rb
|
|
101
102
|
- lib/render_media_on_lambda_payload.rb
|
|
102
103
|
- lib/render_media_on_lambda_payload_spec.rb
|
|
103
104
|
- lib/render_progress_payload.rb
|