fix(security): add bws_cache.enc.json to file_safety read guard - #70403
fix(security): add bws_cache.enc.json to file_safety read guard#70403necoweb3 wants to merge 1 commit into
Conversation
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Three PRs address the Bitwarden cache read-guard gap: #32092 and #34421 add the exact-path guard for the plaintext bws_cache.json, while #70403 extends the same protection to the separately omitted encrypted bws_cache.enc.json and adds regression coverage.
Related pull requests
- #32092 [closed]
related— (+4/-0) — superseded by merged salvage #34421: Adds an exact-path read denial for the plaintext cache/bws_cache.json without blocking unrelated cache files; it remains relevant as the original implementation and authorship source. - #34421 [merged]
related— (+4/-0) — merged reference implementation: Salvages #32092 verbatim and closes the plaintext-cache gap by adding cache/bws_cache.json to the credential read-block list. - #70403
related— (+47/-0) — merge: Addresses the remaining encrypted-cache gap by blocking cache/bws_cache.enc.json on reads and adds focused tests covering encrypted/plaintext parity and continued access to unrelated cache files.
Duplicates
#32092 and #34421 implement the same bws_cache.json guard; #34421 is the merged salvage of #32092. #70403 is not a duplicate because it protects the distinct bws_cache.enc.json path and adds regression tests.
Suggested consolidation
Merge #70403 — #34421 already landed the plaintext-cache protection, while #70403 closes the analogous read-side omission for the encrypted cache and verifies both paths. #32092 can remain closed as superseded by merged #34421; no additional duplicate closure is needed.
Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 4 kB of PR diffs, 5 kB of issue/PR text, 2 kB of discussion (3 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Summary
Adds
<hermes_home>/cache/bws_cache.enc.jsontoagent/file_safety.py::get_read_block_error(), bringing read-denial protection into full parity with the write-denial rules inbuild_write_denied_paths().Why
PR #31968 and PR #34421 introduced Bitwarden Secrets Manager disk cache handling. While
bws_cache.jsonwas added toget_read_block_error(), andbws_cache.enc.jsonwas added tobuild_write_denied_paths()andweb_server.py,bws_cache.enc.jsonwas omitted fromget_read_block_error().As a result,
read_file("<hermes_home>/cache/bws_cache.enc.json")evaluated toNone(allowed), leaving a read-side credential protection gap for the Bitwarden encrypted cache file.Key Changes
os.path.join("cache", "bws_cache.enc.json")tocredential_file_namesinagent/file_safety.py::get_read_block_error().tests/agent/test_file_safety_bws_enc.pyto verify that reads tobws_cache.enc.jsonare denied alongsidebws_cache.json, while other cache files remain readable.Test