A STAR story for a leaked secret: revoke and rotate first, history rewriting as a secondary step, checking access logs for misuse, Notifiable Data Breaches assessment, and moving to managed identity and secret scanning.
My story is a [storage account key / SQL connection string] committed to [a repo] and caught by [GitHub secret scanning / a reviewer] [N hours] later. The first rule is that a pushed secret is compromised, so I rotated it first (new key, update Key Vault, restart apps) in [20] minutes, before touching Git history. Then I checked whether it had been used: [storage analytics logs / Azure SQL auditing] showed only our own app's access. I involved [the security lead] because the resource held personal data, and we documented an NDB assessment concluding no eligible breach. The real fix was removing the secret entirely with managed identity, and turning on push protection. Result: [secrets in repos from N to 0]. The trade-off: rotating immediately can cause a short outage if you don't know every consumer, which is why secret inventory matters.
"At [company], [a developer] committed an
appsettings.Development.jsoncontaining the [production storage account key] to [our GitHub repo]. GitHub secret scanning flagged it about [two hours] later and I was [the senior engineer on the team / on call].I treated the key as compromised straight away, because once it's pushed you can't know who has cloned it. I regenerated the key in Azure, updated the secret in Key Vault, and restarted the [three] apps that used it; that took about [20] minutes and caused [a few seconds] of errors on one app I'd missed at first. Only then did I clean the history, and I was clear with the team that rewriting history is housekeeping, not containment.
Next I checked for misuse. Storage diagnostic logs in Log Analytics showed every request in that window came from our own app's IP ranges, with no listing or downloads from elsewhere. Because the account held [customer documents], I brought in [our security lead] and we wrote up an assessment under the Notifiable Data Breaches scheme: contain, assess, notify, review. We concluded there was no unauthorised access, so no notification was required, and kept the record.
The real fix was making the key unnecessary: the apps moved to managed identity with RBAC on the storage account, and we disabled shared-key access. We turned on push protection and added gitleaks to the pre-commit hooks. A scan of all [40] repos found [six] other old secrets, which we rotated. The developer wasn't blamed; the process had made it too easy. My lesson: the best secret is one that doesn't exist."
| Step | Why first |
|---|---|
| 1. Revoke / rotate | Ends the attacker's window |
| 2. Update consumers (Key Vault, app settings) | Restores service |
| 3. Check for misuse in logs | Decides whether it's a data breach |
| 4. Escalate (security lead, privacy officer) | Legal and NDB obligations |
| 5. Clean history (git filter-repo, BFG) | Reduces future exposure only |
Under the Privacy Act 1988, if there are reasonable grounds to suspect an eligible data breach (unauthorised access likely to cause serious harm), the entity must make reasonable efforts to assess it within 30 days, and notify the OAIC and affected individuals as soon as practicable if it is eligible. The OAIC's response steps are contain, assess, notify, review, and it treats 30 days as a maximum, not a target.
Template: [storage key] exposed for [2 h]; rotated in [20] min; logs showed no external access; NDB assessment documented, no notification required; [6] more old secrets found and rotated across [40] repos; shared-key access disabled.
Checks whether you contain a leaked secret correctly and quickly, check for misuse, escalate appropriately under Australian privacy obligations, and remove the root cause.
Green flags
Red flags
This checks security instincts (contain first), honesty and escalation (you didn't hide it), knowledge of Australian obligations under the Notifiable Data Breaches scheme, and whether you fixed the class of problem rather than the instance.
git push -> GitHub -> forks, clones on laptops, CI caches, PR diffs, mirrors, scrapers
(bots scan public GitHub for keys within minutes)
Rewrite history -> only removes it from YOUR copy going forward
Only revoking the credential makes the leaked copy useless.
AccountKey, operations.If logs don't cover the window, you have to assume access was possible, which changes the NDB assessment.
STAR. A security story benefits from showing the order of actions clearly. Avoid naming or blaming the colleague.
Weak: "we deleted the commit." Good: rotated the key. Strong: rotated first, checked logs, escalated. Excellent: removed the need for the secret (managed identity), added push protection and scanned other repos, handled it blamelessly.
Also answers "a time you handled something sensitive", "a time you raised a problem with leadership" and "a time you improved security". Non-technical version: "A password was accidentally published in our code. I changed it within 20 minutes, checked nobody had used it, and changed our setup so there's no password to leak."
gitleaks detect on one of your repos (including history).DefaultAzureCredential.AuthenticationType == "AccountKey".Removing the secret entirely: managed identity instead of a connection string.
using Azure.Identity;
using Azure.Storage.Blobs;
var builder = WebApplication.CreateBuilder(args);
// Before: builder.Configuration["Storage:ConnectionString"] held the account key.
// After: no secret at all. Managed identity in Azure, developer login locally.
builder.Services.AddSingleton(_ => new BlobServiceClient(
new Uri(builder.Configuration["Storage:BlobEndpoint"]!), // e.g. https://acct.blob.core.windows.net
new DefaultAzureCredential())); // needs 'Storage Blob Data Contributor' role
var app = builder.Build();
app.Run();
# Contain first: rotate the leaked key, then disable shared-key access once apps use identity
az storage account keys renew -g rg-docs -n stdocsprod --key primary
az storage account update -g rg-docs -n stdocsprod --allow-shared-key-access false
# Prevent: scan history and block future pushes
gitleaks detect --source . --log-opts="--all"
STAR template
S: [Secret] for [resource with what data] committed to [repo], found by [scanner/person] after [time].
T: I [was on call / owned the response].
A: Rotated in [N min]; updated [consumers]; checked [logs] for misuse; escalated to [role]; NDB assessment;
cleaned history; moved to [managed identity]; enabled [push protection, gitleaks]; scanned [N repos].
R: [No misuse found]; [N] other secrets rotated; [secrets in config: N -> 0].
Illustrative only: storage key exposed 2 h; rotated in 20 min; no external access in logs; managed identity rollout.
What makes this sound senior is the order of actions (contain, check, escalate, clean), transparency with security and privacy owners, and removing the class of risk (no long-lived secrets, push protection, org-wide scanning). Showing you know the NDB scheme's steps and the 30-day assessment window, and that you documented the decision, is a strong Australian-context signal.
The other senior layer is culture. Run a blameless post-incident review with the team: what made it easy (a production key reachable from a dev config file, no local secret store, no push protection), what you changed, and what other teams should check. Share it beyond the team, fold it into onboarding (user-secrets locally, Key Vault and managed identity in Azure), and measure the outcome (secrets found by scans per quarter trending to zero). A team that reports leaks quickly because it isn't punished for them is worth more than any scanner.
| Control | Stops | Cost | Limitation |
|---|---|---|---|
| Managed identity + RBAC | Secrets existing at all (Azure resources) | Role setup, local dev via az login |
Third-party APIs still need keys |
| Key Vault references | Secrets in config files | Low | Secret still exists and can leak elsewhere |
| Push protection (GitHub / GitHub Advanced Security for Azure DevOps) | Known secret patterns reaching the remote | Licence for private repos | Custom formats need custom patterns |
| Pre-commit scanner (gitleaks, TruffleHog) | Secrets before commit | Developer setup | Can be bypassed locally |
| Short-lived credentials | Value of a leaked secret | Rotation automation | Not every provider supports it |
| Blameless review + onboarding | Repeat incidents, hidden mistakes | Time | Needs leadership support |
Contain first: disable the feature or purge the cache. Tell the privacy officer straight away and follow the organisation's data breach response plan. Under the Privacy Act 1988 NDB scheme, a suspected eligible breach must be assessed within 30 days; if it is likely to cause serious harm and remedial action hasn't removed the risk, notify the OAIC and affected individuals as soon as practicable. Engineers provide the facts: which fields, how many people, which recipients, the time window, and evidence from audit and response logs. Document every step and decision, and preserve evidence: don't delete logs. Failing to assess or notify is an interference with privacy, and serious interferences can attract large civil penalties since the 2022 amendments.
Managed identity gives the app an Entra ID identity that Azure manages, so there is no secret to store or rotate. In code, Azure.Identity gets tokens: DefaultAzureCredential tries managed identity in Azure and the developer's az login or Visual Studio sign-in locally. Then:
AddAzureKeyVault.BlobServiceClient with the credential.CREATE USER [app-name] FROM EXTERNAL PROVIDER, add it to database roles, and use Authentication=Active Directory Default in the connection string.Use a user-assigned identity when several apps share access or it must survive redeploys. The trade-off is setup effort in RBAC and SQL users in exchange for no secrets at all.
An API key is a long random secret that identifies a calling application, not a user. It suits partner integrations, internal tools and webhooks where OAuth would be overkill, but it is a static bearer secret, so design for leaks.
RandomNumberGenerator, add a prefix and key id (sk_live_<id>_<secret>) so you can look it up and secret scanners can spot it.FixedTimeEquals.AuthenticationHandler that turns a valid key into claims; policies decide access.The trade-off: keys are simple for partners but never expire on their own; OAuth client credentials give short-lived tokens.
How to tell it (STAR)
**S:** At [company], a production storage key for [customer documents] was committed to our repo, and secret scanning flagged it [two hours] later. **T:** As [the senior engineer on call] I had to contain it and work out whether any data had been exposed. **A:** I treated the key as compromised and rotated it first, updating Key Vault and the apps that used it in about [20] minutes. Then I checked the storage logs for that window and found only our own apps had used the key. Because personal data was involved, I brought in [our security lead] and we documented a Notifiable Data Breaches assessment. After that I moved the apps to managed identity, disabled key access on the account, and turned on push protection and pre-commit scanning. **R:** No data was accessed, we found and rotated [six] older secrets across [40] repos, and the storage account no longer has a usable key to leak.
Last updated 23 Nov 2026.