aws-sdk-sns 1.124.0 → 1.124.1
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/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-sns/client.rb +1 -1
- data/lib/aws-sdk-sns/message_verifier.rb +22 -2
- data/lib/aws-sdk-sns.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 350723b85a653546a5a98dbe7f577f11daa1e25e655386d50d8bb50da2ea5491
|
|
4
|
+
data.tar.gz: 5dd7a46c16b649dd60674ed6ed2e55323d5f6145d2ae04c12b58d20d724caa35
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6b19873cfd6576f3b461d5decb370ee6a906a39c422528fa8418ab672cec6de2e12158636fb97ce15cdaf1c5c012e67de66b2288c8bb8bc2d75353be7070039
|
|
7
|
+
data.tar.gz: 30b7f6360670515c3e748bf29c30f1c2de38e76bbd17bc296a2332132aed17f63220ba2032e1d528c6105af015d55fe5f2df697e511837801cd051026db23830
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
Unreleased Changes
|
|
2
2
|
------------------
|
|
3
3
|
|
|
4
|
+
1.124.1 (2026-10-26)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
* Issue - Fix `MessageVerifier#authentic?` to return false, rather than raise, for messages that are not JSON objects or have malformed signing fields.
|
|
8
|
+
|
|
4
9
|
1.124.0 (2026-10-21)
|
|
5
10
|
------------------
|
|
6
11
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.124.
|
|
1
|
+
1.124.1
|
data/lib/aws-sdk-sns/client.rb
CHANGED
|
@@ -63,8 +63,9 @@ module Aws
|
|
|
63
63
|
# @raise [VerificationError] Raised when the given message has failed
|
|
64
64
|
# verification.
|
|
65
65
|
def authenticate!(message_body)
|
|
66
|
-
msg =
|
|
66
|
+
msg = parse(message_body)
|
|
67
67
|
msg = convert_lambda_msg(msg) if is_from_lambda(msg)
|
|
68
|
+
verify_signing_fields!(msg)
|
|
68
69
|
|
|
69
70
|
case msg['SignatureVersion']
|
|
70
71
|
when '1'
|
|
@@ -79,6 +80,21 @@ module Aws
|
|
|
79
80
|
|
|
80
81
|
private
|
|
81
82
|
|
|
83
|
+
def parse(message_body)
|
|
84
|
+
msg = Json.load(message_body)
|
|
85
|
+
raise VerificationError, 'the message must be a JSON object' unless msg.is_a?(Hash)
|
|
86
|
+
|
|
87
|
+
msg
|
|
88
|
+
rescue Json::ParseError
|
|
89
|
+
raise VerificationError, 'the message is not valid JSON'
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def verify_signing_fields!(msg)
|
|
93
|
+
unless msg['Signature'].is_a?(String) && msg['SigningCertURL'].is_a?(String)
|
|
94
|
+
raise VerificationError, 'the Signature and SigningCertURL must be strings'
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
82
98
|
def is_from_lambda(message)
|
|
83
99
|
message.key? 'SigningCertUrl'
|
|
84
100
|
end
|
|
@@ -125,7 +141,11 @@ module Aws
|
|
|
125
141
|
end
|
|
126
142
|
|
|
127
143
|
def public_key(message)
|
|
128
|
-
x509_url =
|
|
144
|
+
x509_url = begin
|
|
145
|
+
URI.parse(message['SigningCertURL'])
|
|
146
|
+
rescue URI::InvalidURIError
|
|
147
|
+
raise VerificationError, 'the SigningCertURL is not a valid URI'
|
|
148
|
+
end
|
|
129
149
|
x509 = OpenSSL::X509::Certificate.new(pem(x509_url))
|
|
130
150
|
OpenSSL::PKey::RSA.new(x509.public_key)
|
|
131
151
|
end
|
data/lib/aws-sdk-sns.rb
CHANGED