MSBA-360 · Lesson 12 of 12 · 18 min
Case study: removing leaked credentials
▶ Video coming soon A video version of this lesson is on the way.
The last session of the course was not planned. On Tuesday, November 17, 2026, at 10:42, Skerry's alert router posted a P1 in the incident channel: an active secret, a service account key for the production data warehouse, pushed to an internal repository in the skerry organization. By the time the Thursday session began, the incident was closed, and Freya decided to use the session to walk through it end to end. This lesson follows that review. It brings together everything in the course: detection, push protection, validity checks, prioritization, response, evidence and the changes to controls that followed.
What happened
A data engineer on the forecasting team was debugging a nightly job that loaded store sales into the data warehouse. To test locally, he copied the job's service account key into a script. On Tuesday morning he committed the script with other changes and pushed. Push protection blocked the push, recognizing the cloud provider's key format. He was under time pressure, read the options, chose "I'll fix it later" and pushed again. The push succeeded, and GitHub created an open secret scanning alert, as lesson 3 described.
The repository, data-forecast-pipeline, was internal: readable by every member of every organization in the enterprise, about 1,100 developers. The key could read and write the sales and loyalty tables in the warehouse. The validity check reported it as active. Under Skerry's priorities from lesson 11, that was a P1 with a four-hour target to revoke.
While investigating, Seraphine found a second problem. Searching the organization's secret scanning alerts for the same key value, she found it in an issue comment in the same repository, pasted two weeks earlier in a request for help. Push protection does not apply to issue comments, and secret scanning had raised an alert for that location at the time, but the alert had been assigned to nobody because the repository had been migrated without an owning-team property. It had sat open for 13 days.
The response, step by step
Seraphine led the response with the forecasting team's lead and Amadou Ferrand-Bakari from identity. They followed the standard steps from lesson 2, in order, and recorded each one in the incident ticket.
Revoke. At 11:05 the forecasting lead confirmed that the key belonged to the nightly load job. At 11:31 the data platform team created a new key, stored it in the job's secret store and deleted the old one. The validity check, run on demand from the alert, reported inactive at 11:34. Time from alert to revocation: 49 minutes, inside the four-hour target.
Investigate. The more important question was whether anyone had used the key during its exposure. The warehouse's access logs recorded every request made with the service account. Seraphine's team reviewed them for the 15 days since the issue comment, looking for requests from anywhere other than the job's own runner network or the engineer's laptop. They found none. They also checked that no new keys or permissions had been created for the account. By 15:40 they concluded there was no evidence of misuse.
Replace. The engineer rewrote his local test script to read the key from an environment variable populated by the cloud provider's command-line login, which uses his own identity instead of the service account. The fix went through a pull request with a review from the data platform team.
Close. At 16:20 the alert for the commit location was closed as revoked with a comment linking the ticket and the rotation record. The issue comment was edited to remove the key, and because GitHub keeps edit history, a repository administrator deleted the comment and the help request was reposted without the key. The older alert for the comment location closed with it, because both locations belonged to one alert for the same secret value.
| Step | Time on November 17 | Evidence recorded |
|---|---|---|
| Alert raised and routed as P1 | 10:42 | Alert number, router ticket, channel post |
| Owner confirmed | 11:05 | Ticket comment from the forecasting lead |
| Key revoked and replaced | 11:31 | Cloud provider key deletion record; validity check inactive at 11:34 |
| Access logs reviewed | 12:10 to 15:40 | Log query and summary attached to the ticket |
| Code fixed | 16:05 | Merged pull request |
| Alert closed as revoked | 16:20 | Closing reason and comment |
Should history be rewritten?
The engineer's first instinct, once he understood what had happened, was to rewrite the repository's history to remove the key. Seraphine stopped him, and the review explained why. The key had been revoked, so the string in history no longer opened anything. Rewriting history would change the identifiers of every commit after it, break open pull requests and every developer's clone, and could not remove copies in clones, caches or the build system's checkout directories. Most importantly, it would not make anyone safer.
GitHub's guidance agrees: once a credential is revoked, rewriting history is rarely worth its cost. It is worth considering when the content itself must not remain, such as personal data or a secret that cannot be rotated. Neither applied. The commit stayed in history, the alert stayed closed as revoked, and the ticket recorded the decision.
Worked problem
When rewriting would be justified
In the same review, Ottoline asked when Skerry would rewrite history. Seraphine offered two hypotheticals. In the first, a developer commits a spreadsheet with customers' names and addresses to an internal repository. In the second, a developer commits the private signing key for the store terminals' firmware, which is burned into hardware and cannot be rotated quickly. What should happen in each?
Show solution
- The spreadsheet contains personal information, which privacy law and Skerry's policy say must not be kept where it does not belong. Rewriting history to remove it is justified, along with a privacy assessment, because revocation is not possible for data.
- The firmware signing key cannot be revoked in hours. The response is to rewrite history to reduce exposure, contact GitHub Support to remove cached views, start the long process of rotating the key in hardware, and treat every clone as exposed.
- In both cases rewriting is only part of the response, not the whole of it.
- For ordinary rotatable credentials, revocation remains the remedy.
Why the controls did not stop it
The review looked for causes, not blame. Freya insisted on that: the engineer had followed a process that allowed what he did. Three controls had worked as designed and still let the key through.
First, push protection blocked the push, but the skerry organization allowed direct bypass. Delegated bypass was on only in skerry-stores. The engineer could choose "I'll fix it later" without anyone reviewing it. Second, secret scanning had found the key in the issue comment two weeks earlier, but the alert had no owner: the repository was among the 40 that had no owning-team property after migration. The router had nowhere to send it. Third, the service account had broad permissions to read and write tables the nightly job did not use, so the potential damage was larger than necessary.
What changed afterwards
The review produced five changes, each with an owner and a date, recorded in the governance repository.
| Change | Owner | Date |
|---|---|---|
| Turn on delegated bypass for all repositories classified confidential or restricted, with application security as reviewers and a four-hour response target | Seraphine | December 1, 2026 |
| Require the owning-team property on every repository and block migration completion without it; assign the 40 ownerless repositories | Platform team | November 27, 2026 |
| Route unassigned secret alerts older than 24 hours to application security | Alert router owner | November 24, 2026 |
| Reduce the warehouse load account to the two tables its job writes; review all service account scopes in the data group | Data platform team | December 15, 2026 |
| Offer a local pre-commit secret check in the developer setup and explain push protection bypass reasons in onboarding | Developer experience team | January 2027 |
Priya asked whether delegated bypass would slow developers down. Seraphine's answer used the month's numbers: 173 blocks, 22 bypasses, of which only 5 were "I'll fix it later". With delegated bypass, the 17 test and false-positive cases would have waited for a reviewer; the 5 risky ones would have been caught before the push. A few hours of waiting on 17 pushes was a small price for stopping 5 exposures.
Communicating about the incident
Because the key could reach loyalty tables containing customer information, Freya informed Skerry's privacy officer on the day. With no evidence of access by anyone other than the job and the engineer, the privacy officer concluded that no notification to customers or to a regulator was required, and recorded the assessment. If the logs had shown unexplained access, the incident would have moved into Skerry's privacy breach process, with its own timelines. Security teams do not make that decision alone, but they provide the evidence it rests on.
The engineer was not disciplined. He presented a five-minute version of the incident at the next data group meeting, explaining what the push protection message meant and why "I'll fix it later" is not a harmless choice. Freya said that talk would prevent more incidents than any setting.
Applying the course
The case used almost every part of the course. Lesson 1's security configurations carried push protection and validity checks to the repository. Lesson 2's alert lifecycle and response steps shaped the timeline. Lesson 3's push protection blocked the first attempt, and its bypass rules explained why the second succeeded. Lesson 4's validity check set the priority and confirmed revocation. Lesson 11's priorities, ownership and routing decided how fast the response started, and their gap explained the 13-day-old comment alert. The supply chain lessons played a smaller part, but the same principles appear: an inventory you can search, owners for every alert, evidence for every decision, and controls that are reviewed when they fail.
Your turn
Work through these questions as if you were preparing for the review meeting. Write your answers before reading the practice answers below.
First, Skerry's priorities give a P1 secret four hours to revocation. This one took 49 minutes. Which parts of the process made that possible, and which part, if it had failed, would have made the four-hour target impossible? Second, the issue comment alert sat unassigned for 13 days. Propose two independent controls that would each have caught it. Third, suppose the access logs had shown three requests from an unknown address on November 9. List the additional steps the team would need to take, and who would need to be involved. Fourth, the engineer's first idea was to rewrite history. Write the two-sentence explanation you would give him for why that was not necessary, in language a new developer would understand.
What the auditors saw
In January 2027 the incident would be part of the evidence Ottoline's team reviewed for the annual audit. Because every step was recorded, she could trace it without interviews: the alert and its history, the router's ticket, the rotation record from the cloud provider, the validity check result, the log review, the pull request that fixed the script, the closing reason and the review's action list with owners and dates. She told Freya it was the easiest incident she had ever audited. The lesson for Priya was that evidence is not extra work done for auditors; it is the record of doing the work properly, kept where someone else can find it.
Priya closed her notes on the course with the same four questions she had written in the first session: which repositories are protected, who owns each alert, what the first action is for each kind of alert, and how long that action takes. The incident had tested all four, and the answers had been good enough, but not perfect.
Common mistakes
MistakeRewriting history before revoking the credential.
InsteadRevoke first; rewrite only when the content itself must not remain.
MistakeClosing an incident when the key is rotated.
InsteadInvestigate use during the exposure window and record the evidence.
MistakeBlaming the developer who bypassed push protection.
InsteadFind the process gap that allowed it and change the control.
MistakeLeaving alerts without owners after a migration.
InsteadRequire ownership metadata and route unowned alerts to a fallback team.
Summary and key terms
- A bypass with "I'll fix it later" put an active production key in an internal repository; the same key had sat in an unowned issue-comment alert for 13 days.
- The response followed revoke, investigate, replace and close, with evidence recorded for each step; revocation took 49 minutes.
- History was not rewritten because the key was revoked; rewriting is reserved for content that cannot be revoked, such as personal data.
- The review found three control gaps: direct bypass, alerts without owners and an over-privileged service account.
- Fixes included wider delegated bypass, required ownership, routing for unassigned alerts, narrower permissions and developer education.
- Exposure window
- The period during which a leaked secret was readable by people who should not have it.
- Access log review
- Checking a provider's records of how a credential was used during exposure.
- Post-incident review
- A structured look at an incident to find causes and agree changes, without blame.
- Least privilege
- Granting an identity only the permissions its task needs.
- Fallback routing
- Sending alerts with no owner to a designated team after a set time.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why was the issue-comment alert not acted on for 13 days?
Show answer
Its repository had no owning-team property, so the router had nowhere to send it and nobody was assigned.
What evidence confirmed the key was revoked?
Show answer
The provider's key deletion record and an on-demand validity check reporting inactive.
Which single control change would have stopped the push itself?
Show answer
Delegated bypass for the repository, so the bypass would have needed a reviewer's approval.
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.