fix: add magic-byte checks, login rate limits, and non-root Docker

Close the remaining security gaps: validate upload content against
file signatures, rate-limit admin login failures with configurable
thresholds, and run the container as uid 1000 instead of root.
This commit is contained in:
vastsa committed 2026-07-23 22:23:04 +08:00
1 parent c11059b851
commit eda0a3127a
12 files changed
+350 -34

No files matched your search

+8 -1
View File
@@ -63,7 +63,14 @@ RUN apt-get update \
&& apt-get upgrade -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir -r requirements.txt \
&& pip cache purge || true
&& pip cache purge || true \
&& groupadd --system --gid 1000 appuser \
&& useradd --system --uid 1000 --gid appuser --create-home --home-dir /home/appuser --shell /usr/sbin/nologin appuser \
&& mkdir -p /app/data \
&& chown -R appuser:appuser /app
# 非 root 运行,降低容器逃逸后的主机影响面
USER appuser
# 环境变量配置
ENV HOST="0.0.0.0" \