Repository navigation
fix(py/middleware)!: contain skills and filesystem tools to configured roots - #52
Merged
Merged
Conversation
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 19:08
e4face7 to
3f06c40
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 19:57
3f06c40 to
c23d2da
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 20:02
c23d2da to
6843c66
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 20:21
6843c66 to
3eccbe6
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 21:23
3eccbe6 to
597b801
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 21:28
597b801 to
ef6c441
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 21:53
ef6c441 to
2b13e02
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 22:03
2b13e02 to
3c47f6b
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 9, 2026 23:19
3c47f6b to
a211f0f
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 10, 2026 07:44
a211f0f to
048d352
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 10, 2026 18:37
048d352 to
e7b93f7
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 11, 2026 02:35
e3e8d6e to
65ba206
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 11, 2026 06:22
65ba206 to
aba2bcd
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 11, 2026 16:21
aba2bcd to
d7b803f
Compare
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 11, 2026 17:31
d7b803f to
a3d8c7b
Compare
Skills (PR6-15):
- Skip skill dirs and SKILL.md files whose real path leaves the skill
root; never open a SKILL.md that is a symlink, FIFO, or over 1 MiB.
use_skill re-checks at read time (lstat, O_NOFOLLOW, fstat identity).
- Coerce YAML name/description to str (`name: 404` no longer fails
every turn), strip control/format chars, collapse whitespace.
- First skill to claim a name wins; later ones are logged and skipped.
- Escape tag openers and clip descriptions in the <skills> catalog.
- use_skill read failures no longer return the host path.
Filesystem (PR6-16):
- Drop the lstrip('/') rewrite. Absolute paths inside the root are used
as-is; absolute paths outside are an explicit error. NUL is rejected.
- read_file offset/limit are ge=0; negative values no longer slice.
- Tool errors are returned as the tool response with the host root
redacted instead of queueing a user turn after the tool turn.
- list_files uses lstat and omits symlinks that resolve outside root.
- Escape the read_file path attribute.
Skills are keyed by directory name since b159ca983, so the 64-char frontmatter name cap and its fallback test no longer do anything.
README showed frontmatter name: as if it named the skill. Skills are keyed by directory now, out-of-root skill dirs and symlinked SKILL.md are skipped, and absolute filesystem paths outside the root are refused.
…ll path win Restores pre-PR Python behavior and matches Go (TestSkillsFollowsSymlinkedSkillDirectory, TestSkillsCollisionLaterPathWins). A SKILL.md that is itself a symlink is still never read, and use_skill names stay catalog keys, never paths.
…ls frontmatter parsing
huangjeff5
force-pushed
the
fix/py-1.0-pr6-middleware-sandbox
branch
from
November 11, 2026 18:07
a3d8c7b to
8f7c172
Compare
Merged
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.
FilesystemandSkillsmiddleware let model-chosen paths and skill files reach outside their configured roots.Filesystemrewrote absolute paths into the root, followed symlinks out of it, and leaked the host root path in error messages.Skillslet aSKILL.mdfrontmattername:shadow another skill, and read anySKILL.md, including symlinks and huge files. Both now check the real path first and keep everything inside the root.Changes
/etc/hostsused to become{root}/etc/hosts, and{root}/menu.mdbecame{root}/{root}/menu.md. Absolute paths now resolve as-is: inside the root they work, outside they return an error the model can correct.list_filesleaves out symlinks that point outside the root and special files (FIFOs, sockets, devices).write_filerefuses existing non-regular files instead of hanging on a FIFO, andedit_fileenforces the 10 MiB cap before reading and before writing.usermessage with the raw error, including the absolute host root, between the tool response and the next model turn. The error is now the tool response itself, with the root path stripped.skills/allergy-check/SKILL.mdis alwaysallergy-check; frontmattername:is ignored, so one skill can't claim another's name.SKILL.mdmust be an exact-case regular file under 1 MiB and not a symlink. Symlinked skill directories are still followed. Skill descriptions are escaped so they can't close the<skills>block in the system prompt, and skill paths are scanned once pergenerate()call instead of on every hook and tool call.Breaking changes
name:differs from its directory name is now listed and loaded under the directory name. Prompts or code that refer to the frontmatter name getUnknown skill:SKILL.mdis a symlink or over 1 MiB (logged as a warning), or not spelled exactlySKILL.md(askill.mdused to load on case-insensitive filesystems such as macOS):Cross-SDK
Conversation history on a failed
Filesystemcall changes shape. Python now puts the error in the tool turn, as JS and Go already do. JS, Go, and Dart owners need no changes.