Security hardening: fix 19 of 22 vulnerabilities found in audit

Critical:
- Trunk HMAC-SHA1 auth: MsgTrunkHello now carries nonce+digest,
  peer disconnected on secret mismatch (was loaded but never verified)

High:
- Pre-hello guard: reject all trunk messages before handshake completes
- CSPRNG for password generator: random.choice -> secrets.choice

Medium:
- Path traversal protection on callsign-based file operations
- Replace assert() on network-derived UDP data with error handling
- HTTP server connection throttling (matching main TCP server)
- try/catch on regex compilation in callsignOk()/emailOk()
- Per-link trunk talker tracking (clearAllTrunkTalkers scoped to peer)
- Regenerate priority nonce on each new trunk connection
- Cap active TGs and trunk talkers at 10000 each
- Don't reset heartbeat for unauthenticated client app messages
- Fix RENEW_AFTER integer division (2/3 -> 2.0/3.0)

Low:
- JSON-escape HTTP method in error response
- snprintf for pidfile error message
- MsgAuthResponse::digest() null check on empty vector
- Check unpack() return values in AsyncMsg.h vector/map/string
- Replace stack VLA with std::string; reserve+push_back vs resize
- Require TalkerStart before accepting trunk audio
This commit is contained in:
Audric committed 2026-03-20 11:54:18 +01:00
commit fca7c33794
276 files changed
+73533

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
# Stage 1: Build
FROM debian:bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
libsigc++-2.0-dev \
libssl-dev \
libjsoncpp-dev \
libpopt-dev \
libopus-dev \
libgsm1-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY src/ src/
RUN cmake -S src -B build -DLOCAL_STATE_DIR=/var \
&& cmake --build build
# Stage 2: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
libsigc++-2.0-0v5 \
libssl3 \
libjsoncpp25 \
libpopt0 \
libopus0 \
libgsm1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/build/bin/svxreflector /usr/bin/svxreflector
# 5300 tcp+udp: SvxLink client connections and audio
# 5302 tcp: server-to-server trunk links
# 8080 tcp: HTTP status endpoint (optional, enable via HTTP_SRV_PORT)
EXPOSE 5300/tcp 5300/udp 5302/tcp 8080/tcp
ENTRYPOINT ["svxreflector"]
CMD ["--config", "/etc/svxlink/svxreflector.conf"]