fix: Append list error for permission validation
Instead of returning the error right away, append the error when `ListObject` is successful but the key expected if not found. This can be caused if the credentials do not have `s3:PutObject` but have `s3:ListBucket`. Without `s3:PutObject`, the object will not be written to S3 so other calls to find the object will not be successful even if they have valid permissions. This prevents us from returning a `write` error on Boundary because the list call will always fail. Without this, the Permissions are not wrapped and the SBC states are all set to `unknown` even though we know certain permission failed.
This commit is contained in:
1 parent
5add0a1b53
commit
f51527937f
2 files changed
+38
-1
No files matched your search
@@ -820,7 +820,7 @@ func dryRunValidation(ctx context.Context, state *awsStoragePersistedState, attr
|
||||
st, permissions.Read = errors.ParseAWSError(err, "failed to list object")
|
||||
errs = multierror.Append(errs, st.Err())
|
||||
} else if res == nil || len(res.Contents) != 1 || *res.Contents[0].Key != objectKey {
|
||||
return status.New(codes.Aborted, fmt.Sprintf("list response did not contain the expected key: %+v", res))
|
||||
errs = multierror.Append(errs, status.New(codes.Aborted, fmt.Sprintf("list response did not contain the expected key: %+v", res)).Err())
|
||||
}
|
||||
|
||||
if _, err := client.DeleteObject(ctx, &s3.DeleteObjectInput{
|
||||
|
||||
Reference in new issue
Block a user