fix(squid): run Squid container as non-root user#1153
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Install gosu in the Squid container and use it to drop from root to the proxy user (UID 13) before starting Squid. The entrypoint still runs as root initially to fix mounted volume permissions, then drops privileges via `gosu proxy` before exec'ing squid. Changes: - Dockerfile: install gosu, create and chown /var/spool/squid, /var/run/squid, and /etc/squid for the proxy user - entrypoint.sh: use `exec gosu proxy squid -N -d 1` instead of `exec squid -N -d 1` Fixes #250 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Squid's default pid_filename is /run/squid.pid, which is not writable by the proxy user after dropping privileges via gosu. Create and chown the pid file before starting Squid. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The squid.conf was written with mode 0o600 (owner-only), but since Squid now runs as the proxy user via gosu, it couldn't read its own config file. Changed to 0o644 so the proxy user can read it. The docker-compose.yml retains 0o600 since it contains sensitive environment variables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f8a3885 to
b82ef19
Compare
C++ Build Test Results
Overall: PASS 🎉
|
🦀 Rust Build Test Results
Overall: ✅ PASS
|
Build Test: Node.js Results ✅
Overall: PASS
|
Smoke Test Results ✅ PASS
Overall: PASS —
|
Smoke Test ResultsLast 2 merged PRs:
Overall: PASS
|
.NET Build Test Results
Overall: PASS Run outputhello-world:
|
Build Test: Deno ✅
Overall: PASS
|
|
PR titles: fix(deps): resolve minimatch ReDoS and ajv vulnerabilities | fix: add explicit execute directive to smoke-codex to prevent noop
|
Java Build Test Results
Overall: PASS ✅
|
🧪 Build Test: Bun
Overall: ✅ PASS Bun version:
|
Go Build Test Results ✅
Overall: PASS
|
Chroot Version Comparison Results
Result: ❌ Not all runtimes match — Python and Node.js versions differ between host and chroot environment.
|
Summary
Fixes #250
gosuin the Squid container Dockerfile for privilege de-escalationproxyuser (UID 13) during image buildproxyuser viagosu proxy squid -N -d 1Changes
containers/squid/Dockerfile: Addedgosuto installed packages, created and chowned/var/run/squidand/var/spool/squiddirectories for proxy usercontainers/squid/entrypoint.sh: Added permission fixes for/etc/squid,/var/run/squid,/var/spool/squid, and usesgosu proxyto start Squid as non-rootTest plan
npm run buildpassesnpm run lint- 0 errorsdocker exec awf-squid whoamireturnsproxy🤖 Generated with Claude Code