Skip to content

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