Skip to content

A linked project skill root is scanned outside the repository #2769

Open

Description

@Borjampm

Summary

A non-recursive project skill root that is itself a symlink is scanned wherever it
points. Pointing .claude/skills at a directory outside the workspace makes bb load
every skill under it into the project's skill list. The recursive root shape already
resolves its root against the project boundary before scanning; the flat shape never
does, so the containment rule the code states for project roots is not enforced on the
path most providers actually use.

Versions and environment

  • bb main @ 8d926c312569b63924825db761e9cc73663bc3bc, run from source via scripts/bb-dev-app current
  • Also present in the packaged desktop app 0.40.0
  • macOS 26.4 (darwin 25.4.0), Node v26.4.0
  • Providers: claude-code (claude 2.1.251), codex (codex-cli 0.150.1), pi (0.84.4)

Steps to reproduce

ROOT=$(mktemp -d)
mkdir -p "$ROOT/outside/leaked" "$ROOT/repo/.claude"
printf -- '---\nname: leaked\ndescription: outside the repo\n---\n' \
  > "$ROOT/outside/leaked/SKILL.md"
git -C "$ROOT/repo" init -q .
ln -s "$ROOT/outside" "$ROOT/repo/.claude/skills"     # root itself is the link

bb project create --name leak-demo --root "$ROOT/repo" --json
bb project commands <id> --provider claude-code --json

leaked is listed with "origin": "project".

Did not reproduce with: a root link that stays inside the repository (correct — that
shape is supported and should keep working); a recursive root shape, which already
rejects the same escape (.cursor/skills declared with recursive: true).

Expected vs actual

Expected: (no project skills — the link leaves the repository)
Actual:   ['leaked']

Fixture matrix, bb project commands --provider claude-code, project-origin rows only:

                                     main 8d926c3     with boundary check
projC  .claude/skills -> outside      ['c-outside-root']   (none)
projB  .claude/skills -> in-repo      ['b-via-root-link']  ['b-via-root-link']
projA  real dirs + entry links        ['c-real']           ['c-real']

Only the escaping root changes; every other shape is untouched.

Evidence

  • scanSkillRootFiles reads the root with no boundary test:
    async function scanSkillRootFiles(
    root: CommandScanDirectoryRoot,
    ): Promise<SkillFileMatch[]> {
    const entries = await readDirEntries(root.rootPath);
    if (entries === null) {
    return [];
    }
    const rootLinked = await isSymbolicLinkPath(root.rootPath);
  • The recursive shape does apply the test, against the same boundaryPath:
    async function resolveRecursiveRootPath(
    root: CommandScanDirectoryRoot,
    ): Promise<string | null> {
    const resolvedRoot = await fs.realpath(root.rootPath).catch(() => null);
    if (resolvedRoot === null) {
    return null;
    }
    if (root.origin !== "project" || root.boundaryPath === undefined) {
    return resolvedRoot;
    }
    const resolvedBoundary = await fs
    .realpath(root.boundaryPath)
    .catch(() => null);
    return resolvedBoundary !== null &&
    isPathWithinDirectory(resolvedBoundary, resolvedRoot)
    ? resolvedRoot
    : null;
    }
  • boundaryPath is already populated for every project root, so no contract change is
    needed to consult it:
    const { directories, projectRootPath } = await args.workspace.ancestors();
    return directories.map((directoryPath) =>
    directoryScanRoot({
    boundaryPath: projectRootPath,
    identity: `${args.relativePath}:${toPosixRelativePath(projectRootPath, directoryPath)}`,

    }
    roots.push(
    directoryScanRoot({
    boundaryPath: args.workspace.cwd,
    identity: entry.path,
    namePrefix: entry.namePrefix,
  • The stated intent this violates ("a checked-in (project) plugin must not point bb
    outside the repository"):
    * Symlinks follow the root's origin. A personal (`user`) plugin commonly
    * links a skill from elsewhere in the home directory, so its skill
    * components are followed; a checked-in (`project`) plugin must not point bb
    * outside the repository, so its links are not. Command components never
    * follow a link, whatever the origin.
  • Investigation thread: thr_fuwi9eq7iz

What you ruled out

  • Not Project slash commands are invisible when .claude/commands/*.md are symlinks #2602 — that is the opposite direction (links wrongly skipped, command files, walkMarkdownTree). This is a link wrongly followed, on the skill root path.
  • Not the entry-level symlink rule — entry links are separately over-restricted; that is filed as its own report and does not change this behavior either way.
  • Not provider-specific: any provider declaring a non-recursive project skill root is affected (claude-code .claude/skills, codex .codex/skills, pi .pi/skills).
  • Not a packaging artifact: reproduces from source on main and in packaged 0.40.0.

Suggested priority and effort

Medium — a checked-in symlink silently widens what bb loads into a project's skill list
beyond the reviewed repository contents; no data loss, and it requires a committed
symlink. Effort Low: one boundary check on a path where boundaryPath is already
plumbed. Consider the security label.

Checks

  • I reproduced this on the latest release or on main, or I say above that I could not.
  • I searched open and closed issues for the same problem.
  • If an agent wrote this, the body ends with > AGENT GENERATED and links the thread or report.

AGENT GENERATED

Activity

  1. added theissue type on Aug 31, 2026
  2. added
    host
    security
    confirmed-repro
    on Aug 31, 2026
  3. bb-slop-cop commented on Sep 1, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Bug · Medium priority · Low effort · labels: host, security, confirmed-repro.

    Report: https://get-bb.github.io/reports/issues/2769.html

    • Verdict: REPRODUCED
    • Confidence: high
    • Root cause: The flat skill scanner opens a project root before it resolves and checks the workspace boundary.
    • Reproduction label: confirmed-repro

    No pull request was safe because the fix changes a project-path security boundary and fails the simple-fix rule.

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

    confirmed-reprohostsecurity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions