Skip to content

fix: harden vault tools against encoding errors and path traversal#57

Merged
mlorentedev merged 1 commit intomasterfrom
fix/hardening-audit
Mar 13, 2026
Merged

fix: harden vault tools against encoding errors and path traversal#57
mlorentedev merged 1 commit intomasterfrom
fix/hardening-audit

Conversation

@mlorentedev
Copy link
Copy Markdown
Owner

@mlorentedev mlorentedev commented Mar 13, 2026

Summary

  • Catch UnicodeDecodeError in 5 read_text() calls across vault_query, vault_write (append), vault_patch, delegate_task, and _write_lesson — non-UTF-8 files now return a clean error instead of crashing the server
  • Reject glob patterns containing .. in vault_list and validate rglob results against vault boundary to prevent path traversal
  • Wrap iterdir()/rglob() in OSError handlers in list_projects_text, vault_list, and health_report_text so permission errors on individual directories are skipped gracefully

Test plan

  • TestUnicodeDecodeErrors — 3 tests: vault_query, vault_patch, vault_write with non-UTF-8 files
  • test_glob_pattern_rejects_dotdot — validates .. rejection
  • test_glob_pattern_valid — confirms valid patterns still work
  • Full suite: 369 passed, lint clean, mypy clean

- Catch UnicodeDecodeError alongside OSError in 5 read_text calls
  (vault_query, vault_write append, vault_patch, delegate_task,
  _write_lesson) so non-UTF-8 files return an error instead of
  crashing the server
- Reject glob patterns containing '..' in vault_list and validate
  rglob results against vault boundary to prevent path traversal
- Wrap iterdir/rglob in OSError handlers in list_projects_text,
  vault_list, and health_report_text so permission errors on
  individual directories are skipped gracefully
- Add tests for all three fix categories
@mlorentedev mlorentedev merged commit edcd3c0 into master Mar 13, 2026
4 checks passed
@mlorentedev mlorentedev deleted the fix/hardening-audit branch March 13, 2026 01:10
mlorentedev added a commit that referenced this pull request Mar 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.11.3](v1.11.2...v1.11.3)
(2026-03-13)


### Bug Fixes

* harden vault tools against encoding errors and path traversal
([#57](#57))
([edcd3c0](edcd3c0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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