catalog: load_skill reads a symlinked SKILL.md before the containment check

Open Beginner friendly
#1,126 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
security

Research direction

Start in dokimi/external/catalog.py around lines 232 and 236, where load_skill(path) runs before the _within(skill.path, root) containment check. Resolve the path and check containment before any read. Add a test that proves the symlinked outside file is never opened; the existing Path.read_text spy cannot see that read, so use a different spy or check. Done when the outside file is never read and the new test passes.

Written by the indexing model from the issue text.

Description

Raised in the review of PR #838 (intel/dokimi), thread IC_kwDOVBg7g88AAAABpjlHlw: https://github.com/intel/dokimi/pull/838

dokimi/external/catalog.py calls load_skill(path) before checking _within(skill.path, root) (lines 232 and 236, same on intel/main). A SKILL.md symlinked to a file outside the root is read before it is refused. Found in review of #838; the existing test's Path.read_text spy cannot see the read. Fix: check the resolved path before reading, and add a test that the outside file is never opened.

Not fixed in PR #838: it is outside the lines that PR changes (another component, a design change, or too large for the round).

Dominant language
Python
Stars
39
Forks
13
Avg merge
1d 10h
Merged PRs (30d)
519

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/dokimi

All issues in intel/dokimi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.