Skip to content

Update load.py #399

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Shivam-Singh-Dev
Copy link

Summary

This PR replaces the use of hashlib.sha1 with hashlib.sha256 in read_file_cached().

Motivation

While SHA-1 is used here only for generating a deterministic cache key (not cryptographic operations), many modern security scanners (e.g., Snyk, Trivy, Bandit) flag its usage due to known weaknesses. This change aligns with current best practices.

Notes

  • This does not impact functionality.
  • The cache key format change is non-breaking as it will simply cause re-caching (safe fallback).
  • All tests pass.

Let me know if you'd like this behind a feature flag or need further changes.

Thanks!

### Summary

This PR replaces the use of `hashlib.sha1` with `hashlib.sha256` in `read_file_cached()`.

### Motivation

While SHA-1 is used here only for generating a deterministic cache key (not cryptographic operations), many modern security scanners (e.g., Snyk, Trivy, Bandit) flag its usage due to known weaknesses. This change aligns with current best practices.

### Notes

- This does not impact functionality.
- The cache key format change is non-breaking as it will simply cause re-caching (safe fallback).
- All tests pass.

Let me know if you'd like this behind a feature flag or need further changes.

Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant