Skip to content

unsafeVendor allows vendor folders Windows reads as .patchbook #386

Open

Description

@willgosnold

Problem

A vendor folder can be named so that Windows reads it as .patchbook.

unsafeVendor (src/book.ts:226) refuses a vendor folder inside .git in any spelling git or the OS reads as .git, such as .git. or a/.git /x. For .patchbook it only folds case. It returns null for these names:

  • .patchbook.
  • .patchbook /x
  • .patchbook./x
  • .patchbook:x

Windows drops a trailing dot or space from a name, so the first three name .patchbook. .patchbook:x is an alternate data stream on .patchbook. The check for output folders (Book#reservedOutput) refuses the same spellings, so the two checks disagree.

Steps

At a37b015 on Linux, in the verify-patchbook sandbox, each of these exits 0 and writes the vendored copy under the name given:

  • patchbook track extra <url> --vendor '.patchbook.' in a fork
  • the same in a folder layout
  • patchbook init --output-to out --vendor '.patchbook.' in a folder layout

All four names behave the same, 12 of 12 runs. On Windows the copy would land in the patchbook's own folder, and a later sync replaces the vendored copy. That part is reasoned from the code. It wasn't run on Windows.

Expected

The same refusal as for .git.: is inside .patchbook, for every spelling that reservedOutput treats as .patchbook.

Found in review of #385: #385 (comment)

🤖 Generated with Claude Code

Activity

  1. added
    bug
    on Oct 27, 2026
  2. willgosnold commented on Oct 27, 2026

    @willgosnold
    OwnerAuthor

    A second probe agrees, and main at 0688792 behaves the same.

    inPatchbook (src/book.ts:75) already treats these spellings as .patchbook. The [output] to check (line 203) and reservedOutput (line 568) use it. unsafeVendor (lines 226 to 230) uses a plain folded prefix instead. .patchbook/x and .PATCHBOOK/x are refused as expected:

    the vendored copy of extra (.patchbook/x) is inside .patchbook. Every sync replaces it. Change vendor for extra to a folder inside the repo, other than .patchbook and .git.
    

    🤖 Generated with Claude Code

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

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions