Include check on s3:listBucket permission in check_connection of destination-s3 #10665
Labels
area/connectors
Connector related issues
connectors/destination/s3
type/enhancement
New feature or request
Milestone
Tell us about the problem you're trying to solve
The S3 destination connector occasionally needs
s3:listBucket
permissions on an S3 bucket. This is in the case we run the connector with theOVERWRITE
sync mode. To perform the overwrite, it lists & deletes all objects in the configured bucket directory, then writes the new data.The connector currently does not actually verify that the input IAM user has list permissions on the bucket which prevents running a RESET_SCHEMA job in Airbyte. This means that a user could setup the connector only to have it fail later due to this missing permissions.
Following up on:
#10627
which came from this oncall issue: airbytehq/alpha-beta-issues#7
Describe the solution you’d like
Since the reset operation does a call to
final List<S3ObjectSummary> objects = s3Client.listObjects(bucket, outputPrefix)
, we need to verify the input user has list bucket permissions.Implementation hints
S3Destination.java
calledtestIAMUserHasListObjectPermission
which returns nothing if it succeeds and throws an exception if it fails. Add it to thecheck
method.check
method returns the correct value if thelistObject
call fails to s3. You may need to add as a constructor param for the class a factory which returns anS3DestinationConfig
. This would allow you to mock theS3Client
returned.The text was updated successfully, but these errors were encountered: