Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Access reviews and least privilege

After this lesson: I can run an access review and say what to do about each finding.

60 min lesson2 commandsIdentity and access lab: OpenID Connect, OAuth 2.0 and JWTs

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

He left in September

Harry worked in the college finance office until September. In November his account can still raise payments. Nobody meant it: the people team updated their list, and the finance app never heard.

Signing in proves who someone is. What they may then do is authorisation, and it drifts as people join, move and leave. An access review is how an organisation finds the drift and fixes it.

By the end of this lesson

Note

I can run an access review and say what to do about each finding.

Key words

WordWhat it meansExample
Rolea named set of rights given to people who need themteacher
Least privilegegiving each account only the rights its work needs
Leaversomeone who no longer works for the organisation
Dormant accountan account or grant nobody has used for a long time
Separation of dutiessplitting a risky task so no one person does all of it
Access reviewa regular check of who can reach what

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Roles turn people into rights

Most apps grant rights through a role: teacher, editor, admin. A person gets the role their job needs, and the app checks the role, not the name. This is role-based access control.

Least privilege says each account holds only what its work needs, for only as long as it needs it. Every extra grant is something an attacker can use if that account is taken. The lab's review data is Northfield College's people list and every app's grants.

See what the review covers

Command
docker exec tools python3 steps/review.py summary

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Joiners, movers and leavers

Access drifts at three moments. A joiner gets roles. A mover changes team and keeps the old team's roles as well as the new. A leaver goes and some app still holds their account. Unused grants pile up and become dormant.

An access review compares two lists: who works here and in which team, and who holds which role in each app. review.py also checks separation of duties: nobody should both raise and approve a payment.

Run the access review

Command
docker exec tools python3 steps/review.py

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Worked example: five kinds of finding

KindExample the review printedWhat it means
leaverharry finance/raise-paymentHe has left, the grant stayed
wrong teamisla finance/raise-paymentA computing teacher holds a finance role
dormantkemi marks/teacher, 162 daysA grant nobody uses
no ownerbackup-bot idp/adminAn admin account no person owns
conflictgita raise-payment+approve-paymentOne person can pay herself

The cells students fill in are left blank in this preview.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Try it: when is a grant dormant?

Code: python
from datetime import date

today = date(2026, 11, 20)
last_used = {"isla finance": date(2026, 3, 2), "kemi marks": date(2026, 6, 11),
             "ben marks": date(2026, 11, 20)}
limit = 90
for grant, day in last_used.items():
    idle = (today - day).days
    print(grant, idle, "days", "DORMANT" if idle > limit else "in use")
# A college reviews every 30 days instead. Set limit = 30: does the answer change?

Make a free account to save your work and track your progress.

A common mistake

Warning

Many people think removing a leaver from the identity provider removes all their access. Apps that keep their own accounts, API keys and shared admin logins survive it. Review each app's grants as well as the provider's accounts.

Every finding gets an owner and a decision

A review is only worth its follow-up. Remove a leaver's grants the same day, and disable before you delete so a mistake can be undone. Ask a mover's new manager which old roles to keep. Remove a dormant grant and let the person ask again.

Give a shared account a named owner or replace it with a service identity. Split a conflict between two people. Record each decision: the record is the evidence an auditor asks for.

Worked example: deciding each finding

FindingDecisionWho decides
jonas idp/admin, leaverDisable today, delete after 30 daysIT, at once
kemi marks/teacher, wrong team and dormantRemoveHer manager
gita raise and approveRemove approve-paymentThe head of finance
backup-bot idp/adminName an owner, narrow the roleIT

The cells students fill in are left blank in this preview.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Make the review smaller next time

Single sign-on helps: disabling one account at the provider closes every app that trusts it. Automatic provisioning, for example over SCIM, creates and removes app accounts from the people list. Roles tied to teams move with the person.

Reviews then become regular and short. Many organisations ask managers to confirm their teams' access every quarter, and review admin roles more often.

Assignment: write the access review

Write review(people, grants, today, owners). people maps an email to {"team": ..., "status": "active" or "left"}. grants is a list of dictionaries with email, app, role and last_used (a date). owners maps a role to the set of teams it belongs to. Return a list of findings, each a tuple (kind, email, what).

Go through the grants in order, with what as app + "/" + role. Add "no owner" if the email is not in people; else "leaver" if the status is left; else "wrong team" if the team is not in owners[role]. Then, for an active person only, add "dormant" if the grant is unused for more than 90 days.

Last, for each email in sorted order holding both raise-payment and approve-payment, add ("conflict", email, "raise-payment+approve-payment").

Code: python
def review(people, grants, today, owners):
    return []

Make a free account to save your work and track your progress.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.