-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/remove allow all bucket statement (#1106)
### Feature or Bugfix - Bugfix ### Detail - Remove unnecessary AllowAllToAdmin statement in bucket policy and in access point policies - For the deletion of access points in existing shares I kept a reference to `AllowAllToAdmin`. We could change this, I am not strong opinionated. - For existing bucket policies and access point policies `AllowAllToAdmin` will be deleted when all folders are revoked. It is unnecessary but it does not harm anyone to leave it as it is for existing shares. [UPDATE] Since the testing uncovered issues derived from removing `AllowAllToAdmin` with the current clean-up actions I took the issue #1101 and included it in this PR. On top of the aforementioned changes, this PR: - Remove unnecessary `clean_up` functions from revoke_folders and move the clean_up logic into the `process_revoked_folders` function (from the `data_sharing_service.py`) - Break `delete_access_point_policy` into smaller functions with less responsibilities: `revoke_access_in_access_point_policy` that generates the new access point policy; `attach_new_access_point_policy` that attaches a given policy to an access point; `delete_access_point` that deletes an access point. - Logic on what should be deleted moved to `backend/dataall/modules/dataset_sharing/services/share_processors/s3_access_point_process_share.py`. Only if the resulting policy contains no statements the access point is deleted, the IAM permissions revoked from the requester IAM role and the KMS key policy revoked. - Bonus point: fixed small bug on the clean-up (it was assuming prefix_list is a list, but for a single folder shared it can be a string) ### Relates - #997 - #1101 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
8 changed files
with
101 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.