MSBA-302 · Lesson 12 of 12 · 21 min
Case study: hardening an organization
▶ Video coming soon A video version of this lesson is on the way.
The final session was Lena's. Priya asked her to present the hardening work as a single plan that someone joining Tidewater next year could read, follow and check, and to explain each decision as she would in an exam answer: what risk it addresses, which control it uses, and what it costs. Dmitri, Grace, Owen, Rosa and Malik came, and Yevgenia joined by video to play the part of a skeptical reviewer from a larger organization. This lesson follows Lena's presentation, then works through the questions the group asked.
Where Tidewater started
Lena opened with the inventory from the first session, because a plan without a starting point cannot show progress.
| Area | Before the sessions |
|---|---|
| Allowed actions | Allow all; 23 third-party actions, several unmaintained or unknown |
| References | All third-party actions by tag |
| Token defaults | Read and write in two of four repositories; create and approve pull requests on |
| Self-hosted runner | Print-room machine in the Default group, all repositories, administrator account, saved cloud login |
| Secrets | 19 credentials, map-tile key stored three times, a personal access token for cross-repository pushes |
| Cloud access | Client secret with an expiry date |
| Shared automation | node-ci.yml shared; no templates; .github repository unprotected |
| Evidence | No exports, no review, no budget beyond a single alert |
The plan in four stages
Lena organized the work into four stages, each small enough to review and undo before the next began. The order matters: you cannot restrict what you have not seen, and replacing credentials is easier after permissions are narrow.
| Stage | Controls | Risk addressed | Plan or feature |
|---|---|---|---|
| 1 See | Inventory of actions, runners, secrets, token defaults; actions-inventory.md | Unknown exposure | Any plan |
| 2 Restrict | Allow selected actions; read-only token default; pull request approval off; runner groups; fork approval for outside contributors | Untrusted code and excessive permissions | Runner groups need Team or above |
| 2 Restrict | Protected .github repository with CODEOWNERS; workflow templates as thin callers | Silent changes to shared automation | Any plan |
| 3 Replace | OIDC to Azure for the tile upload; GitHub App token instead of a personal token; one home per secret; Dependabot secrets | Long-lived, leakable credentials | Any plan |
| 3 Replace | SHA pinning required; Dependabot for actions; lockfile in TrailCheck | Moved tags and compromised actions | Any plan |
| 3 Replace | Unprivileged, segmented print-room runner, moving to ephemeral | Persistent runner compromise | Any plan |
| 4 Prove | Attestations for public releases; monthly audit exports; weekly drift check; budgets | Unverifiable builds and unnoticed changes | Attestations public-only on Team |
A hardened workflow, end to end
To show the plan in one place, Lena projected TrailCheck's deploy workflow after the sessions. Every line that changed during the series has a reason the group could name.
name: Deploy site
on:
push:
branches: [main]
permissions: {} # nothing unless a job asks
concurrency:
group: deploy-production
cancel-in-progress: false # never cancel a deploy half way
jobs:
build:
runs-on: ubuntu-latest # hosted: TrailCheck is public
timeout-minutes: 15
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: "24"
cache: npm
- run: npm ci && npm run build
- run: tar -czf site.tgz -C dist .
- uses: actions/attest@v4 # pinned by SHA in the real file
with:
subject-path: site.tgz
- uses: actions/upload-artifact@v7
with:
name: site
path: site.tgz
retention-days: 30
deploy:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: github-pages # branch rule + required reviewers
url: ${{ steps.pages.outputs.page_url }}
permissions:
pages: write
id-token: write # OIDC token for Pages, no stored key
contents: read
steps:
- uses: actions/download-artifact@v7
with:
name: site
- run: gh attestation verify site.tgz --repo tidewater/trailcheck
env:
GH_TOKEN: ${{ github.token }}
- run: mkdir site && tar -xzf site.tgz -C site
- uses: actions/upload-pages-artifact@v4
with:
path: site
- id: pages
uses: actions/deploy-pages@v4Yevgenia pressed on two details. Why does the deploy job verify an attestation that the same workflow created minutes earlier? Lena's answer: the artifact passes through storage between jobs, and verification proves that what is deployed is exactly what the build job produced in this repository. It also makes the pattern ready for a separate deploy pipeline later. And why permissions: {} at the top instead of contents: read? Because neither job should inherit anything by accident; each job states exactly what it needs.
Questions from the review
Dmitri asked whether all this made the team slower. Lena showed the numbers from the usage report and the run history: check runs were faster than before the clinic because of caching and canceled superseded runs, deploys took the same time plus about twenty seconds for verification, and Dependabot's weekly grouped pull request for actions took a few minutes to review. The visible cost was a click for outside contributors' first workflows and an occasional "Resource not accessible by integration" error when a new workflow forgot a permission, which the team had learned to read as a reminder rather than a failure.
Grace asked what still worried Lena. Three things, she said. The guidebook is private on the Team plan, so it cannot use required reviewers on environments or attestations; its protection relies on branch rules, a restricted manual trigger and checksums. The print-room machine is still persistent until Owen finishes the snapshot restore. And lockfiles are new, so the team will decide in a month whether to require them organization-wide. Naming remaining risks, she argued, is part of a good plan, not a weakness in it.
How the same plan scales
Yevgenia closed the review by mapping each of Tidewater's controls to its enterprise version at Skerry, which is how the GH-200 outline often frames questions: the same idea, applied at a different level.
| Tidewater (Team organization) | Skerry (Enterprise Cloud) |
|---|---|
| Allow selected actions at the organization | Enterprise policy with about a hundred allowed patterns, enforced on all organizations |
| SHA pinning required in the organization | Pinning required everywhere; lockfiles required in the store systems organization |
| One runner group for one office machine | Enterprise runner groups shared with chosen organizations, workflow-restricted deploy runners, Actions Runner Controller scale sets |
| Read-only token default | Enterprise-enforced read-only default; pull request creation by Actions off |
| OIDC for one cloud identity | OIDC everywhere, custom property claims, job_workflow_ref for shared deploy workflows |
| Attestations for public releases | Attestations for all builds, verified at deployment |
| Monthly audit exports and a drift-check workflow | Audit log streaming to security monitoring, thirteen months retained, nightly drift checks |
| Two budgets | Budgets per cost center, monthly showback reports |
A checklist to keep
Lena ended with the checklist she added to the .github repository, to be reviewed every quarter:
| Check | How |
|---|---|
| Allowed actions list still matches what is used | Search uses: lines; compare with the policy |
| No unpinned third-party actions | Pinning policy blocks them; lockfile diff in TrailCheck |
| Token defaults read-only everywhere | Organization setting; spot-check repositories |
| Runner groups and runners as intended | Runner groups page; remove offline runners |
| Every secret has one home, an owner and a rotation date | Secrets inventory against settings |
| No personal access tokens in workflows | Search for PAT secret names; use App tokens |
| Audit events exported and reviewed | Monthly export file present |
| Budgets and usage reviewed | Usage report; budget alerts history |
Measuring the result
A plan needs measures, or nobody can tell whether it worked. Lena chose numbers that could be read from GitHub without extra tools, and recorded them before and after the sessions.
| Measure | Before | After |
|---|---|---|
| Third-party actions in use | 23 | 14, all on the allow list |
| Actions referenced by tag or branch | 23 | 0 |
| Repositories with a read and write token default | 2 of 4 | 0 |
| Jobs without a permissions block | 19 | 0 |
| Stored credentials in GitHub | 19 | 11, each with an owner and rotation date |
| Personal access tokens used by workflows | 1 | 0 |
| Repositories able to reach the self-hosted runner | 4 | 1 |
| Releases with verifiable provenance | 0 | Every validator release from 2.3.1 |
| Months of exported audit evidence | 0 | 1, with a monthly reminder |
Yevgenia liked the table but warned against treating it as finished. Numbers like "jobs without a permissions block" drift upward as new workflows are written, which is why the quarterly checklist recounts them and the workflow linter flags them in pull requests. A measure that is checked once is a snapshot; a measure that is checked every quarter is a control.
Communicating the plan
Hardening changes how people work, so it needs explaining as much as configuring. Lena wrote a one-page note for volunteers who contribute to TrailCheck, explaining why their first workflow run waits for approval and why new actions need a request rather than a simple uses: line. She wrote a separate paragraph for Rosa and the board, in plain language: what was risky, what changed, what it costs, and what risks remain. Priya added a section to Tidewater's onboarding guide so new staff learn the rules before they meet them as failed runs. Grace observed that the error messages had become part of the documentation: when a run fails with a pinning or permission error, the troubleshooting page now explains exactly what to do.
The plan also needed an owner after the sessions ended. Priya took ownership of the quarterly review, Lena of the drift-check workflow and Dependabot updates, Owen of the print-room runner and Rosa of budgets and the secrets inventory. Every control in HARDENING.md names its owner, so a question about any of them has someone to answer it.
Mapping the course to the exam
Priya closed with a reminder for Lena's exam preparation. The GH-200 outline includes managing GitHub Actions for the enterprise and securing automation, and this course's lessons map onto those areas directly: distributing actions and workflows, templates, runner groups, self-hosted runner security, secrets and variables, OpenID Connect, token permissions, pinning, attestations, limits and billing, and auditing. Exam questions in these areas usually describe a situation and ask for the control that fits, so the habit this case study practices, naming the risk, the control and the plan it needs, is exactly the habit to bring into the exam room.
| If the question mentions… | Think of… |
|---|---|
| Sharing automation across repositories | Private repository Access setting, internal repositories, templates, reusable workflows |
| Which runners a repository may use | Runner groups, public repository setting, workflow restrictions |
| Untrusted pull requests | Hosted runners, fork approval, pull_request versus pull_request_target |
| Cloud access without stored keys | OIDC, id-token: write, subject and job_workflow_ref |
| Third-party code risk | Allow list, SHA pinning, lockfiles, Dependabot |
| Proving where a build came from | Artifact attestations, gh attestation verify |
What the group would do differently
Before closing, Priya asked each person for one lesson they would carry to the next project. Dmitri said he would write permissions blocks from the first line of a workflow rather than adding them after a failure. Owen said he would never again register a runner without first deciding which group it belonged to. Rosa said a secret without an owner is a liability, not an asset. Malik said attestations had changed how he thought about releases: a package is not just a file but a claim about where the file came from, and the claim can be checked. Lena said the inventory was the most useful hour of the whole series, because every later decision rested on it.
Worked problem
Ordering the work
A new organization has the same problems Tidewater had. Its manager wants to start by requiring SHA pinning and lockfiles everywhere on day one "to be safe". What would you advise, and in what order?
Show solution
- Start with an inventory: without it, a strict policy breaks unknown workflows and people work around it.
- Restrict next: allow selected actions and read-only tokens, fixing each workflow that fails with a narrow grant.
- Then pin existing actions and enable Dependabot, and only then require pinning, first in one repository and then everywhere; evaluate lockfiles after.
- Finish with evidence: audit exports, drift checks and budgets.
Answer: See, restrict, replace, prove: inventory first, then policies, then pinning with tooling before requiring it, then evidence.
Worked problem
Answering an exam-style scenario
A company wants its deployment workflow in many repositories to use self-hosted runners on a private network, assume a cloud role without stored keys, and ensure that only the platform team's deployment logic can do either. Which three controls fit?
Show solution
- A runner group for the private-network runners, restricted to selected repositories and to the platform team's reusable deployment workflow.
- OIDC with a cloud trust condition on job_workflow_ref naming that reusable workflow at an approved ref.
- The reusable workflow itself kept in a protected repository, referenced by tag or SHA, with tags created only by the platform team.
Answer: A workflow-restricted runner group, OIDC trust on job_workflow_ref, and a protected, versioned reusable workflow.
Common mistakes
MistakeTurning on every strict policy at once.
InsteadInventory, then restrict, then replace, then prove, testing each stage.
MistakeTreating hardening as finished once settings are changed.
InsteadKeep a checklist, drift checks and exports so the controls stay true.
MistakeHiding remaining risks to make a plan look complete.
InsteadName them with a decision date or a mitigation.
MistakeCopying enterprise controls into a small organization without checking the plan.
InsteadCheck which features the plan includes and choose equivalent controls where they are missing.
The presentation took forty minutes. Lena booked Exam GH-200 for the second week of December the same evening, and Priya merged the hardening plan into the .github repository as HARDENING.md, with the quarterly checklist as an issue template.
Summary and key terms
- Harden in four stages: see (inventory), restrict (policies and permissions), replace (credentials and pins), prove (attestations, audit, budgets).
- Each control should name the risk it addresses, its cost and the plan it needs.
- Hardened workflows use permissions: {} at the top, narrow job grants, hosted runners for public repositories, SHA pins, OIDC and verified artifacts.
- Remaining risks are part of a good plan: name them with mitigations and decision dates.
- Enterprise versions of the same controls add enforcement across organizations, streaming, workflow-restricted runner groups and custom claims.
- A quarterly checklist and automated drift checks keep the controls true over time.
- Hardening
- Reducing the ways automation can be misused or can fail, by restricting, replacing and verifying.
- Inventory
- A record of the actions, runners, secrets and settings actually in use.
- Drift
- The gap that grows between intended and actual configuration over time.
- Least privilege
- Granting only the access a job needs, for only as long as it needs it.
- Defense in depth
- Several independent controls, so one failure does not expose everything.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why start a hardening plan with an inventory?
Show answer
Restrictions applied without knowing what is used break workflows and invite workarounds.
Why put permissions: {} at the top of a workflow?
Show answer
So no job inherits permissions; each job grants exactly what it needs.
Name one control Tidewater could not use on the Team plan for its private repository.
Show answer
Required reviewers on environments, or artifact attestations.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.