Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle S3 access error gracefully with 403 #4954

Merged
merged 1 commit into from
May 11, 2024

Conversation

dantb
Copy link
Contributor

@dantb dantb commented May 10, 2024

Fixes #4887

To test this using localstack would require adding IAM to our container setup, then creating and setting up users with the desired permissions via the SDK. With all that setup, it might be inconsistent with the real S3 anyway. I thought it best to test manually instead by:

  1. Creating user in sandbox with S3 read permissions
  2. Pointing integration tests to sandbox S3 with access keys from my admin user
  3. Pointing the dockerised delta to sandbox S3 with access keys from the restricted user
  4. Run S3StorageSpec, see what file upload failures look like

In the end we now return 403 with

   {
     "@context" : "https://bluebrain.github.io/nexus/contexts/error.json",
     "@type" : "BucketAccessDenied",
     "reason" : "File 'http://delta:8080/v1/resources/6k0mab3nc23xhan/ykab7aepbgphlt0/_/attachment.json' could not be saved using storage 'https://bluebrain.github.io/nexus/vocabulary/mys3storage'",
     "details" : "Access denied to bucket da7goncyy5irq8u at key myprefix/6k0mab3nc23xhan/ykab7aepbgphlt0/files/6/1/6/a/d/7/0/a/attachment.json"
   }

Copy link
Contributor

@shinyhappydan shinyhappydan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is forbidden the correct code to return here? The error is really a delta (or perhaps just the storage) setup issue rather than an issue with the request. I suppose since the story says 403 then it's correct

@dantb dantb merged commit 17b2e7a into BlueBrain:master May 11, 2024
4 checks passed
@dantb dantb deleted the s3-readonly-err branch May 11, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle gracefully read-only access on buckets
2 participants