cloudserver icon indicating copy to clipboard operation
cloudserver copied to clipboard

CloudServer allows you to call GetObject on an object in the Glacier storage class

Open alexwlchan opened this issue 5 years ago • 0 comments

Bug report information

Description

CloudServer and S3 have inconsistent behaviour when calling GetObject on an object in the Glacier storage class.

In particular, it is possible to retrieve the contents of a CloudServer object that has been cycled to Glacier; S3 does not allow this.

Steps to reproduce the issue

Start CloudServer running in a Docker container:

$ docker run -e S3BACKEND=mem -p 8000:8000 zenko/cloudserver:8.2.6

Starting from the boto3 example in the CloudServer docs, create a bucket, put an object in Glacier, then retrieve it using this Python script:

import boto3

client = boto3.client(
    's3',
    aws_access_key_id='accessKey1',
    aws_secret_access_key='verySecretKey1',
    endpoint_url='http://localhost:8000'
)

client.create_bucket(Bucket='mybukkit')

client.put_object(
    Bucket="mybukkit",
    Key="greeting.txt",
    Body=b"Hello world",
    StorageClass="GLACIER"
)

get_resp = client.get_object(
    Bucket="mybukkit",
    Key="greeting.txt",
)

print(get_resp["Body"].read())

Actual result

The script prints the contents of the bucket:

$ python3 cloudserver_example.py
b'Hello world'

Expected result

CloudServer would return the same error as S3 – it's not possible to call GetObject on something in Glacier unless it's been unfrozen:

Traceback (most recent call last):
  File "s3_example.py", line 21, in <module>
    get_resp = client.get_object(
  File "/Users/alexwlchan/Library/Python/3.8/lib/python/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/alexwlchan/Library/Python/3.8/lib/python/site-packages/botocore/client.py", line 635, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidObjectState) when calling the GetObject operation: The operation is not valid for the object's storage class

Additional information

  • Docker version: 1.8.2
  • Node.js/yarn version: whatever's in the Docker image
  • distribution/OS: macOS 10.14.6

alexwlchan avatar Aug 26 '20 10:08 alexwlchan