[quality] 🧪 test: cover CheckoutRootFor traversal guard and terminal-urls handler contract - #5433
Conversation
…urls handler contract
Two functions at 0% coverage get dedicated tests:
- pkg/config ProjectConfig.CheckoutRootFor (config.go): table tests for
bare/org-qualified/deep repo slugs, the empty no-op sentinel, whitespace
trimming, and the path-traversal guard ('.', '..', separators) that keeps
a config-supplied repo name from escaping checkouts_dir.
- pkg/dashboard handleAgentTerminalURLs (terminal_urls.go): HTTP contract
tests — 503 on nil AgentMgr, and the documented 'no pane is not an error'
behavior (200 with empty urls/authUrls lists, never null, never an error)
for both a not-running agent and an unknown agent.
Test-only change; no production code touched.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but does not touch If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Test Improvement
Adds dedicated tests for two functions at 0% coverage (per
go tool cover -funcon main). Test-only; no production code touched.Files/functions claimed (disjoint from open hold-gated PRs #5428 and #4032):
src/pkg/config/checkout_root_test.go(new) → testsProjectConfig.CheckoutRootForinsrc/pkg/config/config.go. Disjoint from [quality] 🧪 test(config): hermetic entrypoint boot-prelude tests on in-cluster hosts #5428, which owns onlysrc/pkg/config/entrypoint_boot_test.go.src/pkg/dashboard/terminal_urls_handler_test.go(new) → testshandleAgentTerminalURLsinsrc/pkg/dashboard/terminal_urls.go. The extraction pipeline (prepareTerminalURLs/filterAuthURLs) is already covered interminal_urls_test.go; only the handler branches were untested.What's pinned:
CheckoutRootFor: bare/org-qualified/deep slug resolution, the "" no-op sentinel, whitespace trimming, and the path-traversal guard (.,..,/,\\in a config-supplied repo name must never escapecheckouts_dir) — a security-relevant guard with zero prior coverage.handleAgentTerminalURLs(✨ ux: copying out of the dashboard terminal silently fails — fix OSC52 passthrough, and hint Shift-select where it still matters #5188 endpoint): 503 on nil AgentMgr; documented "no pane is not an error" contract — 200 with empty (never null)urls/authUrlslists for a not-running agent and for an unknown agent.Verified locally:
go test ./pkg/config -run TestCheckoutRootForandgo test ./pkg/dashboard -run TestHandleAgentTerminalURLsboth pass.Related Issue
None — coverage gap found via hourly coverage analysis.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5