From dcbdcb8f1c68729be4ccbd4a4f9108552684c557 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Wed, 8 Aug 2018 04:55:53 -0400 Subject: [PATCH] Disallow uploads with x-amz-tagging headers set We don't support it yet, so return 501 Not Implemented. Change-Id: Ie2f4bd1bfdb1bcbdf1a0f0db9d542b6057e9d2ec --- swift/common/middleware/s3api/s3request.py | 3 +++ test/unit/common/middleware/s3api/test_s3api.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/swift/common/middleware/s3api/s3request.py b/swift/common/middleware/s3api/s3request.py index f34c06aabc..a144ccc645 100644 --- a/swift/common/middleware/s3api/s3request.py +++ b/swift/common/middleware/s3api/s3request.py @@ -700,6 +700,9 @@ class S3Request(swob.Request): raise S3NotImplemented('Transfering payloads in multiple chunks ' 'using aws-chunked is not supported.') + if 'x-amz-tagging' in self.headers: + raise S3NotImplemented('Object tagging is not supported.') + @property def body(self): """ diff --git a/test/unit/common/middleware/s3api/test_s3api.py b/test/unit/common/middleware/s3api/test_s3api.py index c2463ac714..02b4d5237e 100644 --- a/test/unit/common/middleware/s3api/test_s3api.py +++ b/test/unit/common/middleware/s3api/test_s3api.py @@ -487,6 +487,9 @@ class TestS3ApiMiddleware(S3ApiTestCase): # > Signature Version 4 streaming API. self._test_unsupported_header('Content-Encoding', 'aws-chunked,gzip') + def test_object_tagging(self): + self._test_unsupported_header('x-amz-tagging') + def _test_unsupported_resource(self, resource): req = Request.blank('/error?' + resource, environ={'REQUEST_METHOD': 'GET',