Fix security vulnerabilities: XSS, cookie hardening, rate limiter bypass, HSTS, and open redirect

- Fix XSS in showToast() by replacing innerHTML with safe DOM construction via textContent
- Add Secure flag to session and CSRF cookies when base_url uses HTTPS
- Prevent rate limiter bypass by only trusting X-Forwarded-For/X-Real-IP from private/loopback IPs
- Add Strict-Transport-Security header when running behind HTTPS
- Validate short link URLs to prevent open redirects (must be http, https, or relative path)
- Remove runtime config.toml file write from slug length update handler
- Pin Docker base image to alpine:3.20 instead of floating latest tag

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
lucioandClaude Opus 4.6 committed 2026-05-21 20:57:47 -07:00
1 parent 65e013d728
commit 737a48ac30
5 files changed
+78 -54

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=6 \
# ==========================================
# Final Stage
# ==========================================
FROM alpine:latest
FROM alpine:3.20
# Install basic certificates and tools
RUN apk add --no-cache ca-certificates tzdata