[L-1] Hardening nits: default RELEASE_COOKIE, precommit alias mutates mix.lock, silent local-deps switch #31

Closed
opened 2026-11-14 18:28:56 +01:00 by amiryahaya · 0 comments
Owner

Finding

A default Erlang distribution cookie (mdid_ws_cookie) ships in the image/compose/.env.example; mix precommit runs deps.unlock --unused which mutates mix.lock as a side effect of a check; use_local_deps?/0 silently swaps git deps for sibling path deps based on directory presence — two machines can build different dependency graphs.

Evidence

  • Dockerfile:102; docker-compose.yml:26; .env.example:8
  • mix.exs:148 (precommit), mix.exs:106-126 (use_local_deps?)

Impact

Weak distribution secret; surprising lockfile churn; non-reproducible builds across machines.

Fix

  • Require a strong generated cookie in prod (no :- default)
  • Drop deps.unlock --unused from precommit or make it read-only
  • Gate local deps behind an explicit USE_LOCAL_DEPS env with a warning

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding A default Erlang distribution cookie (`mdid_ws_cookie`) ships in the image/compose/.env.example; `mix precommit` runs `deps.unlock --unused` which **mutates mix.lock** as a side effect of a check; `use_local_deps?/0` silently swaps git deps for sibling path deps based on directory presence — two machines can build different dependency graphs. ## Evidence - `Dockerfile:102`; `docker-compose.yml:26`; `.env.example:8` - `mix.exs:148` (precommit), `mix.exs:106-126` (use_local_deps?) ## Impact Weak distribution secret; surprising lockfile churn; non-reproducible builds across machines. ## Fix - [ ] Require a strong generated cookie in prod (no `:-` default) - [ ] Drop `deps.unlock --unused` from precommit or make it read-only - [ ] Gate local deps behind an explicit USE_LOCAL_DEPS env with a warning _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Sign in to join this conversation.
No description provided.