swift/test/unit/common/middleware/s3api
Tim Burke 423f96293b Verify client input for v4 signatures
This is a combination of 2 commits.

==========

Previously, we would use the X-Amz-Content-SHA256 value when calculating
signatures, but wouldn't actually check the content that was sent. This
would allow a malicious third party that managed to capture the headers
for an object upload to overwrite that with arbitrary content provided
they could do so within the 5-minute clock-skew window.

Now, we wrap the wsgi.input that's sent on to the proxy-server app to
hash content as it's read and raise an error if there's a mismatch. Note
that clients using presigned-urls to upload have no defense against a
similar replay attack.

Notwithstanding the above security consideration, this *also* provides
better assurances that the client's payload was received correctly. Note
that this *does not* attempt to send an etag in footers, however, so the
proxy-to-object-server connection is not guarded against bit-flips.

In the future, Swift will hopefully grow a way to perform SHA256
verification on the object-server. This would offer two main benefits:

  - End-to-end message integrity checking.
  - Move CPU load of calculating the hash from the proxy (which is
    somewhat CPU-bound) to the object-server (which tends to have CPU to
    spare).

Closes-Bug: 1765834
(cherry picked from commit 3a8f5dbf9c)

----------

s3api: Allow clients to upload with UNSIGNED-PAYLOAD

(Some versions of?) awscli/boto3 will do v4 signatures but send a
Content-MD5 for end-to-end validation. Since a X-Amz-Content-SHA256
is still required to calculate signatures, it uses UNSIGNED-PAYLOAD
similar to how signatures work for pre-signed URLs.

Look for UNSIGNED-PAYLOAD and skip SHA256 validation if set.

(cherry picked from commit 82e446a8a0)
(cherry picked from commit 6ed165cf3f)

==========

Change-Id: I61eb12455c37376be4d739eee55a5f439216f0e9
2019-10-22 14:54:31 +00:00
..
__init__.py Add debugging info to SignatureDoesNotMatch responses 2018-08-17 18:03:47 +00:00
exceptions.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
helpers.py Add debugging info to SignatureDoesNotMatch responses 2018-08-17 18:03:47 +00:00
test_acl.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_acl_handlers.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_acl_utils.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_bucket.py s3_acl: Require swift_owner authz to create buckets 2018-08-15 12:56:33 +00:00
test_cfg.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_etree.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_helpers.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_location.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_logging.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_multi_delete.py Fix the deletion of non-existent keys 2018-08-13 14:19:23 -07:00
test_multi_upload.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_obj.py Verify client input for v4 signatures 2019-10-22 14:54:31 +00:00
test_s3_acl.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_s3api.py Disallow uploads with x-amz-tagging headers set 2018-08-08 04:57:32 -04:00
test_s3request.py Verify client input for v4 signatures 2019-10-22 14:54:31 +00:00
test_s3response.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_s3token.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_service.py Add debugging info to SignatureDoesNotMatch responses 2018-08-17 18:03:47 +00:00
test_subresource.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_utils.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00
test_versioning.py Import swift3 into swift repo as s3api middleware 2018-04-27 15:53:57 +09:00