fix(web,update): PathEscape ollama model names; respect NXD_NO_BROWSER#68
Merged
Merged
Conversation
Two low-severity hardening fixes from the 2026-06-11 security audit, bundled because they live across two tiny files. - ollamaRemoteDigest interpolated the model name and tag directly into the /v2/library/<name>/manifests/<tag> URL. An operator-supplied model name with a slash (e.g. accidental "library/gemma4") would traverse into a different registry API subtree; a tag with spaces produced a malformed URL and a confusing 400. Wrap both segments with url.PathEscape so the URL structure is invariant under any config value. - openBrowser fired `open` / `xdg-open` with the full token-bearing URL as a process argument. On most systems `ps` is world-readable by every local user — multi-tenant CI runners and shared dev hosts could leak the auth token to other users on the machine. Add NXD_NO_BROWSER=1 opt-out so operators in headless / SSH / CI environments can suppress the launch. The URL is still printed via log.Printf for operator discovery. Surfaced by the 2026-06-11 security audit (SEC-L1, SEC-L2). New tests: - TestOllamaRemoteDigest_PathEscapesModelName captures r.URL.EscapedPath() and asserts a slashed model name comes through as %2F instead of segment-splitting. - TestOpenBrowser_RespectsNxdNoBrowser sets NXD_NO_BROWSER and runs the function (no panic, no leaked process).
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.
Summary
Two low-severity hardening fixes from the 2026-06-11 security audit, bundled because they touch two tiny files.
ollamaRemoteDigestinterpolated the model name and tag directly into/v2/library/<name>/manifests/<tag>. An operator-supplied model name with a/(accidentallibrary/gemma4) would traverse into a different API subtree; a tag with spaces produced a malformed URL and a confusing 400. Wrap both withurl.PathEscape.ps(SEC-L2).openBrowserpassed the full token-bearing URL as a process argument toopen/xdg-open.psis world-readable on most multi-tenant systems. AddNXD_NO_BROWSER=1opt-out for headless / CI / SSH environments. The URL is still printed vialog.Printffor discovery.Test plan
TestOllamaRemoteDigest_PathEscapesModelNamecapturesr.URL.EscapedPath()and asserts a slashed model name comes through as%2Finstead of segment-splitting.TestOpenBrowser_RespectsNxdNoBrowsersets the env var and runs the function (no panic, no leaked process).go build ./...,go vet ./...,go test ./... -count=1 -timeout 240sall green locally.Audit traceability
Security findings SEC-L1, SEC-L2 (2026-06-11 sweep).