Rolling out access control on a live system: log mode first
Adding access control to a system that is already in daily use is very different from designing it into a new one. People rely on the current behaviour, legacy roles mean different things to different teams, and a single wrong rule can stop someone doing their job in the middle of a working day.
The safest approach we know is to separate deciding from enforcing. The new rules run alongside the old behaviour, recording what they would have blocked, until the team is confident they are right. This guide walks through that rollout.
1. Catalogue every route and action
Start with an inventory of everything the system can do: every API route, every admin screen, every background action a user can trigger. Each entry gets a permission. Anything without one is a gap.
This step often finds surprises: old endpoints nobody uses, screens that call routes they shouldn't, and actions that were only protected because the button was hidden.
- List every route with its method and purpose
- Assign each one a named permission
- Mark routes that should be public, and confirm them deliberately
- Remove or disable endpoints nobody needs
2. Map legacy roles to the new model
Existing systems usually have a handful of broad roles, or flags like is-admin, whose real meaning lives in people's heads. Interview the teams who use the system and write down what each role actually needs to do, then build new roles from permissions to match.
Map every existing user to a new role before anything is enforced. Users who don't fit a role cleanly are a signal that a role is missing, not that someone should be given administrator access.
3. Run in log mode
In log mode, every request is checked against the new rules, but nothing is blocked. When a request would have been denied, the system records who, what and which permission was missing, and lets the request through as before.
This is the heart of the approach. Real usage tests the rules far better than any planning session, and nobody's work is interrupted while the rules are being tuned.
- Use the same guard code in log and enforce modes, switched by configuration
- Log the user, role, route and missing permission for every would-be denial
- Keep log mode running across a full business cycle, including periodic tasks
4. Review every would-be denial
Go through the denial log with the people who own the process. Each entry is one of two things: a rule that is wrong, so the role needs the permission, or access that should never have been possible, which the new rules are correctly closing.
Fix the first kind in the role definitions. For the second kind, warn the affected users before enforcement so the change isn't a surprise. Repeat until the log contains only denials everyone agrees with.
5. Enforce, with a way back
Switch to enforce mode at a quiet time, with the team ready to watch. Make sure the switch can be reversed in configuration without a deployment, and that a previous release can be restored quickly if something else goes wrong.
- Take a database backup immediately before the deployment
- Keep a configuration switch back to log mode as a kill switch
- Keep the previous release ready to roll back to
- Watch the denial log and support requests closely after enforcement
- Communicate the change and how to report a problem
6. Harden after rollout
Once enforcement is stable, finish the job. Remove the legacy access checks the new system replaced, so there is only one place access is decided. Add automated tests that fail if a new route is added without a permission, and schedule regular reviews of who holds which role.
Access control isn't finished at launch. New features add new permissions, people change jobs, and the audit trail should make all of that visible.
Common questions
What is log mode in access control?
Log mode evaluates every request against the new access rules but doesn't block anything. It records what would have been denied, so the rules can be corrected before they affect anyone's work.
How long should log mode run?
Long enough to cover a full business cycle, including periodic tasks like month-end work, and until the denial log contains only denials everyone agrees with.
What if enforcement blocks someone after go-live?
Switch back to log mode through configuration, fix the role definition, and re-enable enforcement. A tested kill switch makes this a minor event rather than an outage.
Related service
Build products customers can rely on.
Product EngineeringMore guides
- 01 — BUILD
React Native or Flutter: how to choose for your product's app
React Native vs Flutter for your product's mobile app: team skills, code sharing with web, UI approach, native SDKs, hiring, maintenance and store release.
- 01 — BUILD
How to reduce cloud costs without losing recoverability
A practical approach to cutting cloud infrastructure costs: measure first, right-size, remove idle services, and keep backups and recovery intact.
- 01 — BUILD
Managed or self-hosted database: a per-workload decision
How to choose between a managed and a self-hosted database: cost, operational effort, failover, backups and team skills, decided per workload.
- 01 — BUILD
Why a stopped AWS database comes back on, and how to retire it properly
Stopped RDS, Aurora and DocumentDB clusters restart on their own after seven days. How to retire an old database safely, and find the other leftover costs.
- 01 — BUILD
Moving a live app to new infrastructure: a cutover checklist
How to move a live application and its data to new infrastructure without losing anything: discovery, rehearsal, verification, cutover and rollback.
- 01 — BUILD
Self-hosted video or a video API: choosing for a telehealth or consultation app
Building video consultations into your app? Compare a hosted video API with self-hosted WebRTC: cost, reliability, networks, privacy and team effort.
- 01 — BUILD
How to design role-based access for operations software
How to design role-based access control for operations software: permissions, deny by default, server-side checks, custom roles, scoping and audit.
