Files
cdnutterandClaude Opus 5.5 796384420b Security sweep: fix open redirect, XFF rate-limit bypass, SSRF; harden image and compose
- Reject control chars and backslashes in redirect targets
- Use proxy-added X-Forwarded-For entry, cap limiter keys
- Block private/loopback/link-local addresses on image fetch
- HSTS over HTTPS, generic error on custom CSS
- x/crypto 0.59.0, pin golang:1.27.4-alpine3.24 and alpine:3.24.4
- Compose: cap_drop ALL, no-new-privileges, read_only, limits, labels
- Add SECURITY.md, CHANGELOG.md, TODO.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:16:31 -08:00

27 lines
880 B
Docker

FROM golang:1.27.4-alpine3.24 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" -o /out/canon ./cmd/canon
FROM alpine:3.24.4
RUN apk add --no-cache ca-certificates tzdata su-exec \
&& mkdir -p /data /backups
COPY --from=build /out/canon /usr/local/bin/canon
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
# The entrypoint starts as root only to set ownership, then runs Canon as
# PUID:PGID.
ENV CANON_DATA_DIR=/data \
CANON_PORT=4242 \
PUID=1000 \
PGID=1000 \
UMASK=022
VOLUME /data /backups
EXPOSE 4242
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD wget -qO- http://127.0.0.1:${CANON_PORT}/healthz >/dev/null || exit 1
ENTRYPOINT ["docker-entrypoint.sh"]