Skip to content
Get started
Bastionary › Knowledge base › Identity fundamentals

Authentication for internal tools and admin panels

By Bastionary · Identity fundamentals

The admin panel that can refund any order, impersonate any customer, and export the entire user table was built in a weekend, protected by a shared password in a team vault, and has never been audited. That is the normal state of internal tooling at a growing company, and it is exactly backwards: the tools with the most destructive power get the least identity rigor. An attacker who phishes one engineer's internal-tool credential does not get one customer's data; they get all of it.

Why internal tools drift into danger

Internal apps start as scripts, graduate to a Flask or Rails admin, and accumulate capabilities faster than anyone writes down. They rarely sit behind the SSO the customer-facing product uses, because "it's just us." Three failure patterns recur: shared credentials that no audit log can attribute to a person, permanent sessions that never expire on a laptop that might get stolen, and all-or-nothing access where every employee who can log in can do everything. Each one turns a minor compromise into a major one.

Put SSO in front of everything, no exceptions

The first move is to route every internal tool through your identity provider so that access is tied to the employee's real account and dies when they leave. Offboarding should be a single deprovision in one place that instantly cuts access to the admin panel, the metrics dashboard, and the database GUI alike. If any internal tool has its own separate login, it is the one that will still work the day after someone is fired.

A lightweight reverse-proxy enforcement layer in front of each tool is the cleanest way to retrofit SSO onto apps that never had it:

# Forward-auth gateway in front of an internal admin app.
# Every request must carry a valid, unexpired session from the IdP.
admin-panel:
  route: admin.internal.example.com
  forward_auth:
    endpoint: https://auth.internal.example.com/verify
    required_claims:
      groups: ["eng-oncall", "support-tier2"]   # group gates the whole app
    session_max_age: 3600        # 1 hour, re-auth after
    idle_timeout: 900            # 15 minutes idle kills the session
  headers_from_idp:
    - X-Auth-User
    - X-Auth-Groups           # downstream app reads these for fine-grained checks

Short sessions and step-up for destructive actions

Customer apps optimize for long sessions; internal tools should do the opposite. A one-hour session with a fifteen-minute idle timeout is reasonable for a support console. Beyond that, the genuinely dangerous actions deserve a second gate: exporting the user table, bulk-deleting records, issuing refunds above a threshold, or impersonating a customer should each trigger a fresh MFA challenge, independent of how recently the person logged in.

Customer impersonation is the feature support teams love and auditors fear. If you build it, make it loud: require a reason string, cap the impersonation session to minutes, write an audit event the customer's own account could theoretically surface, and never let impersonation inherit the ability to change the customer's password or MFA. An impersonation session that can lock the real owner out is a backdoor.

Real roles, not a single admin bit

"Internal" is not a permission level. Support needs to read orders and issue small refunds; it does not need to run SQL. Engineers debugging production need read access to a record, not the ability to delete a tenant. Model internal access as roles scoped to actions, and default everyone to the least role that lets them do their job. The blast radius of a phished support account should be a support account's worth of damage, not root.

// Enforce the action, not just "is this person an admin".
const POLICY = {
  "support-tier1": ["order:read", "refund:issue<=50"],
  "support-tier2": ["order:read", "refund:issue<=500", "customer:impersonate"],
  "eng-oncall":    ["record:read", "job:retry", "feature-flag:toggle"],
} as const;

function can(user: User, action: string): boolean {
  return user.groups.some(g => POLICY[g]?.some(p => matches(p, action)));
}

Audit that answers "who did this"

When a customer's data is wrongly exported or an account is maliciously modified, the only question that matters is who did it and when. That answer is impossible with shared logins and absent with no logging. Every privileged action in an internal tool should emit a structured, append-only audit event tied to a real human identity, including the impersonation chain if the action was taken on a customer's behalf. Store those events somewhere the people who can perform the actions cannot quietly edit them.

An audit log the admins can delete is theater. If the same account that can refund orders can also truncate the audit table, you have logging, not auditing. Ship audit events to append-only storage or a separate system with its own access control.

Break-glass access without a permanent backdoor

There will be a 3 a.m. incident where the person who needs to act does not have the role, and the temptation is a standing super-admin account "just in case." That account is the backdoor an attacker dreams of. The safer pattern is break-glass access: a deliberately awkward path that grants elevated rights for a short window, requires a second person to approve or at least a loud justification, auto-expires, and screams into the audit log. Emergency access should be possible, fully attributed, and impossible to leave switched on by accident.

// Break-glass: elevated, but time-boxed, justified, and loud.
async function requestBreakGlass(user: User, reason: string) {
  if (reason.trim().length < 20) throw new Error("reason required");
  const grant = await grants.create({
    user: user.id,
    role: "incident-admin",
    expiresAt: Date.now() + 30 * 60_000,   // 30 minutes, then gone
    reason,
  });
  await audit.emit({ action: "breakglass.granted", actor: user.id, reason, page: "oncall" });
  await notify.oncallChannel(`BREAK-GLASS by ${user.email}: ${reason}`); // visible to the team
  return grant;
}

Treat internal like external

The mental shift that fixes most of this is simple: your internal tools are a product, and your employees are its users, with all the phishing risk, device-theft risk, and insider risk that implies. Phishing-resistant MFA, short sessions, scoped roles, break-glass instead of standing super-admins, and tamper-evident audit are not enterprise luxuries here; they are the minimum for software that can touch every customer at once.

Self-hosting your identity layer makes this uniform instead of bolted-on: the same SSO, MFA, role model, and audit pipeline you run for customers covers the admin panels too, under one deprovisioning switch. Owning that layer, as teams do with Bastionary, means the most powerful doors in your company are locked with the same key management as the front one.

Run it yourself

Bastionary is free, open-source software. Follow the quick start to have it running on your own server, or browse the releases on Git.

Get started