aws-sdk-s3 1.47.0 → 1.48.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a24aa598e8dac5c2bd238c3924e56fa7c7ada90
4
- data.tar.gz: f4392ea82d795e2b860b1521428c47ccb4aa4b32
3
+ metadata.gz: 319056c94ca960081c35e30f55762087e95c5513
4
+ data.tar.gz: 30d3ed780e81e52a362aa3b22defe075f2fdf1b7
5
5
  SHA512:
6
- metadata.gz: 6a73262511429d42b70c28ef0c7168955151d5a056102b68c6af289da73300ff2b6c541cb99a17e52aa7862dd463c435b6e78dd9856a42845393d17ff07a35e7
7
- data.tar.gz: ae61dbd0beeb583b6c55d5306c0b2cebdc8e982dd7cef9ba661dd579ff53707b0c69f501a5bc84e57ed671a4394d3156bbb8e73728bb56530e1505b0f98657fa
6
+ metadata.gz: c3b1e34a59439b184b63a3e8cb104bb192193c1a455bcacc1fed2f23b389fa68e2383e7ed5072c95e2851ecb2e0c9f67c2a78831e7a885202be2280801764f89
7
+ data.tar.gz: 7bf411cd7dac2b1e3dc3089fdebd1487f8e64c571707314d5de24b6d169bc591e74101e0542a463abf6500629679aac932f615127bb5b9e36b953ac51b451603
@@ -63,6 +63,6 @@ require_relative 'aws-sdk-s3/event_streams'
63
63
  # @service
64
64
  module Aws::S3
65
65
 
66
- GEM_VERSION = '1.47.0'
66
+ GEM_VERSION = '1.48.0'
67
67
 
68
68
  end
@@ -7099,7 +7099,7 @@ module Aws::S3
7099
7099
  params: params,
7100
7100
  config: config)
7101
7101
  context[:gem_name] = 'aws-sdk-s3'
7102
- context[:gem_version] = '1.47.0'
7102
+ context[:gem_version] = '1.48.0'
7103
7103
  Seahorse::Client::Request.new(handlers, context)
7104
7104
  end
7105
7105
 
@@ -16,6 +16,25 @@ module Aws
16
16
  # @api private
17
17
  FIFTEEN_MINUTES = 60 * 15
18
18
 
19
+ BLACKLISTED_HEADERS = [
20
+ 'accept',
21
+ 'cache-control',
22
+ 'content-length', # due to a ELB bug
23
+ 'expect',
24
+ 'from',
25
+ 'if-match',
26
+ 'if-none-match',
27
+ 'if-modified-since',
28
+ 'if-unmodified-since',
29
+ 'if-range',
30
+ 'max-forwards',
31
+ 'pragma',
32
+ 'proxy-authorization',
33
+ 'referer',
34
+ 'te',
35
+ 'user-agent'
36
+ ].freeze
37
+
19
38
  # @option options [Client] :client Optionally provide an existing
20
39
  # S3 client
21
40
  def initialize(options = {})
@@ -31,8 +50,8 @@ module Aws
31
50
  # attempts to set this value to greater than one week (604800) will
32
51
  # raise an exception.
33
52
  #
34
- # @option params [Time] :time (Time.now) The starting time before the
35
- # presigned url becomes active. Defaults to Time.now.
53
+ # @option params [Time] :time (Time.now) The starting time for when the
54
+ # presigned url becomes active.
36
55
  #
37
56
  # @option params [Boolean] :secure (true) When `false`, a HTTP URL
38
57
  # is returned instead of the default HTTPS URL.
@@ -41,8 +60,15 @@ module Aws
41
60
  # bucket name will be used as the hostname. This will cause
42
61
  # the returned URL to be 'http' and not 'https'.
43
62
  #
44
- # @option params [Boolean] :use_accelerate_endpoint (false) When `true`, Presigner
45
- # will attempt to use accelerated endpoint
63
+ # @option params [Boolean] :use_accelerate_endpoint (false) When `true`,
64
+ # Presigner will attempt to use accelerated endpoint.
65
+ #
66
+ # @option params [Array<String>] :whitelist_headers ([]) Additional
67
+ # headers to be included for the signed request. Certain headers beyond
68
+ # the authorization header could, in theory, be changed for various
69
+ # reasons (including but not limited to proxies) while in transit and
70
+ # after signing. This would lead to signature errors being returned,
71
+ # despite no actual problems with signing. (see BLACKLISTED_HEADERS)
46
72
  #
47
73
  # @raise [ArgumentError] Raises an ArgumentError if `:expires_in`
48
74
  # exceeds one week.
@@ -53,11 +79,14 @@ module Aws
53
79
  end
54
80
  virtual_host = !!params.delete(:virtual_host)
55
81
  time = params.delete(:time)
82
+ whitelisted_headers = params.delete(:whitelist_headers) || []
83
+ unsigned_headers = BLACKLISTED_HEADERS - whitelisted_headers
56
84
  scheme = http_scheme(params, virtual_host)
57
85
 
58
86
  req = @client.build_request(method, params)
59
87
  use_bucket_as_hostname(req) if virtual_host
60
- sign_but_dont_send(req, expires_in(params), scheme, time)
88
+
89
+ sign_but_dont_send(req, expires_in(params), scheme, time, unsigned_headers)
61
90
  req.send_request.data
62
91
  end
63
92
 
@@ -72,7 +101,7 @@ module Aws
72
101
  end
73
102
 
74
103
  def expires_in(params)
75
- if expires_in = params.delete(:expires_in)
104
+ if (expires_in = params.delete(:expires_in))
76
105
  if expires_in > ONE_WEEK
77
106
  msg = "expires_in value of #{expires_in} exceeds one-week maximum"
78
107
  raise ArgumentError, msg
@@ -96,17 +125,16 @@ module Aws
96
125
  end
97
126
 
98
127
  # @param [Seahorse::Client::Request] req
99
- def sign_but_dont_send(req, expires_in, scheme, time)
100
-
128
+ def sign_but_dont_send(req, expires_in, scheme, time, unsigned_headers)
101
129
  http_req = req.context.http_request
102
130
 
103
131
  req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
104
132
  req.handlers.remove(Aws::S3::Plugins::S3Signer::V4Handler)
105
133
  req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
106
134
 
107
- signer = build_signer(req.context.config)
108
- req.context[:presigned_url] = true
135
+ signer = build_signer(req.context.config, unsigned_headers)
109
136
 
137
+ req.context[:presigned_url] = true
110
138
  req.handle(step: :send) do |context|
111
139
 
112
140
  if scheme != http_req.endpoint.scheme
@@ -140,34 +168,15 @@ module Aws
140
168
  end
141
169
  end
142
170
 
143
- def build_signer(cfg)
171
+ def build_signer(cfg, unsigned_headers)
144
172
  Aws::Sigv4::Signer.new(
145
173
  service: 's3',
146
174
  region: cfg.region,
147
175
  credentials_provider: cfg.credentials,
148
- unsigned_headers: [
149
- 'cache-control',
150
- 'content-length', # due to a ELB bug
151
- 'expect',
152
- 'max-forwards',
153
- 'pragma',
154
- 'te',
155
- 'if-match',
156
- 'if-none-match',
157
- 'if-modified-since',
158
- 'if-unmodified-since',
159
- 'if-range',
160
- 'accept',
161
- 'proxy-authorization',
162
- 'from',
163
- 'referer',
164
- 'user-agent',
165
- 'x-amzn-trace-id'
166
- ],
176
+ unsigned_headers: unsigned_headers,
167
177
  uri_escape_path: false
168
178
  )
169
179
  end
170
-
171
180
  end
172
181
  end
173
182
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.47.0
4
+ version: 1.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms