A MongoDB Docker image ships a dev config with authorization turned off
The scenario
A new data-node image was built for a local demo and promoted by the same tag the operator uses. Its mongod config sets authorization disabled. The pod starts, becomes Ready, and anyone who can open the port has full access. The pipeline owner says it is fine because the network policy exists.
Model answer
What I'd say first:
This image turned authorization off, so there is no user check at all. A network policy is not a substitute. I would stop the rollout and ship an image that requires auth. I would not leave this tag in production.
How I'd work it:
- 1Pause the rollout and read the effective mongod config inside the running pod. Confirm authorization is disabled and that the image tag matches what CI just promoted.
- 2Stop traffic to those pods. A Ready pod with auth off is an open database, not a healthy member.
- 3Rebuild from the config that enables authorization and SCRAM (the username and password mechanism), or the keyfile the replica set already uses. Pin the digest.
- 4After a member starts with auth and can still do a majority write as the app user, tell the room the demo image and the production image were the same tag.
How I'd explain it:
Authorization disabled means mongod does not check users. Anyone who reaches the port is an admin, including a pod that should only have readWrite on one database. Network policy reduces who can try.
How I'd prevent it:
Fail the image build if the config disables authorization or omits the keyfile. Promote by digest, not by a floating tag shared with local demos. Scan the entrypoint for --noauth. Keep a staging start that must log in as the app user or the deploy stops.
The follow-up they'll ask
“The network policy only allows the app namespace. Can we leave auth off?”
No. Auth is the database checking the user. The policy is a second layer, and it will be wrong someday: a debug pod, a widened rule, a new namespace. With auth off, that mistake is full admin. I would ship the image that requires a user, and keep the policy too.
Common mistakes
- Trusting the network policy alone
- Promoting a demo tag
- Leaving authorization disabled
- Calling Ready a secure member