escher 0.3.6 → 0.3.7
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/escher/auth.rb +13 -12
- data/lib/escher/version.rb +1 -1
- data/spec/escher/auth_spec.rb +150 -12
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c99900670a9017bfe4565037cffade7ea2b9a1
|
4
|
+
data.tar.gz: e3e74a858ff3b42decd6367bfbf4e14ee92a80ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 759ac6e2e5e05b4db8c084e7dcd2a337d785193e0ee76d4abef20b5076cc3e6f382927cc53fc35b9ae4486f5fae69b6b07689c2f9ea9716a52d06c7fb4934179
|
7
|
+
data.tar.gz: d23ffaceb2d89564d48fad3f2e361c66d38c695d579b1c282dff0ba4470d4b30467e957b043a812867bf1f5dbdbaf26e319cffccec96c7c71512de3aa38816ba
|
data/lib/escher/auth.rb
CHANGED
@@ -20,7 +20,7 @@ module Escher
|
|
20
20
|
headers_to_sign |= [@date_header_name.downcase, 'host']
|
21
21
|
|
22
22
|
request = wrap_request req
|
23
|
-
raise EscherError, '
|
23
|
+
raise EscherError, 'The host header is missing' unless request.has_header? 'host'
|
24
24
|
|
25
25
|
request.set_header(@date_header_name, format_date_for_header) unless request.has_header? @date_header_name
|
26
26
|
|
@@ -54,7 +54,7 @@ module Escher
|
|
54
54
|
signature_from_query = get_signing_param('Signature', query_parts)
|
55
55
|
|
56
56
|
(['Host'] + (signature_from_query ? [] : [@auth_header_name, @date_header_name])).each do |header|
|
57
|
-
raise EscherError, '
|
57
|
+
raise EscherError, 'The ' + header + ' header is missing' unless request.header header
|
58
58
|
end
|
59
59
|
|
60
60
|
if method == 'GET' && signature_from_query
|
@@ -63,24 +63,26 @@ module Escher
|
|
63
63
|
|
64
64
|
body = 'UNSIGNED-PAYLOAD'
|
65
65
|
query_parts.delete [query_key_for('Signature'), signature]
|
66
|
-
query_parts = query_parts.map { |k, v| [
|
66
|
+
query_parts = query_parts.map { |k, v| [k, v] }
|
67
67
|
else
|
68
68
|
raw_date = request.header @date_header_name
|
69
|
+
raise EscherError, 'The ' + @date_header_name + ' header is missing' unless raw_date
|
69
70
|
auth_header = request.header @auth_header_name
|
71
|
+
raise EscherError, 'The ' + @auth_header_name + ' header is missing' unless raw_date
|
70
72
|
algorithm, api_key_id, short_date, credential_scope, signed_headers, signature, expires = get_auth_parts_from_header(auth_header)
|
71
73
|
end
|
72
74
|
|
73
75
|
date = Time.parse(raw_date)
|
74
76
|
api_secret = key_db[api_key_id]
|
75
77
|
|
76
|
-
raise EscherError, 'Invalid
|
78
|
+
raise EscherError, 'Invalid Escher key' unless api_secret
|
77
79
|
raise EscherError, 'Only SHA256 and SHA512 hash algorithms are allowed' unless %w(SHA256 SHA512).include?(algorithm)
|
78
|
-
raise EscherError, '
|
80
|
+
raise EscherError, 'The ' + @auth_header_name + ' header\'s shortDate does not match with the request date' unless short_date(date) == short_date
|
79
81
|
raise EscherError, 'The request date is not within the accepted time range' unless is_date_within_range?(date, expires)
|
80
|
-
raise EscherError, '
|
81
|
-
raise EscherError, '
|
82
|
+
raise EscherError, 'The credential scope is invalid' unless credential_scope == @credential_scope
|
83
|
+
raise EscherError, 'The host header is not signed' unless signed_headers.include? 'host'
|
82
84
|
raise EscherError, 'Only the host header should be signed' if signature_from_query && signed_headers != ['host']
|
83
|
-
raise EscherError, '
|
85
|
+
raise EscherError, 'The date header is not signed' if !signature_from_query && !signed_headers.include?(@date_header_name.downcase)
|
84
86
|
|
85
87
|
escher = reconfig(algorithm, credential_scope, date)
|
86
88
|
expected_signature = escher.generate_signature(api_secret, body, headers, method, signed_headers, path, query_parts)
|
@@ -107,7 +109,7 @@ module Escher
|
|
107
109
|
def generate_signed_url(url_to_sign, client, expires = 86400)
|
108
110
|
uri = Addressable::URI.parse(url_to_sign)
|
109
111
|
|
110
|
-
if (uri.port.
|
112
|
+
if (not uri.port.nil?) && (uri.port != uri.default_port)
|
111
113
|
host = "#{uri.host}:#{uri.port}"
|
112
114
|
else
|
113
115
|
host = uri.host
|
@@ -134,7 +136,6 @@ module Escher
|
|
134
136
|
|
135
137
|
signature = generate_signature(client[:api_secret], body, headers, 'GET', headers_to_sign, path, query_parts)
|
136
138
|
query_parts_with_signature = (query_parts.map { |k, v| [uri_encode(k), uri_encode(v)] } << query_pair('Signature', signature))
|
137
|
-
|
138
139
|
"#{uri.scheme}://#{host}#{path}?#{query_parts_with_signature.map { |k, v| k + '=' + v }.join('&')}#{(fragment === nil ? '' : '#' + fragment)}"
|
139
140
|
end
|
140
141
|
|
@@ -160,9 +161,9 @@ module Escher
|
|
160
161
|
|
161
162
|
|
162
163
|
def get_auth_parts_from_header(auth_header)
|
163
|
-
m = /#{@algo_prefix}-HMAC-(?<algo>[A-Z0-9\,]+) Credential=(?<api_key_id>[A-Za-z0-9\-_]+)\/(?<short_date>[0-9]{8})\/(?<credentials>[A-Za-z0-9\-_\/]+), SignedHeaders=(?<signed_headers>[A-Za-z\-;]+), Signature=(?<signature>[0-9a-f]+)$/
|
164
|
+
m = /#{@algo_prefix}-HMAC-(?<algo>[A-Z0-9\,]+) Credential=(?<api_key_id>[A-Za-z0-9\-_]+)\/(?<short_date>[0-9]{8})\/(?<credentials>[A-Za-z0-9\-_ \/]+), SignedHeaders=(?<signed_headers>[A-Za-z\-;]+), Signature=(?<signature>[0-9a-f]+)$/
|
164
165
|
.match auth_header
|
165
|
-
raise EscherError, '
|
166
|
+
raise EscherError, 'Could not parse auth header' unless m && m['credentials']
|
166
167
|
return m['algo'], m['api_key_id'], m['short_date'], m['credentials'], m['signed_headers'].split(';'), m['signature'], 0
|
167
168
|
end
|
168
169
|
|
data/lib/escher/version.rb
CHANGED
data/spec/escher/auth_spec.rb
CHANGED
@@ -127,12 +127,13 @@ module Escher
|
|
127
127
|
end
|
128
128
|
|
129
129
|
|
130
|
-
it 'should sign request' do
|
130
|
+
it 'should sign perfect request' do
|
131
131
|
escher = described_class.new('us-east-1/iam/aws4_request', ESCHER_EMARSYS_OPTIONS.merge(current_time: Time.parse('20110909T233600Z')))
|
132
132
|
client = {:api_key_id => 'AKIDEXAMPLE', :api_secret => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'}
|
133
133
|
|
134
134
|
input_headers = [
|
135
135
|
['host', 'iam.amazonaws.com'],
|
136
|
+
['x-ems-date', '20110909T233600Z'],
|
136
137
|
['content-type', 'application/x-www-form-urlencoded; charset=utf-8'],
|
137
138
|
]
|
138
139
|
|
@@ -140,9 +141,8 @@ module Escher
|
|
140
141
|
'content-type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
141
142
|
'host' => 'iam.amazonaws.com',
|
142
143
|
'x-ems-date' => '20110909T233600Z',
|
143
|
-
'x-ems-auth' => 'EMS-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/iam/aws4_request, SignedHeaders=
|
144
|
+
'x-ems-auth' => 'EMS-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/iam/aws4_request, SignedHeaders=host;x-ems-date, Signature=26855e3e6d3585277965865934f04dcc4c836648873fd2c33f5bbf4f83ebf2a4',
|
144
145
|
}
|
145
|
-
headers_to_sign = %w(content-type)
|
146
146
|
|
147
147
|
request = {
|
148
148
|
method: 'POST',
|
@@ -151,6 +151,65 @@ module Escher
|
|
151
151
|
headers: input_headers,
|
152
152
|
}
|
153
153
|
|
154
|
+
downcase = escher.sign!(request, client)[:headers].map { |k, v| {k.downcase => v} }.reduce({}, &:merge)
|
155
|
+
expect(downcase).to eq expected_headers
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
it 'should sign request and add date header' do
|
160
|
+
escher = described_class.new('us-east-1/iam/aws4_request', ESCHER_EMARSYS_OPTIONS.merge(current_time: Time.parse('20110909T233600Z')))
|
161
|
+
client = {:api_key_id => 'AKIDEXAMPLE', :api_secret => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'}
|
162
|
+
|
163
|
+
input_headers = [
|
164
|
+
['host', 'iam.amazonaws.com'],
|
165
|
+
['content-type', 'application/x-www-form-urlencoded; charset=utf-8'],
|
166
|
+
]
|
167
|
+
|
168
|
+
expected_headers = {
|
169
|
+
'content-type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
170
|
+
'host' => 'iam.amazonaws.com',
|
171
|
+
'x-ems-date' => '20110909T233600Z',
|
172
|
+
'x-ems-auth' => 'EMS-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/iam/aws4_request, SignedHeaders=host;x-ems-date, Signature=26855e3e6d3585277965865934f04dcc4c836648873fd2c33f5bbf4f83ebf2a4',
|
173
|
+
}
|
174
|
+
|
175
|
+
request = {
|
176
|
+
method: 'POST',
|
177
|
+
uri: '/',
|
178
|
+
body: 'Action=ListUsers&Version=2010-05-08',
|
179
|
+
headers: input_headers,
|
180
|
+
}
|
181
|
+
|
182
|
+
downcase = escher.sign!(request, client)[:headers].map { |k, v| {k.downcase => v} }.reduce({}, &:merge)
|
183
|
+
expect(downcase).to eq expected_headers
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
it 'should sign request with headers_to_sign parameter' do
|
188
|
+
escher = described_class.new('us-east-1/iam/aws4_request', ESCHER_EMARSYS_OPTIONS.merge(current_time: Time.parse('20110909T233600Z')))
|
189
|
+
client = {:api_key_id => 'AKIDEXAMPLE', :api_secret => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'}
|
190
|
+
|
191
|
+
input_headers = [
|
192
|
+
['host', 'iam.amazonaws.com'],
|
193
|
+
['x-ems-date', '20110909T233600Z'],
|
194
|
+
['content-type', 'application/x-www-form-urlencoded; charset=utf-8'],
|
195
|
+
]
|
196
|
+
|
197
|
+
expected_headers = {
|
198
|
+
'content-type' => 'application/x-www-form-urlencoded; charset=utf-8',
|
199
|
+
'host' => 'iam.amazonaws.com',
|
200
|
+
'x-ems-date' => '20110909T233600Z',
|
201
|
+
'x-ems-auth' => 'EMS-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/iam/aws4_request, SignedHeaders=content-type;host;x-ems-date, Signature=f36c21c6e16a71a6e8dc56673ad6354aeef49c577a22fd58a190b5fcf8891dbd',
|
202
|
+
}
|
203
|
+
|
204
|
+
headers_to_sign = %w(content-type)
|
205
|
+
|
206
|
+
request = {
|
207
|
+
method: 'POST',
|
208
|
+
uri: '/',
|
209
|
+
body: 'Action=ListUsers&Version=2010-05-08',
|
210
|
+
headers: input_headers,
|
211
|
+
}
|
212
|
+
|
154
213
|
downcase = escher.sign!(request, client, headers_to_sign)[:headers].map { |k, v| {k.downcase => v} }.reduce({}, &:merge)
|
155
214
|
expect(downcase).to eq expected_headers
|
156
215
|
end
|
@@ -204,6 +263,75 @@ module Escher
|
|
204
263
|
expect(escher.generate_signed_url('http://example.com/something?arr%5B%5C=apple&arr%5B%5C=pear', client, 123456)).to eq expected_url
|
205
264
|
end
|
206
265
|
|
266
|
+
it 'should generate presigned url with URL encoded' do
|
267
|
+
escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/11 12:00:00 UTC')))
|
268
|
+
expected_url =
|
269
|
+
'http://example.com/something?tz=Europe%2FVienna&' +
|
270
|
+
'X-EMS-Algorithm=EMS-HMAC-SHA256&' +
|
271
|
+
'X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&' +
|
272
|
+
'X-EMS-Date=20110511T120000Z&' +
|
273
|
+
'X-EMS-Expires=123456&' +
|
274
|
+
'X-EMS-SignedHeaders=host&' +
|
275
|
+
'X-EMS-Signature=b73d097c8c8ea1a954ffebafec84884ce2a487b001d62ccd71787964d01df39b'
|
276
|
+
|
277
|
+
client = {:api_key_id => 'th3K3y', :api_secret => 'very_secure'}
|
278
|
+
expect(escher.generate_signed_url('http://example.com/something?tz=Europe%2FVienna', client, 123456)).to eq expected_url
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should validate double encoded presigned url' do
|
282
|
+
escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/12 21:59:00 UTC')))
|
283
|
+
presigned_uri =
|
284
|
+
'/something?tz=Europe%2FVienna&' +
|
285
|
+
'X-EMS-Algorithm=EMS-HMAC-SHA256&' +
|
286
|
+
'X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&' +
|
287
|
+
'X-EMS-Date=20110511T120000Z&' +
|
288
|
+
'X-EMS-Expires=123456&' +
|
289
|
+
'X-EMS-SignedHeaders=host&' +
|
290
|
+
'X-EMS-Signature=b73d097c8c8ea1a954ffebafec84884ce2a487b001d62ccd71787964d01df39b'
|
291
|
+
|
292
|
+
client = {:api_key_id => 'th3K3y', :api_secret => 'very_secure'}
|
293
|
+
expect { escher.authenticate({
|
294
|
+
:method => 'GET',
|
295
|
+
:headers => [%w(host example.com)],
|
296
|
+
:uri => presigned_uri,
|
297
|
+
:body => 'IRRELEVANT'
|
298
|
+
}, key_db) }.not_to raise_error
|
299
|
+
end
|
300
|
+
|
301
|
+
it 'should generate presigned url with double URL encoded' do
|
302
|
+
escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/11 12:00:00 UTC')))
|
303
|
+
expected_url =
|
304
|
+
'http://example.com/something?tz=Europe%252FVienna&' +
|
305
|
+
'X-EMS-Algorithm=EMS-HMAC-SHA256&' +
|
306
|
+
'X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&' +
|
307
|
+
'X-EMS-Date=20110511T120000Z&' +
|
308
|
+
'X-EMS-Expires=123456&' +
|
309
|
+
'X-EMS-SignedHeaders=host&' +
|
310
|
+
'X-EMS-Signature=8eeb0171cf2acc4efcb6b3ff13a53d49ab3ee98d631898608d0ebf9de7281066'
|
311
|
+
|
312
|
+
client = {:api_key_id => 'th3K3y', :api_secret => 'very_secure'}
|
313
|
+
expect(escher.generate_signed_url('http://example.com/something?tz=Europe%252FVienna', client, 123456)).to eq expected_url
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should validate double encoded presigned url' do
|
317
|
+
escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/12 21:59:00 UTC')))
|
318
|
+
presigned_uri =
|
319
|
+
'/something?tz=Europe%252FVienna&' +
|
320
|
+
'X-EMS-Algorithm=EMS-HMAC-SHA256&' +
|
321
|
+
'X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&' +
|
322
|
+
'X-EMS-Date=20110511T120000Z&' +
|
323
|
+
'X-EMS-Expires=123456&' +
|
324
|
+
'X-EMS-SignedHeaders=host&' +
|
325
|
+
'X-EMS-Signature=8eeb0171cf2acc4efcb6b3ff13a53d49ab3ee98d631898608d0ebf9de7281066'
|
326
|
+
|
327
|
+
client = {:api_key_id => 'th3K3y', :api_secret => 'very_secure'}
|
328
|
+
expect { escher.authenticate({
|
329
|
+
:method => 'GET',
|
330
|
+
:headers => [%w(host example.com)],
|
331
|
+
:uri => presigned_uri,
|
332
|
+
:body => 'IRRELEVANT'
|
333
|
+
}, key_db) }.not_to raise_error
|
334
|
+
end
|
207
335
|
|
208
336
|
[
|
209
337
|
['http://iam.amazonaws.com:5000/', 'iam.amazonaws.com:5000'],
|
@@ -283,6 +411,16 @@ module Escher
|
|
283
411
|
end
|
284
412
|
|
285
413
|
|
414
|
+
it 'should not throw parse error if credential scope contains whitespaces' do
|
415
|
+
headers = [
|
416
|
+
%w(Host host.foo.com),
|
417
|
+
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
418
|
+
['Authorization', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-ea st-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'],
|
419
|
+
]
|
420
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The credential scope is invalid')
|
421
|
+
end
|
422
|
+
|
423
|
+
|
286
424
|
it 'should detect if signatures do not match' do
|
287
425
|
headers = [
|
288
426
|
%w(Host host.foo.com),
|
@@ -300,7 +438,7 @@ module Escher
|
|
300
438
|
['Date', "Mon, #{yesterday} Sep 2011 23:36:00 GMT"],
|
301
439
|
['Authorization', GOOD_AUTH_HEADER],
|
302
440
|
]
|
303
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
441
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The Authorization header\'s shortDate does not match with the request date')
|
304
442
|
end
|
305
443
|
|
306
444
|
|
@@ -320,7 +458,7 @@ module Escher
|
|
320
458
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
321
459
|
['Authorization', GOOD_AUTH_HEADER],
|
322
460
|
]
|
323
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
461
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The Host header is missing')
|
324
462
|
end
|
325
463
|
|
326
464
|
|
@@ -329,7 +467,7 @@ module Escher
|
|
329
467
|
%w(Host host.foo.com),
|
330
468
|
['Authorization', GOOD_AUTH_HEADER],
|
331
469
|
]
|
332
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
470
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The Date header is missing')
|
333
471
|
end
|
334
472
|
|
335
473
|
|
@@ -338,7 +476,7 @@ module Escher
|
|
338
476
|
%w(Host host.foo.com),
|
339
477
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
340
478
|
]
|
341
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
479
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The Authorization header is missing')
|
342
480
|
end
|
343
481
|
|
344
482
|
|
@@ -348,7 +486,7 @@ module Escher
|
|
348
486
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
349
487
|
['Authorization', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=UNPARSABLE'],
|
350
488
|
]
|
351
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
489
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'Could not parse auth header')
|
352
490
|
end
|
353
491
|
|
354
492
|
|
@@ -358,7 +496,7 @@ module Escher
|
|
358
496
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
359
497
|
['Authorization', 'AWS4-HMAC-SHA256 Credential=BAD-CREDENTIAL-SCOPE, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'],
|
360
498
|
]
|
361
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
499
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'Could not parse auth header')
|
362
500
|
end
|
363
501
|
|
364
502
|
|
@@ -368,7 +506,7 @@ module Escher
|
|
368
506
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
369
507
|
['Authorization', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'],
|
370
508
|
]
|
371
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
509
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The host header is not signed')
|
372
510
|
end
|
373
511
|
|
374
512
|
|
@@ -378,7 +516,7 @@ module Escher
|
|
378
516
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
379
517
|
['Authorization', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'],
|
380
518
|
]
|
381
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
519
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The date header is not signed')
|
382
520
|
end
|
383
521
|
|
384
522
|
|
@@ -398,7 +536,7 @@ module Escher
|
|
398
536
|
['Date', 'Mon, 09 Sep 2011 23:36:00 GMT'],
|
399
537
|
['Authorization', 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/INVALID/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470'],
|
400
538
|
]
|
401
|
-
expect { call_validate(headers) }.to raise_error(EscherError, '
|
539
|
+
expect { call_validate(headers) }.to raise_error(EscherError, 'The credential scope is invalid')
|
402
540
|
end
|
403
541
|
|
404
542
|
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: escher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andras Barthazi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: addressable
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.3'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.3'
|
97
97
|
description: Escher helps you creating secure HTTP requests (for APIs) by signing
|
@@ -102,8 +102,8 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .travis.yml
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE
|
109
109
|
- README.md
|
@@ -314,17 +314,17 @@ require_paths:
|
|
314
314
|
- lib
|
315
315
|
required_ruby_version: !ruby/object:Gem::Requirement
|
316
316
|
requirements:
|
317
|
-
- -
|
317
|
+
- - ">="
|
318
318
|
- !ruby/object:Gem::Version
|
319
319
|
version: '1.9'
|
320
320
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
321
321
|
requirements:
|
322
|
-
- -
|
322
|
+
- - ">="
|
323
323
|
- !ruby/object:Gem::Version
|
324
324
|
version: '0'
|
325
325
|
requirements: []
|
326
326
|
rubyforge_project:
|
327
|
-
rubygems_version: 2.
|
327
|
+
rubygems_version: 2.4.5
|
328
328
|
signing_key:
|
329
329
|
specification_version: 4
|
330
330
|
summary: Library for HTTP request signing (Ruby implementation)
|