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 sceptical 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.

Tidewater's Actions estate at the start of the hardening sessions.
AreaBefore the sessions
Allowed actionsAllow all; 23 third-party actions, several unmaintained or unknown
ReferencesAll third-party actions by tag
Token defaultsRead and write in two of four repositories; create and approve pull requests on
Self-hosted runnerPrint-room machine in the Default group, all repositories, administrator account, saved cloud login
Secrets19 credentials, map-tile key stored three times, a personal access token for cross-repository pushes
Cloud accessClient secret with an expiry date
Shared automationnode-ci.yml shared; no templates; .github repository unprotected
EvidenceNo 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.

Four boxes in sequence. 1 See: inventory actions, runners, secrets, tokens. 2 Restrict: allowed actions, read-only token, runner groups. 3 Replace: OIDC for cloud, App tokens for personal access tokens, ephemeral runner. 4 Prove: attestations, audit review, budget alerts. Caption text: each stage is small enough to review and undo before the next begins.
Tidewater's four-stage hardening plan.
The hardening plan with the risk each control addresses.
StageControlsRisk addressedPlan or feature
1 SeeInventory of actions, runners, secrets, token defaults; actions-inventory.mdUnknown exposureAny plan
2 RestrictAllow selected actions; read-only token default; pull request approval off; runner groups; fork approval for outside contributorsUntrusted code and excessive permissionsRunner groups need Team or above
2 RestrictProtected .github repository with CODEOWNERS; workflow templates as thin callersSilent changes to shared automationAny plan
3 ReplaceOIDC to Azure for the tile upload; GitHub App token instead of a personal token; one home per secret; Dependabot secretsLong-lived, leakable credentialsAny plan
3 ReplaceSHA pinning required; Dependabot for actions; lockfile in TrailCheckMoved tags and compromised actionsAny plan
3 ReplaceUnprivileged, segmented print-room runner, moving to ephemeralPersistent runner compromiseAny plan
4 ProveAttestations for public releases; monthly audit exports; weekly drift check; budgetsUnverifiable builds and unnoticed changesAttestations 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.

TrailCheck's hardened deploy workflow. SHAs are illustrative.
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@v4

Yevgenia 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 cancelled 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.

The same controls at organization and enterprise scale.
Tidewater (Team organization)Skerry (Enterprise Cloud)
Allow selected actions at the organizationEnterprise policy with about a hundred allowed patterns, enforced on all organizations
SHA pinning required in the organizationPinning required everywhere; lockfiles required in the store systems organization
One runner group for one office machineEnterprise runner groups shared with chosen organizations, workflow-restricted deploy runners, Actions Runner Controller scale sets
Read-only token defaultEnterprise-enforced read-only default; pull request creation by Actions off
OIDC for one cloud identityOIDC everywhere, custom property claims, job_workflow_ref for shared deploy workflows
Attestations for public releasesAttestations for all builds, verified at deployment
Monthly audit exports and a drift-check workflowAudit log streaming to security monitoring, thirteen months retained, nightly drift checks
Two budgetsBudgets per cost centre, monthly showback reports

A checklist to keep

Lena ended with the checklist she added to the .github repository, to be reviewed every quarter:

Tidewater's quarterly Actions review checklist.
CheckHow
Allowed actions list still matches what is usedSearch uses: lines; compare with the policy
No unpinned third-party actionsPinning policy blocks them; lockfile diff in TrailCheck
Token defaults read-only everywhereOrganization setting; spot-check repositories
Runner groups and runners as intendedRunner groups page; remove offline runners
Every secret has one home, an owner and a rotation dateSecrets inventory against settings
No personal access tokens in workflowsSearch for PAT secret names; use App tokens
Audit events exported and reviewedMonthly export file present
Budgets and usage reviewedUsage 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.

Tidewater's hardening measures before and after the sessions.
MeasureBeforeAfter
Third-party actions in use2314, all on the allow list
Actions referenced by tag or branch230
Repositories with a read and write token default2 of 40
Jobs without a permissions block190
Stored credentials in GitHub1911, each with an owner and rotation date
Personal access tokens used by workflows10
Repositories able to reach the self-hosted runner41
Releases with verifiable provenance0Every validator release from 2.3.1
Months of exported audit evidence01, 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 practises, naming the risk, the control and the plan it needs, is exactly the habit to bring into the exam room.

Exam cues and the controls they point to.
If the question mentions…Think of…
Sharing automation across repositoriesPrivate repository Access setting, internal repositories, templates, reusable workflows
Which runners a repository may useRunner groups, public repository setting, workflow restrictions
Untrusted pull requestsHosted runners, fork approval, pull_request versus pull_request_target
Cloud access without stored keysOIDC, id-token: write, subject and job_workflow_ref
Third-party code riskAllow list, SHA pinning, lockfiles, Dependabot
Proving where a build came fromArtifact 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
  1. Start with an inventory: without it, a strict policy breaks unknown workflows and people work around it.
  2. Restrict next: allow selected actions and read-only tokens, fixing each workflow that fails with a narrow grant.
  3. Then pin existing actions and enable Dependabot, and only then require pinning, first in one repository and then everywhere; evaluate lockfiles after.
  4. 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
  1. A runner group for the private-network runners, restricted to selected repositories and to the platform team's reusable deployment workflow.
  2. OIDC with a cloud trust condition on job_workflow_ref naming that reusable workflow at an approved ref.
  3. 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.
Defence 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.

  1. Why start a hardening plan with an inventory?

    Show answer

    Restrictions applied without knowing what is used break workflows and invite workarounds.

  2. Why put permissions: {} at the top of a workflow?

    Show answer

    So no job inherits permissions; each job grants exactly what it needs.

  3. 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.

Take the quiz