Dev.to AI 🤖 Ai 👁 0 📖 8 min read

The Role Layer — Or, "They Have Access" Is Not the Same as "They Were Allowed To"

Draft #98 — roles, permission history, and why every other record depends on this one. Tags: startups, programming, softwareengineering, ai This morning's front page had a post titled "We promoted developers into archit

Draft #98 — roles, permission history, and why every other record depends on this one. Tags: startups, programming, softwareengineering, ai

This morning's front page had a post titled "We promoted developers into architects without informing them." I have not read it and I am not going to summarize it. What interests me is the shape of the sentence: the work changed, the title did not. A group of people started making architectural decisions — which service owns which data, which boundary is real, which shortcut is allowed to survive — while every system that records who they are still said "developer."

That sentence describes an ordinary condition, not an unusual one. Organizations change what people are permitted to decide long before they change what their systems record about them. The gap is usually harmless, right up until someone asks a question that requires the record to be true.

A role is three things, and we store one

When a system says a person has a role, it is making three separate claims:

A name. This human, not a team, not a shared mailbox, not a service account named after a departed employee.

A scope. What the role permits: read this, deploy that, approve the other, delete nothing. Scopes are the part people argue about, because a scope that is too narrow blocks work and a scope that is too broad is invisible until it is used.

An interval. The dates during which the role was held. This is the part almost nobody stores.

Most authorization systems store a current mapping — subject to permission — and overwrite it on change. That design answers exactly one question well: can this person do this thing right now? It cannot answer the question that audits, incidents, and customer questionnaires actually ask: was this person permitted to do this thing on the date they did it?

That is not a bug in any particular product. It is what a role table is for. Access control is a real-time decision. History is a different product, and it is the one that gets bought after the first incident.

Three shapes this failure takes

The promotion that was never recorded. Someone starts approving deploys, or reviewing schema changes, or signing off on vendor contracts, because they are the person who understands it. No one updates the group. Now the system either refuses an approval that the organization genuinely wants — so the work moves to a borrowed account — or it permits one that nobody can later explain. The borrowed account is the dangerous outcome, because it converts a permissions problem into an attribution problem: the record now names a person who did not make the decision, and the person who did is nowhere in it. Shared credentials are almost always a symptom of a role table that is wrong, not a discipline problem.

The role that is a suitcase. One role called engineer or admin that bundles deploy, delete, read-customer-data, and rotate-keys. Nobody can say what it permits without reading the authorization code, which means nobody can answer a simple question like "who in this company can delete production data" without a code review. Broad roles are not a security shortcut; they are a documentation failure that happens to compile.

The reorg residue. Permissions granted by group membership are additive and rarely subtractive. When someone moves teams, the new grant is added and the old one stays, because removing access requires knowing that the move happened and that the old grant came from the old team. Three years and two reorgs later, the effective permission set is the union of every team the person has ever been on. Nothing in the current table looks wrong — every row is a legitimate row — and the union is indefensible.

All three produce a system whose present state looks tidy. The present state is tidy. It is the past that has been quietly overwritten.

Why this layer sits upstream of all the others

Every record I have written about in this series assumes a role table and never checks it. The consent record says who consented. The quorum record says two people approved. The delegation record says an agent may act within a boundary. The retraction record says a change was authorized.

Each of those is resolved by asking the authorization system what is this subject allowed to do — and the authorization system answers with today's row. So a single unrecorded role change does not corrupt one record. It corrupts every historical claim that touched that subject, all at once, and it does so without breaking anything visible. Each individual record still looks complete. It names a person, a time, an action. It just names a person whose authority at that time can no longer be established.

This is why permissions are worth more attention than they usually get. They are not a security feature bolted onto the side of the business. They are the ledger that every other ledger reads.

What you can actually measure

You cannot measure whether access is appropriate. You can measure four things, and the numbers are usually worse than the team expects:

  • How many accounts have an effective permission set that cannot be produced without executing the authorization code. If the answer is "all of them," then every access review is an opinion. The cheap version of a fix is a query that expands group membership and role inheritance and prints a flat list per person — even if it is slow and ugly, it is a thing you can diff.
  • How many permission changes in the last ninety days have no recorded grantor. Not no ticket: no person. If the field is empty or filled with a service name, the change happened without anyone being accountable for it.
  • How many people can grant permissions, and how many of them are inside the review cadence. The set of grantors is usually much larger than the set of reviewers, which means the review covers a subset of the thing it claims to review.
  • How many decisions from last year cannot be validated against the approver's role on that date. Pick twenty approvals at random. For each one, answer from records only: what role did this person hold on that day, and did that role permit this action? Count the ones you cannot answer.

The number worth counting is the last one expressed as a fraction. Teams routinely expect it to be near zero. When they actually check, the common result is that most historical approvals are unvalidatable — not wrong, just unverifiable — because the role was never stored with dates.

The cheap fix is a ledger, not a process

The instinct is to add an access review meeting. That produces a quarterly spreadsheet that is stale the week after it is signed, and it reviews the present, which is the only part that was never in doubt.

The cheaper fix is to make the role table append-only:

One row per grant, with a start and an end. Subject, role, scope, granted_by, start, end, and the reason. Revocation is not a delete; it is an end date. The current state is then a query — rows where now is inside the interval — and the historical state is the same query with a different timestamp. Nothing about this is architecturally clever. It is one table with two date columns instead of one row that gets overwritten.

One account per human. No shared logins, no team accounts used by people. If the workflow needs a shared account to function, the workflow is compensating for a role that is wrong, and the fix belongs upstream.

One reconciliation with dates on both sides. Joiners and leavers, with the date the change was made in the identity system and the date the change was made in the authorization system. The gap between those two dates, per person, is the exposure window. That number is measurable, and it is the one thing in this article you can start counting today.

And one observation that would tell you a role drifted before an incident. Grants without a grantor. Grants whose reason is a copy of the ticket title. People whose permission count only ever grows. A quarterly diff between "what the org chart says" and "what the authorization system says" that is never empty. That observation has to exist before the week you need it — you cannot reconstruct an interval from a table that only stored a present.

The week it fails

When an approval turns out to have been made by someone who should not have been able to make it, the questions that get asked are the wrong ones. "How did they have access" produces a shrug and a reference to a group. "Why didn't anyone notice" produces a story about how busy the quarter was.

The questions that produce understanding are:

Who approved this, and what role did they hold on that date? Was that role in scope for this action, according to a rule that existed at the time and not one written afterwards? Who granted the role, and what did they believe they were granting? And the fourth one, which usually has no answer: what would have shown you, three months earlier, that this person's authority had drifted from their record? Not that the review was late — that the record was wrong.

If the answer is "nothing would have shown us," then the permission system was never a control. It was a real-time convenience that everyone mistook for a historical record, and the mistake was invisible because the present always looks correct.

Friday exercise, twenty minutes

Take five approvals from last year — deploys, contract sign-offs, access grants, anything with a name and a date. For each one, answer from records alone, without asking anyone:

What role did this person hold on that date? Did that role permit this specific action? Who granted the role and when?

Write N/5 next to your answers. The interesting part is not the number. It is which of the three questions you could not answer at all, because that tells you which column is missing from the table — and the missing column is always the same one: the end date that never got written.

If you have approvals where you can no longer reconstruct what role the approver held on the day they approved, say so in the comments — no names, just the shape: how roles are stored (a current-state table, IdP groups, a spreadsheet someone maintains).

And if the useful part for you is the worksheet rather than the essay: the one-page register I use for this is here — A One-Page Queue Ownership Register. Copy it, fill it, keep it. Nothing to request and no address to give.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.