Fix/tool result store read boundary#12059
Merged
anakin87 merged 6 commits intoJul 21, 2026
Merged
Conversation
|
@Aarkin7 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
anakin87
requested changes
Jul 21, 2026
anakin87
left a comment
Member
There was a problem hiding this comment.
The PR is good.
I left some minor comments.
|
|
||
| ## Stores | ||
|
|
||
| ### `FileSystemToolResultStore` |
Member
There was a problem hiding this comment.
Let's avoid changing this documentation page. It is still valid.
| read(reference: str) -> str | ||
| ``` | ||
|
|
||
| Read back the content previously written to `reference`. |
Member
There was a problem hiding this comment.
The API reference here is automatically generated and updated, so let's remove this change.
Comment on lines
+4
to
+7
| Harden FileSystemToolResultStore.read() so it only reads references that | ||
| resolve within the configured store root. This closes a boundary gap where | ||
| callers could previously pass an arbitrary filesystem path to read() | ||
| instead of a store-scoped reference returned by write(). |
Member
There was a problem hiding this comment.
Suggested change
| Harden FileSystemToolResultStore.read() so it only reads references that | |
| resolve within the configured store root. This closes a boundary gap where | |
| callers could previously pass an arbitrary filesystem path to read() | |
| instead of a store-scoped reference returned by write(). | |
| Harden ``FileSystemToolResultStore.read()`` so it only reads references that | |
| resolve within the configured store root. This closes a boundary gap where | |
| callers could previously pass an arbitrary filesystem path to ``read()`` | |
| instead of a store-scoped reference returned by ``write()``. |
nitpick
anakin87
enabled auto-merge (squash)
July 21, 2026 10:40
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.
Related Issues
Proposed Changes:
FileSystemToolResultStore.write() already restricted writes to the configured root directory, but read() would accept any filesystem path and read it if it was accessible. This made the read path inconsistent with the write path and broke the expected store boundary.
This PR fixes that by:
haystack/hooks/tool_result_offloading/stores.pywrite()andread()../traversal, absolute out-of-root paths, and symlink references that escape the store rootHow did you test it?
test/hooks/tool_result_offloading/test_stores.pyfor:hatch run test:unit -- test/hooks/tool_result_offloading/test_stores.py test/hooks/tool_result_offloading/test_hooks.pyhatch run test:unit -- test/hooks test/components/agents/test_agent_hooks.pyhatch run test:types -- haystack/hooks/tool_result_offloading/stores.py test/hooks/tool_result_offloading/test_stores.pyhatch run fmt-check haystack/hooks/tool_result_offloading/stores.py test/hooks/tool_result_offloading/test_stores.pyNotes for the reviewer
write()still returns the same kind of reference;read()now enforces that the reference resolves within the configured store root.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.