Reject path traversal in deploy log download handler (closes #177)

The deploy-log download handler passed a request-derived path to
http.ServeFile, which gosec flags as G703 (path traversal via taint).
The handler now opens the log through an os.Root confined to the deploy
log directory, so any escaping path is rejected at runtime (404) and the
file is streamed with http.ServeContent. A regression test plants a
sentinel outside the log dir and asserts the traversal is refused and its
contents never served; removing the guard makes that test fail. No
//nolint used.

Model: opus-4-8
This commit was merged in pull request #194.
This commit is contained in:
2026-09-22 11:01:07 +02:00
parent 1d38585431
commit f1dfd382a4
5 changed files with 161 additions and 8 deletions
+3
View File
@@ -22,6 +22,9 @@ main cannot regress.
- 2026-09-22: Added `.prettierignore` so `make fmt` no longer rewrites
the vendored `static/js/alpine.min.js` bundle (#185).
- 2026-09-22: Fixed the gosec G703 path-traversal finding in the deploy
log download handler by verifying the resolved path stays within the
deploy log directory before serving, returning 404 on escape (#177).
- 2026-09-09: Fixed four deployability blockers found by QA: CSRF origin
check over plain HTTP (`UPAAS_PLAINTEXT_HTTP`, #189), pulling the git
image when absent (#190), the env-var editor CSRF token lookup (#191),