Fix commonprefix security issue, add ESTALE retry, and tests - #371
Open
arijitroy003 wants to merge 2 commits into
Open
arijitroy003 wants to merge 2 commits into
arijitroy003 wants to merge 2 commits into
Conversation
…Y.md - Replace os.path.commonprefix with os.path.commonpath in untar_package to fix remaining path traversal vulnerability (commonprefix is string-based, not path-aware) - Add retry with exponential backoff for ESTALE (errno 116) in load_file_contents to handle stale file handles on NFS/FUSE mounts (fixes dbt-labs#360) - Add unit tests for encoding.py (md5, JSONEncoder, ForgivingJSONEncoder) - Add unit tests for dict.py (deep_merge, merge, filter_null_values) - Add unit tests for system.py (ESTALE retry, commonpath fix) - Add SECURITY.md based on dbt-labs org security policy template
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Author
|
Friendly bump — this has been open for ~12 days. Happy to address any feedback or make changes if needed. Let me know if there's anything I should adjust. |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Security fix: Replace
os.path.commonprefixwithos.path.commonpathinuntar_package().commonprefixis string-based (not path-aware) and can return incorrect results for paths with shared prefixes that are not actual common directories. Thesafe_extractfunction was already fixed, butuntar_packagestill had the vulnerable call.Stale file handle retry (fixes [Bug] dbt Core 1.9 - Intermittent error "OSError: [Errno 116] Stale file handle" during parsing #360): Add retry with exponential backoff for
ESTALE(errno 116) inload_file_contents(). This handles transient stale file handle errors on NFS/GCS FUSE/network-mounted filesystems, as reported in [Bug] dbt Core 1.9 - Intermittent error "OSError: [Errno 116] Stale file handle" during parsing #360. Uses the approach suggested by @dbeatty10: 3 retries with 0.1s base backoff.Test coverage: Add unit tests for previously uncovered pure functions:
utils/encoding.py:md5(),JSONEncoder,ForgivingJSONEncoderutils/dict.py:deep_merge(nested, empty, mutation safety),merge,filter_null_valuesclients/system.py: ESTALE retry behavior,commonpathcorrectness inuntar_packageSECURITY.md: Add security policy based on the dbt-labs org template, with areas of interest specific to this repo (tarball extraction, file I/O, subprocess execution, network downloads).
Test plan
pytest tests/unit/test_encoding.py tests/unit/test_dict_utils.py tests/unit/test_system.py)