Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -384,22 +384,28 @@ public void validateUserCanRead(
for (String bucket : buckets) {
List<Boolean> permissions = List.of();
try {
permissions =
storageAsPet.testIamPermissions(
bucket, List.of(GCS_SOURCE_BUCKET_REQUIRED_PERMISSION), options);
logger.info(
"Testing Iam permission: Bucket {}, Pet Service Account {}, Permission Requested {}, Accessible {}",
"Testing Iam permission: Bucket {}, Pet Service Account {}, Permission Requested {}, Dataset's Project ID if available {}",
bucket,
token.getEmail(),
List.of(GCS_SOURCE_BUCKET_REQUIRED_PERMISSION),
permissions);
cloudEncapsulationId);
permissions =
storageAsPet.testIamPermissions(
bucket, List.of(GCS_SOURCE_BUCKET_REQUIRED_PERMISSION), options);
logger.info("Permissions test result: {}", permissions);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to log the result of every bucket permissions check, since the important/useful bit is whether it fails. What do you think?

} catch (StorageException e) {
// This is a potential failure mode for permissions checking: not being able to make the
// permissions check call at all
logger.warn(e.toString());
if (e.getCode() != HttpStatus.SC_FORBIDDEN) {
throw e;
}
throw new StorageException(
e.getCode(),
String.format(
"Could not test permissions. Bucket %s, Pet Service Account %s, Permission Requested %s, Dataset's Project ID if available %s. %s",
bucket,
token.getEmail(),
GCS_SOURCE_BUCKET_REQUIRED_PERMISSION,
cloudEncapsulationId,
e));
}

if (!permissions.equals(List.of(true))) {
Expand Down
Loading