Repository navigation
Confine build-plan to the checkout, check installer sums, open only web pages - #120
Merged
Merged
Conversation
…eb pages build-plan read the checkout through os.DirFS, which follows a symlinked folder anywhere: a repository committing a -> / with a root directory under it made the planner (root, on builders) read host files. It now reads through os.OpenRoot(dir).FS(), so no path leaves the app folder. install.sh skipped checksum verification without a word when checksums.txt could not be fetched, had no line for the archive, or no sha tool existed. Each of those now stops the install with a message saying why. openBrowser handed API-supplied addresses straight to open/xdg-open, so a file:// path, an app scheme or a leading "-" reached the opener. It now opens only https, or http on this computer (the rule checkBase already applied to HOMEPORT_API, now shared as webAddress); callers already say the address for the person to open when opening fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three hardening items from the 2026-12-02 security audit.
1. build-plan follows symlinked folders out of the checkout
cmd/homeport/buildplan.go:118read the checkout throughos.DirFS(dir).buildplan.readand the root-directory check (buildplan/buildplan.go:488-490,:1004-1019) lstat only the last path component, and DirFS follows a link earlier in the path. A repository committinga -> /with a root directory undera/made the planner, which runs as root on builders, read host files.planBuildopensos.OpenRoot(dir)and passesroot.FS()(go.mod is 1.27.4), the same asbuildcacheandartifact/bundlealready do. Localhomeport deploy/build-planon a normal project is unchanged; a local project folder holding a link to outside it now gets "not found" for files read through that link.TestSymlinkedFoldersInTheRepositoryAreNotFollowed(checkout whosealinks to an outside folder holdingapp/package.json,bun.lock,homeport.yaml; root directorya/app).read through a symlinked folder: {Kind:binary Framework:Bun ... Root:a/app ... Run:./server ...}--- PASS.go test ./...passes.FLEET_CLI_*pin.2. install.sh installs unchecked binaries when the checksum step can't run
install.sh:47-59skipped verification silently whenchecksums.txtfailed to download, had no line for the archive, or neithersha256sumnorshasumexisted.curlserving files from a temp dir, stubmv, PATH limited to the tools needed; no network):nochecksums,noline,noshaall printedinstalled homeport ..., exit 0;badsumrefused.goodinstalls;nochecksums->could not download .../checksums.txt to verify the download — refusing to install;noline->checksums.txt has no checksum for homeport_1.0.0_darwin_arm64.tar.gz — refusing to install;nosha->need sha256sum or shasum to verify the download ...;badsum->checksum mismatch; all exit 1.3. openBrowser hands API-supplied addresses to open/xdg-open unchecked
cmd/homeport/app.go:278-286, called fromlogin.go:44anddomains.go:269,:308: afile://path, an app scheme, or a leading-(an option toopen) reached the opener.openBrowseropens only https, or http on loopback/localhost (needed: the device-login tests and a local API run on http://127.0.0.1). That rule was alreadycheckBase's forHOMEPORT_API; it is now one sharedwebAddress. Refusal returns an error naming the address, and the three callers already print "Open in a browser" when opening fails.TestOnlyAWebPageIsOpened(stubopen/xdg-openon PATH records what it is handed).file:///etc/passwd,vscode://open?file=x,-a Calculator,http://example.com/device,https:///no-host,javascript:alert(1).--- PASS; only the https and loopback http addresses reach the opener.