Skip to content

SafeReadFile does not guard against symlinked directories #88

Description

@dacharyc

Follow-up to #78. util.SafeReadFile uses os.Lstat on the final path component, which blocks symlinked files. But if a directory in the path is a symlink (for example references/ itself pointing outside the skill tree), os.ReadDir follows it and the regular files inside pass the check, so out-of-tree content can still be read and shipped to the LLM judge.

Possible fix: resolve the skill root once with filepath.EvalSymlinks, then verify each candidate path resolves to a location inside that root before reading (containment check), rather than only checking the leaf's file mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions