security: harden container, SSRF/path traversal, cookies e secrets - #1
Merged
Merged
Conversation
- Dockerfile: run as non-root 'trace' user (groupadd/useradd, chown /app /data, USER trace) — closes CRITICAL root container - internal/api/validation.go: ValidateURL now parses host via net/url + net.ParseIP.IsPrivate/IsLoopback (fixes userinfo bypass http://example.com@10.0.0.1 and missing ftp/expect/php/data schemes); ValidatePath decodes %2e/%00 and blocks encoded traversal - internal/config/config.go: CookieSecure defaults to true in production even when PublicURL is http (TLS terminated at proxy); ValidateProduction rejects placeholder secrets (changeme/super-secret/ devlocal) and requires >=12 char admin password; validates TRACE_JWT_SECRET/TRACE_BOOTSTRAP_TOKEN placeholders - go.mod/go.sum: bump klauspost/compress 1.17.9->1.19.2 (OOM fix) and golang.org/x/crypto 0.54.0->0.55.0 Fixes: root container, SSRF bypass, path traversal %2e, Cookie Secure, placeholder secrets in prod, outdated deps
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.
Contexto: auditoria encontrou 5 achados CRITICAL/HIGH no trace: container como root, bypass SSRF via userinfo, path traversal com encoding, Cookie Secure desabilitado atras de proxy e placeholder secrets aceitos em prod.
O que muda:
Risco: baixo. go vet OK. Validar TRACE_ENV=production rejeita token devlocal.