Where should the money go?
Lantern Print's directors have a small budget for security this year. Everyone has a favourite: new laptops, training, a monitoring service.
A framework helps them compare like with like. It shows where they are now, where they want to be, and the gap.
By the end of this lesson
Note
I can find the largest gaps between a current and a target profile.
Key words
| Word | What it means | Example |
|---|---|---|
| Framework | a shared structure for describing security work | |
| Function | one of the six top-level groups of outcomes | Detect |
| Category | a group of related outcomes inside a function | DE.CM |
| Profile | a firm's scores against the categories, now or wanted | |
| Gap | the distance from the current score to the target |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsSix functions describe security outcomes
The NIST Cybersecurity Framework is free guidance from the US standards body. Version 2.0 came out in 2024, for firms of any size.
It groups outcomes into six functions: Govern, Identify, Protect, Detect, Respond and Recover. Govern is new in 2.0 and sits in the middle of the others. Each function splits into categories with short codes.
Try it: a gap for each function
now = {"Protect": 2.0, "Detect": 0.0, "Recover": 1.0}
target = {"Protect": 3.2, "Detect": 3.0, "Recover": 3.0}
for name in now:
print(name, "gap", round(target[name] - now[name], 1))
# Lantern Print buys monitoring and Detect reaches 2.0. Change it and run again.
Make a free account to save your work and track your progress.
Check
Have a go
Check
3 questionsA profile now and a profile wanted
A profile scores each category. The current profile says what a firm does today. The target profile says what it wants, given its risks.
The framework also has four tiers, from Partial to Adaptive, for how mature the risk management is. We score categories on our own 0 to 4 scale. The framework itself asks for no particular scale.
Lantern Print's profile
csfdata.py scores fourteen categories now and wanted. It also maps lesson 1's controls to the categories they serve.
profile.py prints the gap for each function, the three largest gaps, and the categories no control serves.
Write the profile, part 1
docker exec jupyter sh -c "mkdir -p steps && printf '%s\n' 'functions = {\"GV\": \"Govern\", \"ID\": \"Identify\", \"PR\": \"Protect\", \"DE\": \"Detect\", \"RS\": \"Respond\", \"RC\": \"Recover\"}' '' 'profile = [' ' (\"GV.OC\", \"Who we serve and what we must obey\", 2, 3),' ' (\"GV.RM\", \"How much risk we accept\", 1, 3),' ' (\"GV.RR\", \"Who is responsible\", 1, 3),' ' (\"GV.PO\", \"Policy\", 2, 3),' ' (\"GV.SC\", \"Supplier risk\", 1, 3),' ' (\"ID.AM\", \"Knowing our assets\", 2, 3),' ' (\"ID.RA\", \"Assessing risk\", 1, 3),' ' (\"PR.AA\", \"Sign-in and access\", 2, 4),' ' (\"PR.AT\", \"Awareness and training\", 2, 3),' ' (\"PR.DS\", \"Protecting data\", 2, 3),' ' (\"PR.PS\", \"Keeping platforms secure\", 2, 3),' ' (\"DE.CM\", \"Watching for attacks\", 0, 3),' ' (\"RS.MA\", \"Managing an incident\", 1, 3),' ' (\"RC.RP\", \"Carrying out recovery\", 1, 3),' ']' '' 'mapping = {' > steps/csfdata.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the profile, part 2
docker exec jupyter sh -c "printf '%s\n' ' \"L01\": \"GV.PO\", \"L02\": \"ID.AM\", \"L03\": \"GV.SC\", \"L04\": \"RS.MA\",' ' \"L05\": \"PR.AT\", \"L06\": \"GV.RR\", \"L07\": \"PR.AA\", \"L08\": \"PR.DS\",' ' \"L09\": \"PR.AA\", \"L10\": \"PR.DS\", \"L11\": \"PR.PS\", \"L12\": \"PR.PS\",' '}' >> steps/csfdata.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the gap report
docker exec jupyter sh -c "mkdir -p steps && printf '%s\n' 'from csfdata import functions, mapping, profile' '' 'print(\"Function now target gap\")' 'for code, name in functions.items():' ' rows = [r for r in profile if r[0].startswith(code + \".\")]' ' now = sum(r[2] for r in rows) / len(rows)' ' target = sum(r[3] for r in rows) / len(rows)' ' print(f\"{name:<9} {now:4.1f} {target:5.1f} {target - now:4.1f}\")' 'gaps = sorted(profile, key=lambda r: (r[2] - r[3], r[0]))' 'print(\"largest gaps:\")' 'for cat, name, now, target in gaps[:3]:' ' print(f\" {cat} {name}: {now} now, {target} wanted\")' 'covered = set(mapping.values())' 'empty = [r[0] for r in profile if r[0] not in covered]' 'print(\"categories no control serves:\", \" \".join(empty))' > steps/profile.py"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Print the gaps
docker exec jupyter python3 steps/profile.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsA common mistake
Warning
Many people think the target should be the top score everywhere. A target follows the firm's risks and budget. Lantern Print wants 4 only for sign-in and access, because a stolen mailbox is its likeliest harm.
Reading the report
Lantern Print protects quite well but would not notice an attack. No control serves DE.CM, so nothing watches for one. Respond and Recover are weak too.
That points the budget at monitoring before more laptops. The same profile, scored again next year, shows whether the money worked.
Assignment: rank the gaps
A profile is a list of (category, now, target).
function_of(category) turns a prefix such as "PR" into its function name, raising ValueError for an unknown one. gaps(profile) returns (category, gap) for each gap above zero, largest first, then by category. worst_function(profile) returns the function with the largest total gap.
NAMES = {"GV": "Govern", "ID": "Identify", "PR": "Protect", "DE": "Detect", "RS": "Respond", "RC": "Recover"}
def function_of(category):
# "PR.AA" gives "Protect". Raise ValueError for a prefix not in NAMES.
return ""
def gaps(profile):
# profile is a list of (category, now, target). Return (category, target - now) for each gap
# above zero, largest first, then by category.
return []
def worst_function(profile):
# The function with the largest total gap. A target already met adds nothing. A tie goes to
# the name first in alphabetical order.
return ""
Make a free account to save your work and track your progress.
Exit quiz
Have a go