Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Lesson 08 · 35 minutes

Control changes and policy exceptions with records

After this lesson you can
  • Write a change record with approval, test and rollback
  • Apply separation of duties to normal, standard and emergency changes
  • Record a time-limited policy exception and catch one that is past its end date
Lab files of this lesson (48)

The lab folder as it stands after this lesson. Unzip it in ~/krlab.

More

The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.

Scenario

On a Friday evening in October, Dev put a new price import on the live shop of Brindle Books. It had worked on his laptop. On Saturday every book cost 0.00, and nobody could say what had changed or how to undo it. Risk R7 in the register names the treatment: change approval with a rollback plan. A second problem sits in the warehouse: the scanners cannot use a second factor, which the access control standard demands. You build the records for both: a change log, an exception register, and one checker.

Recall

Lesson 7: why may a manager not decide about their own access?

A person who judges their own rights has a reason to keep them. The decision needs somebody with authority and no personal interest. This is separation of duties.

Lesson 4: what is the treatment of risk R7, "an untested change breaks the shop"?

reduce, with the action "change approval with a rollback plan". The statement of applicability links it to control C08, whose evidence is changes.csv: the file of this lesson.

The idea

A change is anything that alters a live system: a release, an update, a new firewall rule, a new job. Change management makes sure that each change is wanted, tested and reversible, and that a record says who did what. A change record holds five things.

PartQuestion
RequestWhat changes, why, and who asks?
ApprovalWho agreed, and when?
TestWas it tried somewhere that is not live?
RollbackHow do we get back if it fails?
ImplementationWho did it, and when?

Separation of duties means that one person cannot take a sensitive action alone from start to end. For a change, the person who approves it is neither the person who asked for it nor the person who implements it. In a team of 14 the same developer often requests and implements. The approval by a second person is the part that cannot be dropped.

Not every change needs the same weight. This course uses three types.

TypeWhenRule
normalMost changesApproved by a second person before it goes live. Tested, with a rollback plan.
standardRoutine and low-risk, done the same way each timeApproved once as a type: the record says pre-approved.
emergencyWaiting would cause harmMay go live first. Approved by a second person within 2 days, and reviewed afterwards.

An emergency change is not a way round the process. It moves the approval to the days after, and adds a review: was it a real emergency, and what should change so that it does not repeat?

Some rules cannot be kept by some systems. A policy exception is a recorded permission to break one rule, for one case, for a limited time. It has an owner who answers for it, an approver who is another person, a start and an end date, and a compensating control: another measure that lowers the risk while the rule is not met. In this course an exception runs for at most 183 days, then somebody decides again. An exception with no end date is a second, hidden policy.

A normal change
RequestApprovalTestImplementRecordwhat, why, who asksby a second personnot on the live systemwith a way backRequestApprovalTestImplementRecord1234
  1. Request → Approval: what, why, who asks
  2. Approval → Test: by a second person
  3. Test → Implement: not on the live system
  4. Implement → Record: with a way back

Worked example

Work in ~/krlab/security-governance.

1. Write the change log

Five changes of the last two months. CH2 is the monthly security update, a standard change. CH4 happened at night: an administrator password had leaked, and Dev blocked the account at once. Carys approved it the next day, and the review was three days later. CH5 is the price import done again, properly, after the October failure: approved first, tested, and live on a working day.

Change CH4, an emergency
2026-11-02Dev blocks the leaked admin account: live first2026-11-03Carys approves, one day later and inside the limit2026-11-06review: was it a real emergency?2026-11-02Dev blocks the leaked admin account: livefirst2026-11-03Carys approves, one day later and inside thelimit2026-11-06review: was it a real emergency?

changes.csv

id,title,type,requested_by,approved_by,implemented_by,approved_on,implemented_on,tested,rollback,reviewed_on
CH1,Add gift cards to the shop,normal,Greta,Carys,Dev,2026-10-05,2026-10-08,yes,Restore the previous release,
CH2,Monthly security updates on web-1,standard,Ben,pre-approved,Ben,,2026-11-12,yes,Snapshot before patching,
CH3,Second factor on admin accounts,normal,Ben,Asha,Ben,2026-10-20,2026-10-27,yes,Switch the factor off for one account,
CH4,Block a leaked admin password,emergency,Dev,Carys,Dev,2026-11-03,2026-11-02,yes,Enable the account again,2026-11-06
CH5,New price import job,normal,Efe,Carys,Dev,2026-11-10,2026-11-11,yes,Disable the job,

The drawing takes the record of CH4 apart.

The change record CH4
CH4idBlock a leaked admin passwordtitleemergencytypeDev,Carys,Devasked, approved and did it2026-11-03,2026-11-02approved on, live onyestested2026-11-06reviewed onCH4idBlock a leaked admin passwordtitleemergencytypeDev,Carys,Devasked, approved and did it2026-11-03,2026-11-02approved on, live onyestested2026-11-06reviewed on

2. Write the exception register

policy is the id of the document in the register of lesson 1 that the exception breaks. E2 is closed: the shared login on the packing station was replaced.

exceptions.csv

id,policy,what,owner,approved_by,start,end,compensating_control,status
E1,S1,Scanner software cannot use a second factor,Hal,Carys,2026-09-01,2027-02-28,Scanners are on a separate network,open
E2,S1,Shared login on the packing station,Hal,Carys,2026-06-01,2026-10-31,Camera over the station,closed

3. Write the checker

Subtracting two dates gives a span, and .days is its length in days. gap is the number of days from going live to approval: zero or negative for a change that was approved first. x in (a, b) is true when x equals a or b.

change_check.py

"""change_check.py: check a change log and an exception register.

    python3 change_check.py changes.csv exceptions.csv
"""
import sys

from grc import TODAY, day, finish, load

MAX_EXCEPTION = 183      # days that an exception may run before somebody decides again


def change_problems(path):
    found = []
    for c in load(path):
        name, kind = c["id"], c["type"]
        if kind == "standard":
            if c["approved_by"] != "pre-approved":
                found.append(f"{name}: a standard change must say pre-approved")
            continue
        if kind not in ("normal", "emergency"):
            found.append(f"{name}: unknown type: {kind or 'none'}")
            continue
        if not c["approved_by"] or not c["approved_on"]:
            found.append(f"{name}: not approved")
            continue
        if c["approved_by"] in (c["requested_by"], c["implemented_by"]):
            found.append(f"{name}: {c['approved_by']} approved their own change")
        gap = (day(c["approved_on"]) - day(c["implemented_on"])).days
        if kind == "normal" and gap > 0:
            found.append(f"{name}: went live {gap} {'day' if gap == 1 else 'days'} before the approval")
        if kind == "emergency" and gap > 2:
            found.append(f"{name}: emergency change approved {gap} days after it went live")
        if kind == "emergency" and not c["reviewed_on"]:
            found.append(f"{name}: emergency change with no review afterwards")
        if c["tested"] != "yes" or not c["rollback"]:
            found.append(f"{name}: no test or no rollback plan")
    return found


def exception_problems(path):
    found = []
    for e in load(path):
        name = e["id"]
        if not e["owner"] or not e["approved_by"]:
            found.append(f"{name}: no owner or no approver")
        elif e["owner"] == e["approved_by"]:
            found.append(f"{name}: {e['owner']} approved their own exception")
        if not e["compensating_control"]:
            found.append(f"{name}: no compensating control")
        if not e["end"]:
            found.append(f"{name}: no end date")
            continue
        if (day(e["end"]) - day(e["start"])).days > MAX_EXCEPTION:
            found.append(f"{name}: runs longer than {MAX_EXCEPTION} days")
        if e["status"] == "open" and day(e["end"]) < TODAY:
            found.append(f"{name}: still open, past its end date {e['end']}")
    return found


def problems(changes_path, exceptions_path):
    return change_problems(changes_path) + exception_problems(exceptions_path)


if __name__ == "__main__":
    finish(problems(sys.argv[1], sys.argv[2]))

4. Run it

python3 change_check.py changes.csv exceptions.csv
problems: 0

The emergency change CH4 passes: it went live one day before its approval, inside the limit of two days, and it was reviewed.

5. Replay the Friday evening

Write the price import as it really happened in October: Dev asked, approved and implemented it himself, with no test. Add an exception for a legacy laptop that nobody closed. printf prints text like echo, and \n in it is a line break.

cp changes.csv test-changes.csv
cp exceptions.csv test-exceptions.csv
printf 'CH6,Price import on a Friday,normal,Dev,Dev,Dev,2026-10-17,2026-10-16,no,,\n' >> test-changes.csv
printf 'E3,P1,Old laptop without disk encryption,Efe,Efe,2026-03-01,2026-06-30,,open\n' >> test-exceptions.csv
python3 change_check.py test-changes.csv test-exceptions.csv
PROBLEM CH6: Dev approved their own change
PROBLEM CH6: went live 1 day before the approval
PROBLEM CH6: no test or no rollback plan
PROBLEM E3: Efe approved their own exception
PROBLEM E3: no compensating control
PROBLEM E3: still open, past its end date 2026-06-30
problems: 6

Six problems from two lines. Each of them is a question that somebody would have asked before Saturday, if the record had existed. Remove the copies with rm test-changes.csv test-exceptions.csv.

Your turn

Omar keeps the change log and the exceptions of Marlow Physio. Save both files and check them. There are no steps.

marlow/changes.csv

id,title,type,requested_by,approved_by,implemented_by,approved_on,implemented_on,tested,rollback,reviewed_on
MC1,New booking form for home visits,normal,Priya,Nadia,Omar,2026-09-14,2026-09-18,yes,Switch back to the old form,
MC2,Weekly update of the reception computers,standard,Omar,Omar,Omar,,2026-11-08,yes,Restore point,
MC3,Open the booking system to the new site,normal,Nadia,Nadia,Omar,2026-10-01,2026-10-03,yes,Close the firewall rule,
MC4,Reset all passwords after a phishing mail,emergency,Omar,Nadia,Omar,2026-10-26,2026-10-20,yes,None needed,
MC5,New label printer driver,normal,Tess,Priya,Omar,2026-11-05,2026-11-02,no,,
MC6,Move the billing export to a new folder,normal,Rosa,,Omar,,2026-11-12,yes,Move it back,

marlow/exceptions.csv

id,policy,what,owner,approved_by,start,end,compensating_control,status
X1,S1,Students share one login for the booking system,Priya,Nadia,2026-09-01,2026-10-31,A supervisor signs each entry,open
X2,P1,The old billing computer runs an unsupported system,Omar,Nadia,2026-01-10,,It is not on the network,open
X3,S1,Tablets without a screen lock on home visits,Omar,Omar,2026-05-01,2027-04-30,,open

Then look at MC4. The checker reports two problems for it. Write the two questions that the missing review should have answered.

Check yourself

Dev is the only developer at Brindle Books. How can the company keep separation of duties for his changes?

Dev may request and implement. The approval must come from a second person who understands what the change does to the business: Carys, or the owner of the asset. The approver does not need to read the code. They need to know what changes, whether it was tested, and how to go back.

Why does an emergency change still need an approval and a review?

Without them, "emergency" becomes the normal route for anybody in a hurry. The late approval confirms that a second person agrees with what was done. The review asks whether it was a real emergency and what would prevent the next one. A team with many emergency changes has a planning problem.

What is a compensating control, and why does an exception need one?

It is another measure that lowers the risk while the rule is not met. The scanners cannot use a second factor, so they sit on a separate network. Without a compensating control, an exception only records that the risk is open, and the risk register (lesson 4) must then show an accepted risk with a name.

The monthly update CH2 has no approver's name and no approval date. Why does the checker accept it?

It is a standard change: routine, low-risk and done the same way each time. Somebody approved the type once, and each run needs only a record. The risk moves to the definition of the type, so the list of standard change types needs an owner and a review.

Field notes

  • The best change record is one that the tools write. A merge request with a required reviewer, linked to a deployment log, gives the request, the approval, the test and the time with no extra form.
  • Protect the rule in the tool where you can: a branch that nobody can push to alone is stronger than a policy that says "ask first". The record then shows the control at work.
  • Auditors test changes by sampling (lesson 11): they pick records from the deployment log, not from your change log, and ask for the approval of each. A change that is live with no record is the finding.
  • When an exception ends, three results are honest: the rule is now met, the exception is renewed by a new decision, or the risk is accepted in the register. Letting the date pass in silence is the fourth, and the checker reports it.
  • Count the exceptions per policy. A rule with many exceptions is a rule that does not fit the business, and the policy needs a change, not a longer list.