You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I really like this repo, managing S3 data like pathlib Path's is awesome. I'd like to use your s3path in an internal project. However, a security scan by Fortify revealed this one "vulnerability" so I wanted to contribute to its removal, so our security guys will be happy.
This is what the Fortify had to say about the offending line access_key = secret_key = token = None:
"Null encryption keys can compromise security in a way that is not easy to remedy.
Assigning None to encryption key variables is a bad idea because it can allow attackers to expose sensitive and encrypted information. Not only does using a null encryption key significantly reduce the protection afforded by a good encryption algorithm, but it also makes fixing the problem extremely difficult. After the offending code is in production, a software patch is required to change the null encryption key. If an account protected by the null encryption key is compromised, the owners of the system must choose between security and availability."
I will say, to get to this part in the code, you need to have python<3.12 and smart-open<5.1.0. The latter requirement is already blocked by your setup.py requirements, so if you're okay with more formally removing support for smart-open<5.1.0 (forcibly installing smart-open==5.0.0 causes 1 pytest failure on python 3.10 (test_open_method_with_custom_endpoint_url - AssertionError: assert 'https://s3.amazonaws.com' == 'http://localhost') and 21 on python 3.12 (all are TypeError: open() got an unexpected keyword argument 'compression')) I'm down to make an alternative PR removing this code support for <5.1.0 entirely. However, this proposed change maintains the exact same functionality as before.
I've ran the pytests with these changes and no extra errors occur asides from those inherent to smart-open==5.0.0 as mentioned. Other than with your moto tests not requiring credentials, I've otherwise tested on a bucket requiring credentials, and seen that you will get the same authentication error, whether 'aws_secret_access_key' etc. is to None (current), or not provided at all (this proposed change).
Hi @dillonjlee
satisfying security guys is important so I'm all with you 😆
OK so lets add this change
Just so I'll understand, you want to add also in the setup.py requirements smart-open>5.1.0 instead of smart-open>=5.1.0?
If so I'm ok with it, just update your PR with this change and will add everything together
If smart_open needs to be >= 5.1.0 for future versions of s3path (needed based on pytests), we can just always use "new" one, and remove "old" one. I understand if you are wanting to keep "old" for partial support for older versions though!
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello! I really like this repo, managing S3 data like pathlib Path's is awesome. I'd like to use your s3path in an internal project. However, a security scan by Fortify revealed this one "vulnerability" so I wanted to contribute to its removal, so our security guys will be happy.
This is what the Fortify had to say about the offending line
access_key = secret_key = token = None:I will say, to get to this part in the code, you need to have python<3.12 and smart-open<5.1.0. The latter requirement is already blocked by your setup.py requirements, so if you're okay with more formally removing support for smart-open<5.1.0 (forcibly installing smart-open==5.0.0 causes 1 pytest failure on python 3.10 (
test_open_method_with_custom_endpoint_url - AssertionError: assert 'https://s3.amazonaws.com' == 'http://localhost') and 21 on python 3.12 (all areTypeError: open() got an unexpected keyword argument 'compression')) I'm down to make an alternative PR removing this code support for <5.1.0 entirely. However, this proposed change maintains the exact same functionality as before.I've ran the pytests with these changes and no extra errors occur asides from those inherent to smart-open==5.0.0 as mentioned. Other than with your moto tests not requiring credentials, I've otherwise tested on a bucket requiring credentials, and seen that you will get the same authentication error, whether 'aws_secret_access_key' etc. is to None (current), or not provided at all (this proposed change).