Skip to content
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

156 admin code fixes #157

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix sensitive_strings searcher for HDF5 files
bbean23 committed Aug 23, 2024
commit 4a31d7531e946db36a92de6f933cdb394151fc14
4 changes: 3 additions & 1 deletion contrib/scripts/sensitive_strings.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,9 @@ def _is_binary_file(self, file_path: str, file_name_ext: str):
ext = ext.lower()
if ext == ".ipynb":
is_binary_file = True
if self._is_img_ext(ext):
elif ext == ".h5":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there no corresponding test update?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is already a test for HDF5 files, but not for this specific use case.

What this change fixes is I overlooked the possibility of a very large HDF5 file being parse-able as text, and thus taking a very long time for this function to return. Really what I should do here is check for large files and assume anything larger than N kilobytes is a binary file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated in commit fd5c12d

is_binary_file = True
elif self._is_img_ext(ext):
if ext in self._text_file_extensions:
is_binary_file = False
elif (f"{file_path}/{file_name_ext}" in self._text_file_path_name_exts) or (