-
Notifications
You must be signed in to change notification settings - Fork 482
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
Handle un-scannable files more gracefully #141
Comments
Hello! I don't understand why the IGNORED_FILE_EXTENSIONS structure should change from a tuple to a dict. Could you offer some more insight on this? On the other side, I made this quick fix dgzlopes@3828be9 on my fork (handling the check inside scan_file() instead of _extract_secrets_from_file()) and seems to work ok. Any idea on where to handle it more gently? |
The reason why I would like to change it to a |
Oh! I see. On the other hand (and sorry if this question is stupid) why we can't use a Set()? They have both the same time complexity (O(1) for membership checking on the average case [0]) and both are implemented with a Hashtable. Also our file extensions values fit in one dimension [1], are unique and can be unordered. Also the Python docs [3] states that they are a good option for membership testing. [0] https://wiki.python.org/moin/TimeComplexity#set |
Oh, I wasn't clear, I did mean set. A dictionary without keys is a set, so I kind of used them interchangeably. |
Thanks @dgzlopes! 👍 🎈 🎉 🎂 |
Having a bunch of
INFO: Checking file: some_image.png
WARNING: some_image.png failed to load.
from
detect-secrets/detect_secrets/core/secrets_collection.py
Line 310 in 9f3d9ee
is not ideal. We know we cannot scan certain files e.g. images, so we should behave more gracefully.
In
detect-secrets-server
we already have theIGNORED_FILE_EXTENSIONS
tuple we made to skip files like thismaybe we should move it to
detect-secrets
, change it to adict
, and use it.The text was updated successfully, but these errors were encountered: