[Feature]: Support symlinked directories in `verifyPrivateDirectory`

Open Beginner friendly
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
macos, swift
Domain
backend, desktop

Research direction

Find verifyPrivateDirectory(_:) in the model serving and installation code; the issue shows that it currently uses lstat and rejects symbolic links. Read how the directory’s owner and type are validated, then check nearby tests for directory validation. Done means a user-owned symlink to a directory passes validation while unsafe targets remain rejected.

Written by the indexing model from the issue text.

Description

area: models enhancement needs-triage
Area

Model downloads and installation

Problem or use case

When the TUFF serving/model directory is replaced with a symbolic link (for example, to store large models such as Gemma 4 26B-A4B on an external SSD), loading a model fails during the Validating model directory step with the following error:

Model load failed: The TUFF inference host could not be reached. TUFF serving directory is unsafe: TUFF

BetterCapture_2026-12-04-15 38 46
Suggested change

Supporting user-owned symlinks would allow users with limited internal storage to offload model directories to external volumes without breaking directory validation.

Alternatives or evidence

verifyPrivateDirectory(_:) currently relies on lstat, which inspects the symbolic link itself (S_IFLNK) rather than following it to the target directory (S_IFDIR):

fileprivate static func verifyPrivateDirectory(_ url: URL) throws {
    var info = stat()
    guard url.path.withCString({ lstat($0, &info) }) == 0,
          (info.st_mode & S_IFMT) == S_IFDIR,
          info.st_uid == getuid() else {
        throw ServingHostProfileError.unsafeDirectory(url.lastPathComponent)
    }
}
Would you like to work on this?

None

Dominant language
Swift
Stars
52
Forks
5
PR merge metrics
No merged PRs in 30d

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.

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.