You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: The site search does not stop outside $HOME, and --domain can point outside the home directory #3
Blocker: yes. Fix this before the server-monitoring work starts.
Defect
FindComposeFile (internal/utils/finder.go:23-35) goes up the directory tree until it gets to $HOME.
If the current directory is not in $HOME, the search gets to /. filepath.Dir("/") returns /. Thus, the loop does not stop, and the process uses 100% CPU.
Test: go to a directory outside $HOME that has no docker-compose.yml above it, for example /var/www. Run fly start. Result: the command does not stop.
The function ignores the errors from os.UserHomeDir() and os.Getwd().
The function puts the --domain value into a path, but it does not examine the value.
Test: fly start --domain ../ with HOME=/home/fly. Result: the CLI uses /home/docker-compose.yml.
Cost
If a user runs a command from the wrong directory, the process does not stop. It uses a full CPU core until the user stops it.
A systemd service starts in / by default. If agent code calls this function, the agent stops and does not continue.
The control plane will send domain values. Without a check, a remote value can point to files outside the sites directory. This is a security risk.
The Cursor rules on main say that domain validation prevents path traversal. This statement is not correct.
Benefit of the fix
The search always stops. It gives a clear "not found" error.
The CLI can safely accept a --domain value from the control plane.
The CLI does not lose errors from the operating system.
Fix
Stop the loop when filepath.Dir(dir) == dir.
Return the errors from os.UserHomeDir() and os.Getwd().
Accept a --domain value only if it is a valid hostname. Reject path separators, .. and empty labels.
Make sure that the final path is in the sites root directory.
Completion checks
A command that starts outside $HOME shows "not found" immediately.
--domain ../, --domain .. and --domain a/b show a clear error.
changed the title [-]The site search does not stop outside $HOME, and --domain can point outside the home directory[/-][+]bug: The site search does not stop outside $HOME, and --domain can point outside the home directory[/+]on Oct 1, 2026
Activity
fix(site): stop the site search at / and validate --domain (#19)
[-]The site search does not stop outside $HOME, and --domain can point outside the home directory[/-][+]bug: The site search does not stop outside $HOME, and --domain can point outside the home directory[/+]