What If? Simulating Permission Changes with Maths (and Bit Planes)

Muaz Notiar, Chris Wray, Carmen Appel, Bruce Hay Contributors: Himesh Patel, Nisha Varsani · 14 min read

The question behind every access change
Why one-level access review misses what a change actually does

Granting access to a system is easy: one row puts user A in access group Y. Knowing what that row does is harder.

We recently worked on this problem in an asset management context. The question sounds simple. If a user is given permission X, or added to access group Y, what actually changes? Does it contradict anything they already hold? And if one access group is swapped for another, what do they lose?

The existing tools showed the first level, the list of grants on group Y, and everything beyond that was judgement. So, like most teams facing a hard question every day, the reviewers had adopted a working assumption:

Assume current access is safe, and treat every change as an incremental addition.

The assumption is quick, but it is not analysis. It misses contradictions that only appear in combination, it overstates what a removal takes away, and it gets swaps and batches wrong. It is also an understandable one: a question the tools cannot answer looks like a hard question, and this one is not. This article describes the model that replaced the assumption. It also introduces Lamp Traceline, our what-if simulation for access control changes, built on that model to run on a proposed change before anyone approves it. Matrix algebra gives gains, losses and retained access precise definitions. A compact bit-level representation makes those calculations fast enough for interactive what-if analysis across the organisation. That also opens the way to automated workflows that check proposed changes before acting on them.

Where the problem sits
Too large for a spreadsheet, too small for hyperscaler machinery

Access control is a different problem at different sizes, and the tool that suits one size is wrong for the next. At one end are the hyperscalers, for whom fast, machine-checkable authorisation is critical infrastructure: Google's authorisation system holds more than two trillion relationships and answers millions of checks a second. At the other end is the small business with a few systems, where whoever administers them knows who has access to what. That is adequate: the whole picture fits in one person's head, or on one screen, and can be checked by reading.

Between them is a vast middle. Counted by firms, most businesses are small: in the UK, 99% have fewer than fifty employees, and for them a spreadsheet, where there is one at all, is the right tool.

Counted by people, the picture reverses: firms with 250 or more employees employ 40% of the private-sector workforce, and firms with fifty or more employ over half. That is also where access control becomes a managed process rather than a list, and where the shape is a few hundred to a few thousand people, a couple of hundred access groups and a thousand or so distinct entitlements: far beyond what anyone can hold in their head, and far short of what justifies hyperscaler machinery.

Yet spreadsheet-based access reviews remain common even in large organisations. In one 2025 survey of US organisations with at least 500 employees, nine in ten of them above 2,000 and financial services the largest sector among them, 34% ran their periodic access reviews manually in spreadsheets, and only 17% through an identity-governance platform.

Established identity-governance products already offer simulation and conflict checks; our focus here is analysing investment-platform permissions directly from existing exports, without requiring a wider governance implementation.

Most teams start in a spreadsheet: that is where data exports typically land, and a hard question tends to be met with the tool everyone already has. A spreadsheet answers the question it was built for: "here is what Himesh has; is it right?" Simulation, however, is not a lookup. "What if Nisha joins Y and leaves Z?" describes a different state of the world, and every what-if becomes another copy of the workbook with its own idea of what "gained" or "lost" means. A spreadsheet records access as it stands; simulation needs access derived from memberships and grants, so that changing either recomputes the rest.

Moving the exports into a database keeps the two relations, and a join can count supporting groups. Storage alone does not define the simulation: we still need a precise representation of the proposed state and a consistent way to compare it with the current one, so that "what changes?" has exactly one definition. A model provides both.

The middle also has a useful shape. The set of things to track is small and stable enough that each group's grants fit in about a hundred bytes, which is what makes the implementation described below practical.

The access model
Three layers, two hops, one equation

The model starts from what the system already records. In the system we were working with, access has exactly three layers:

  1. 01UserNisha
  2. 02Access groupTRADERmember ofM
  3. 03EntitlementTRADEPORTFOLIOP1grantsB

An entitlement is exact: a permission type, the kind of thing it is scoped to, and a value. (TRADE, PORTFOLIO, P1) and (TRADE, PORTFOLIO, P2) are different entitlements; a wildcard (TRADE, PORTFOLIO, *) covers both but is still its own entitlement. The model counts exact entitlements, and reports separately what a wildcard still covers after a change. Groups do not nest and nothing inherits, so every route from a user to an entitlement is exactly two hops.

As an example, consider a fairly typical organisation:

Users
1,346
Access groups
190
Exact entitlements
952

3,936 memberships · user → group

4,894 grants · group → entitlement

Each hairline = 10 links

Resolves to

243,605

effective user → entitlement pairs

≈181

entitlements per user, on average

Redundant

41,470

17% of pairs, held through more than one group

the same right granted twice or more

16most groups supplying one entitlement to one user, traced in purple through the flow

Those 8,830 source rows fan out into 243,605 access facts, about 28 times as many, and roughly one in six of those facts is held redundantly: more than one group supplies it. That redundancy is what makes one-level review unreliable.

Let MM represent user-to-group memberships and BB group-to-entitlement grants. Effective access is their Boolean matrix product:

A=MB  (over Booleans)Au,e=⋁g(Mu,g∧Bg,e)\begin{gathered} A = MB \;\text{(over Booleans)} \\[0.5em] A_{u,e} = \bigvee_{g} \left( M_{u,g} \land B_{g,e} \right) \end{gathered}

This is ordinary matrix multiplication with OR in place of ++ and AND in place of ×\times: user uu has entitlement ee if some group gg has uu as a member and grants ee.

A worked example

The rest of this article uses a small example with two users, three groups and four entitlements:

Id Permission Scope Value
e1 TRADE PORTFOLIO P1
e2 VIEW_BOOK BOOK US
e3 VIEW_BOOK BOOK UK
e4 CONFIRM PORTFOLIO P1
MTRADERREADER_COPYAPPROVER
Nisha110
Himesh001
Memberships: a row per user, a column per group
Be1e2e3e4
TRADER1100
READER_COPY0110
APPROVER0001
Grants: a row per group, a column per entitlement

Nisha has e1, e2 and e3; Himesh has e4.

From existence to count
Counting supporting groups gives removal a precise meaning

The Boolean product answers the first of the reviewer's questions, whether a user has an entitlement. The questions about removals and swaps need something it does not record: through how many groups. OR establishes existence: at least one of the user's groups grants the entitlement. Replacing it with ordinary ++ gives the count of groups that grant it:

C=MB  (over integers)Cu,e=the number of u’s groups granting e\begin{gathered} C = MB \;\text{(over integers)} \\[0.5em] C_{u,e} = \text{the number of } u\text{'s groups granting } e \end{gathered}

Nisha's row of CC is (1,2,1,0)(1, 2, 1, 0): e2 is supplied by both TRADER and READER_COPY. Removal now has a precise definition:

Lost(u,−g)={ e∣Bg,e=1 ∧ Cu,e=1 }\text{Lost}(u, -g) = \{\, e \mid B_{g,e} = 1 \,\land\, C_{u,e} = 1 \,\}

Removing a group loses exactly the entitlements it grants whose count was one; everything else is retained through another group. If READER_COPY is removed from Nisha, e2 (count 2) is retained through TRADER and e3 (count 1) is lost.

This count is exactly what a typical access export lacks. An export lists effective access, who has what, which is AA, and CC cannot be recovered from AA. A reviewer working from the export cannot tell a count of one from a count of two, and so cannot say what a removal takes away. Treating every change as an addition is the only safe reading of what the export does show.

The count also gives operators a vocabulary: 0 is absent, 1 is fragile, 2 is redundant, and 3 or more is strongly redundant. In this model it is also exactly the number of memberships that would have to be removed to take the entitlement away, with no search required.

Batch changes and the cross-term
Effects that exist only when edits are made together

Changes rarely arrive one at a time. A single request can add a user to a group and alter what the group grants, and the two edits are usually reviewed as if they were independent. In the model they are one change: a proposal alters memberships by ΔM\Delta M and grants by ΔB\Delta B, and expanding the product shows what the two edits do together:

C′=(M+ΔM)(B+ΔB)=C+ΔM B+M ΔB+ΔM ΔB\begin{aligned} C' &= (M + \Delta M)(B + \Delta B) \\ &= C + \Delta M\,B + M\,\Delta B + \Delta M\,\Delta B \end{aligned}

Each term has a meaning, written here for additions; a removal is the same term with negative entries:

  • ΔM B\Delta M\,B: new members receiving a group's existing grants;
  • M ΔBM\,\Delta B: existing members receiving new grants;
  • ΔM ΔB\Delta M\,\Delta B: new members receiving new grants, a change that exists only because both edits occur together.
Consider this scenario

A single proposal adds Nisha to APPROVER and, in the same change, grants APPROVER a fifth entitlement, e5. Reviewed separately, the membership change gives Nisha e4 and the grant change gives Himesh e5. Neither report shows Nisha receiving e5, yet Nisha does: that effect exists only in the cross-term.

The same membership change gives Nisha CONFIRM (e4), while TRADE is already held through TRADER. It passes a review of APPROVER's grant list and still breaks a trade/confirm rule.

Neither edit produces this effect on its own, so a review that takes the changes one at a time will not find it. The operating rule follows: build the whole proposed state, evaluate it once and compare it once. Per-action reports are never summed, and a swap is a removal and an addition in a single state.

Computing it with bit planes
Support counts stored one binary digit at a time

The model so far is a set of definitions, and whether a simulation can afford to run them on every change depends on how the counts are computed. The straightforward implementation of CC keeps a counter per entitlement, and nothing above needs more than that.

PseudocodeSupport counts, one counter per entitlement
// For one user: how many of their groups grant each entitlement?
support = empty map from entitlement to count
for each group g in groups(user):
    for each entitlement e in grants(g):
        support[e] = support[e] + 1

// What would removing group z take away?
lost = every e in grants(z) where support[e] == 1

It is correct and readable, but it handles entitlements one at a time, and it does the most work when groups overlap heavily, which is exactly when the answer matters. The rest of this section is about making it performant enough to run every time.

Bitsets for existence

Bitsets handle the Boolean half directly. Give each entitlement a fixed position and a group's grants become a row of bits: about a hundred bytes per group, and every group in the organisation together small enough to sit in a processor's cache. In our data set a user belongs to about three groups on average, so effective access is three rows OR'd together, 64 entitlements per instruction.

Bit planes for counts

Counts need more than one bit, but not one counter per entitlement. Instead we keep one bitset per binary digit: plane 0 holds the ones digit of every entitlement's count, plane 1 the twos digit, and so on. This is the table of counts stored by column rather than by row. Image processing calls these bit planes, and database research has studied arithmetic on them, as bit-sliced indexes, for at least 25 years. The busiest entitlement in our data set has 16 supporting groups, so five planes are sufficient.

Bitwise arithmetic updates the support counts for many entitlements in parallel, rather than handling each entitlement separately. For Nisha, two planes encode the resulting counts: (1, 2, 1, 0).

e1e2e3e4
Plane 1 (twos)0100
Plane 0 (ones)1010
Support count1210
Nisha's support counts, stored in two bit planes

Reading down the columns, e2 is binary 10, which is 2: the two groups supporting that entitlement. The representation changes; the counts do not.

The geometric view

The planes also have a geometric reading. Treat each of a user's groups as the set of entitlements it grants and draw those sets as a Venn diagram. Each region is a set of entitlements with the same supporting groups, its support count is the number of group sets that contain it, and the planes are that count in binary. Plane 0 is the symmetric difference of the groups (their XOR), held is their union, and single is the entitlements contained in exactly one group. The diagram below draws this for three groups.

From counts to removal impact

Removing a membership takes away only those entitlements for which the group was the user's last source. The bit-plane representation makes that distinction inexpensive to evaluate across the user's access.

For Nisha, removing READER_COPY leaves e2 available through TRADER, but loses e3. The same calculation can be applied to every membership to reveal what each group uniquely contributes.

Marginal contribution
What each group supplies that no other group does

The removal question has a second use. Asked of every existing membership rather than of a proposed change, it measures what each group is for. Lost(u,−g)\text{Lost}(u, -g) is the group's marginal contribution to that user: what the user would lose if this group alone were removed and every other membership stayed. In the Venn diagram, it is the region of the group's set that no other group's set intersects. The calculation is inexpensive enough to apply to every membership in the organisation.

Group profiles

Aggregated over a group's members, it gives a profile of the group:

avg marginal(g)=∑u∈Members(g) ⁣∣Lost(u,−g)∣∣Members(g)∣\text{avg marginal}(g) = \frac{\displaystyle\sum_{u \in \text{Members}(g)}\! |\text{Lost}(u, -g)|}{|\text{Members}(g)|}

This is where nominal and effective access diverge. A group can grant 100 entitlements on paper yet contribute, on average, only 4 that its members could not obtain elsewhere: a marginal efficiency of 4%. If most members would lose nothing, its zero-marginal rate is also high, and the group becomes a candidate for consolidation. A spreadsheet view ("Group Y grants 100 entitlements") cannot distinguish that group from one whose grants are all load-bearing.

Marginals do not add up

One caution applies when reading marginals. Suppose a user belongs to two groups that both grant only e2. Each group has a marginal of zero, because removing either leaves e2 in place through the other, but removing both loses it. A zero marginal means "this group alone could be removed", never "all zero-marginal groups could be removed together". That question is a new proposed state, evaluated like any other.

Separation of duties
Forbidden combinations, checked across the whole population

Gains and losses are one half of what a reviewer checks; the other half is rules. The commonest kind concerns pairs of permissions that should not be held by the same person: whoever trades should not confirm the trade, and so on.

Two readings of one rule

Precise wording matters. Write H(u,p)H(u,p) for "uu holds pp at any scope", the access matrix with entitlements folded into permission types. The instruction "this user must not have TRADE or CONFIRM" then has two readings:

¬H(u,TRADE) ∧ ¬H(u,CONFIRM)(1)\neg H(u,\texttt{TRADE}) \,\land\, \neg H(u,\texttt{CONFIRM}) \tag{1} ¬(H(u,TRADE) ∧ H(u,CONFIRM))(2)\neg\big(H(u,\texttt{TRADE}) \,\land\, H(u,\texttt{CONFIRM})\big) \tag{2}

Reading (1) forbids each permission; reading (2) forbids only the combination. A review process that treats "forbidden permissions" and "forbidden combination" as interchangeable will eventually approve something it should not.

Testing the whole population

A rule is also worth checking against everyone, not only the user whose change is in front of the reviewer. Testing reading (2) across the whole population is another AND. OR together the member bitsets of every group granting a permission to obtain a bitset of its holders, then intersect the two. Each violation also needs an explanation, which is a further AND of the user's groups with the groups granting each half. That tests the whole organisation against the rule at 64 people per instruction. The two explanations usually name different groups, which is why one-level review misses these pairs: whoever approved one half was not looking at the half the user already held. Two practices follow. Rules are evaluated against the proposed state, not the current one. And when a rule depends on data the exports do not carry, such as a missing sensitivity label, the result is "unknown, needs review", never a pass.

Performance
The advantage grows with overlap

The bit planes exist to make the simulation cheap enough to run on every change, so what matters is how the cost behaves as groups overlap more. We verified that both implementations produced identical results for every user, group and permission, then timed the scalar approach against our production bit-plane implementation:

Bit planes against one counter per entitlement

Speedup per case; sizes are users / groups / entitlements

  • Sparse

    192 / 97 / 3,073

    1.7×

    0.672 ms → 0.390 ms

  • Disjoint

    192 / 65 / 2,049

    2.9×

    0.974 ms → 0.340 ms

  • Support 65

    64 / 66 / 513

    16.3×

    4.568 ms → 0.281 ms

  • Support 129

    64 / 130 / 513

    16.8×

    8.445 ms → 0.502 ms

  • Dense overlap

    192 / 65 / 2,049

    21.4×

    18.051 ms → 0.844 ms

The two "support" cases place an unusually large number of groups on the same entitlements. With little overlap, both approaches are fast. As overlap increases, both get slower, but at very different rates: between the disjoint and dense cases the per-entitlement counter's time grows about eighteenfold and the bit planes' about two and a half times, so the relative advantage is greatest in the dense case. Dense overlap is precisely the redundant access that makes one-level review unreliable, so the advantage is largest where the analysis matters most.

Simulation in practice
One routine-looking change, and the rule it broke

All of the above sits behind one operation in Traceline. An operator stages a change, such as adding or removing a membership, swapping groups or editing a group's grants, and Traceline builds the whole proposed state. The result is reported in a reviewer's terms rather than the model's: for each entitlement, whether the user gains it, loses it, or keeps it with a change in which groups supply it; and for each rule, whether its condition is met. Every line names the exact entitlement and the groups responsible.

Take a single, routine-looking change: adding one user to a reporting group. Traceline reported:

Entitlements gained
12
Entitlements lost
0
Already held, now also granted by the reporting group
8
Gained permission that a rule prohibits
1

That one was a review permission labelled Ultra sensitivity, prohibited for this user. Reviewed one level deep, the group's grant list looks routine, and nothing in it says who may not hold an Ultra-labelled permission; the prohibition belongs to the user. The change would have been approved.

Because the model is explicit, it can also be searched. Traceline does both: the what-if analysis above, and negative testing alongside it, in which a constraint solver looks for the changes that would break a rule instead of checking a proposed one.

Conclusion

The working assumption that current access is safe and every change is an addition is a rational response to tools that show only one level, spreadsheets among them. Two default choices sustain it: a flattened effective-access export as the data, and a counter per entitlement as the computation. The first holds access as it stands, who has what, with the counts every removal depends on already gone. Replacing that flat view with an explicit model of memberships and grants gives "lost", "retained" and "swap" a single precise meaning each. Replacing the second with an algorithm that fits the shape of the data, bit planes in our case, makes those calculations fast enough for interactive use, and makes a further question practical: what does each group actually contribute?

At Lamp, we built Traceline for the firms in the middle described earlier, with too much access to hold in a spreadsheet and too little to justify hyperscaler machinery. It works from the exports a firm already produces, reports each proposed change as gains, losses and retained routes, each traced to the groups responsible, and tests the firm's rules against the whole population rather than one user at a time, all before the change is approved. Firms with the same question can talk to us.

A simplification adopted by an experienced team usually marks the point where the tools stop answering the question, not necessarily the point where the problem becomes hard. That point is often where a precise model adds the most value.

More articles

All articles

Talk to a partner

Every engagement is led and delivered by a co‑founder, starting with the first conversation.