-
Notifications
You must be signed in to change notification settings - Fork 82
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
Introduce check for IAM actions in share_verify bucket and access points + reapply with list of allowed actions #1407
Introduce check for IAM actions in share_verify bucket and access points + reapply with list of allowed actions #1407
Conversation
@@ -118,7 +118,7 @@ def check_s3_iam_access(self) -> None: | |||
existing_policy_statement=policy_document['Statement'][s3_statement_index], | |||
): | |||
logger.info( | |||
f'IAM Policy Statement {IAM_S3_BUCKETS_STATEMENT_SID}KMS does not contain resources {s3_target_resources}' | |||
f'IAM Policy Statement {IAM_S3_BUCKETS_STATEMENT_SID}S3 does not contain resources {s3_target_resources}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
else: | ||
policy_check, missing_policies, extra_policies = share_policy_service.check_s3_actions( | ||
existing_policy_statement=policy_document['Statement'][s3_statement_index] | ||
) | ||
if not policy_check: | ||
logger.info(f'IAM Policy Statement {IAM_S3_BUCKETS_STATEMENT_SID}S3 has invalid actions') | ||
self.bucket_errors.append( | ||
ShareErrorFormatter.invalid_policy_error_msg( | ||
self.target_requester_IAMRoleName, | ||
'IAM Policy Resource', | ||
f'{IAM_S3_BUCKETS_STATEMENT_SID}S3', | ||
'S3 Bucket', | ||
f'{self.bucket_name}', | ||
missing_actions=missing_policies, | ||
extra_actions=extra_policies, | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check_s3_actions(...)
for folder shares as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such as with backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py
file in https://github.com/data-dot-all/dataall/pull/1406/files#diff-1d48910db676c4a11b5ff22dcb45a55eb6c31ebd2d9aa1313f90ce4e13b8ecfc
Test:
|
backend/dataall/modules/s3_datasets_shares/services/s3_share_managed_policy_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/s3_datasets_shares/services/s3_share_managed_policy_service.py
Show resolved
Hide resolved
backend/dataall/modules/s3_datasets_shares/services/s3_share_managed_policy_service.py
Show resolved
Hide resolved
backend/dataall/modules/s3_datasets_shares/services/share_managers/share_manager_utils.py
Show resolved
Hide resolved
.../dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I tested it by manually setting s3:*
on a folder/share policy and then run the check and the fix and worked fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Feature or Bugfix
Detail
Relates
Security
Please answer the questions below briefly where applicable, or write
N/A
. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
eval
or similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.