Skip to content

security: Fail closed when .agents or .codex itself is a dangling or looping link #1479

Done

Description

@eowca

The Codex reviewer disables every skill under the reviewed checkout's .agents/skills and .codex/skills before launch. Since the fix for #1107, every link at or under those two skill roots is resolved strictly, so a dangling or looping link fails the Codex attempt.

The parent directories .agents and .codex are not checked the same way. The scan tests os.path.lexists(<root>/skills), and that returns false when .agents or .codex is itself a dangling or looping link. The root is then skipped, and Codex starts with no disable entries for it.

When this matters: only if the link target exists inside the review sandbox but not on the host. The sandbox exposes host paths read-only plus a private HOME that holds only runner files, so no PR-selected skill is known to be reachable this way, and a looping link fails the same way for Codex. This is hardening, not a known exploit.

Fix: walk the components .agents/.codex and then skills with lstat. Skip a component that is genuinely absent; resolve every existing component strictly and check that it stays inside the checkout before descending.

Acceptance:

  • A dangling or looping link at .agents or .codex fails the Codex attempt before any Codex call. Extend test_codex_skill_lists_it_cannot_disable_fail_before_any_codex_call to cover both parent paths.
  • Optional, from the same review: the argv test covers a SKILL.md that is itself a link to an in-checkout file with a different name, and asserts the disable entry names the resolved target.

Paths: src/loopzero/runners.py (_repository_skill_paths), tests/test_runners.py.

Raised as the last-round finding on #1432.

Activity

  1. added a commit that references this issue on Nov 26, 2026
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