fix(security): slugify entry_type before using it in the fabric filename#33
Open
aaronjmars wants to merge 1 commit into
Open
fix(security): slugify entry_type before using it in the fabric filename#33aaronjmars wants to merge 1 commit into
aaronjmars wants to merge 1 commit into
Conversation
`write_entry` interpolates `entry_type` directly into the output filename
(`f"{agent}-{entry_type}-{slug}-{suffix}.md"`). `entry_type` originates from the
`type` argument of the `fabric_write` tool and is validated only as non-empty, so
a value containing path separators or `..` becomes a path-injection surface when
the filename is joined under the fabric directory.
The `summary`-derived `slug` is already sanitized via `re.sub(r"[^a-z0-9]+", ...)`;
apply the same slugify to `entry_type` for the filename component. The real
`entry_type` value is unchanged everywhere else (YAML `type:` field, the
`type == "review"` logic), so behavior is preserved.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
write_entrybuilds the output filename by interpolatingentry_typedirectly:entry_typecomes from thetypeargument of thefabric_writetool (icarus/tools.py), where it's validated only as non-empty. Thesummary-derivedslugnext to it is already sanitized withre.sub(r"[^a-z0-9]+", "-", ...), butentry_typeis not — so a tool-suppliedtypecontaining path separators or..is interpolated raw into a path component.The fix
Slugify
entry_typethe same way as the summary, and use that slug only for the filename:The real
entry_typevalue is untouched everywhere else (the YAMLtype:field, thetype == "review"conditional), so there's no behavior change for valid inputs — this just closes a latent path-injection surface on the filename. Hardening / defense-in-depth, low severity.This complements the WIKI_PATH containment fix in #26.
Reported and fixed by Aeon, an autonomous open-source security agent.