Skip to content

Commit 43f0e45

Browse files
incident-management: tighten IR template structure and pipeline runbook
1 parent 04dc3e0 commit 43f0e45

10 files changed

Lines changed: 364 additions & 120 deletions

File tree

docs/pages/incident-management/incident-response-template/incident-response-policy.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ See [Runbooks](./runbooks/overview) for step-by-step guides for specific inciden
171171
**Goal:** Confirm the fix actually worked.
172172

173173
- Verify immediately after deployment
174-
- Monitor for at least a week
174+
- Monitor based on residual risk, blast radius, and incident type
175175
- Consider adding new alerts or test cases
176176
- Document what monitoring is now in place
177177

docs/pages/incident-management/incident-response-template/overview.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ That's it to start. Add complexity only as you need it.
8585

8686
Review and adapt these pages for your own internal incident response documentation.
8787

88+
This section is different from the broader [Incident Management](/incident-management/overview) guidance:
89+
90+
- **[Incident Management](/incident-management/overview)** explain concepts and practices
91+
- **[Incident Response Templates](/incident-management/incident-response-template/overview)** are meant to be copied, customized, and used internally
92+
93+
Within this template section:
94+
95+
- **[Policy](/incident-management/incident-response-template/incident-response-policy) / [roles and staffing](/incident-management/incident-response-template/roles-and-staffing) / [communications](/incident-management/incident-response-template/communications) / [contacts](/incident-management/incident-response-template/contacts)** define your operating model
96+
- **[Templates](/incident-management/incident-response-template/templates/overview)** are blank working documents to fill out during or after incidents
97+
- **[Runbooks](/incident-management/incident-response-template/runbooks/overview)** are scenario-specific response procedures
98+
8899
### What's Included
89100

90101
| Document | Purpose |

docs/pages/incident-management/incident-response-template/roles-and-staffing.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ Regardless of team size, define who can make high-stakes decisions during P1 inc
180180
| | | |
181181
| | | |
182182

183-
These people should be reachable 24/7 for critical incidents. Consider:
184-
183+
There should be a 24/7 escalation path to these people for critical incidents. Consider:
185184
- Founders / C-level
186185
- Security Lead
187186
- Engineering Lead

docs/pages/incident-management/incident-response-template/runbooks/build-pipeline-compromise.mdx

Lines changed: 136 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Runbook: Build Pipeline Compromise | Security Alliance"
3-
description: "Stub runbook. Customize with your CI/CD platform and procedures."
3+
description: "Example runbook for CI/CD compromise. Review and customize for your platform, release process, and trust boundaries before use."
44
tags:
55
- Security Specialist
66
- Operations & Strategy
@@ -21,7 +21,7 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
2121
<TagList tags={frontmatter.tags} />
2222
<AttributionList contributors={frontmatter.contributors} />
2323

24-
> **Stub runbook.** Customize with your CI/CD platform and procedures.
24+
> **This is an example runbook.** Review and customize for your CI/CD platform, artifact flow, deployment model, and approval process before use.
2525
2626
## Quick Reference
2727

@@ -36,39 +36,149 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
3636

3737
### Symptoms
3838

39-
- [ ] Unexpected code in deployed artifacts
40-
- [ ] CI/CD configuration changed without approval
41-
- [ ] Secrets accessed or exfiltrated
42-
- [ ] Unauthorized workflow runs
39+
- [ ] Unexpected workflow runs or releases
40+
- [ ] CI/CD configuration changed without expected approval
41+
- [ ] Secrets accessed, exported, or rotated unexpectedly
42+
- [ ] Build artifacts differ from expected source or prior reproducible output
43+
- [ ] Deployments reference an unexpected commit, artifact, or builder identity
4344

44-
### Confirm Compromise
45+
### Likely Scope Questions
46+
47+
- Is this limited to CI configuration, or were artifacts actually produced from a compromised pipeline?
48+
- Did the pipeline have deploy permissions, signing authority, or production credentials?
49+
- Were any releases, containers, frontend bundles, or packages published during the exposure window?
50+
51+
### Differentiation
52+
53+
- Unauthorized code merged without pipeline abuse may be a repository compromise first
54+
- Malicious package updates without CI tampering may be a dependency incident first
55+
- A bad deployment from a legitimate commit may be an operational failure rather than compromise
4556

46-
- Review CI/CD audit logs
47-
- Compare build artifacts to source
48-
- Check for config changes in CI/CD platform
4957

5058
## Immediate Actions
5159

52-
1. [ ] Disable compromised pipelines
53-
2. [ ] Rotate all secrets and tokens
54-
3. [ ] Take down potentially compromised deployments
55-
4. [ ] Audit recent builds and deployments
60+
### Step 1: Freeze the pipeline
61+
62+
**Why:** Stop additional malicious builds, releases, or secret access.
63+
64+
- [ ] Disable affected workflows/pipelines
65+
- [ ] Revoke or pause auto-deploy jobs
66+
- [ ] Block manual approvals until scope is understood
67+
68+
### Step 2: Preserve evidence
69+
70+
**Why:** CI audit logs, workflow definitions, artifact metadata, and deployment history are easy to overwrite.
71+
72+
- [ ] Export CI audit logs
73+
- [ ] Save workflow/job history for the exposure window
74+
- [ ] Record affected commits, workflow files, artifact digests, release IDs, and deployment targets
75+
- [ ] Preserve runner details if self-hosted runners were involved
76+
77+
### Step 3: Rotate credentials by blast radius
78+
79+
**Why:** Pipeline compromise often becomes credential compromise.
80+
81+
Prioritize rotation of:
82+
- [ ] CI platform tokens
83+
- [ ] cloud deploy credentials
84+
- [ ] package registry tokens
85+
- [ ] artifact signing keys or release credentials
86+
- [ ] secrets available to self-hosted runners
87+
88+
### Step 4: Stop trust in recent outputs
89+
90+
**Why:** Do not assume recent artifacts or deployments are clean.
91+
92+
- [ ] Identify all artifacts built during the exposure window
93+
- [ ] Identify all deployments and releases from those artifacts
94+
- [ ] Quarantine or withdraw suspicious outputs where possible
95+
96+
97+
## Investigation
98+
99+
### Key Questions
100+
101+
- [ ] What was the initial access path: CI platform, repository permissions, runner compromise, or stolen token?
102+
- [ ] What permissions did the compromised pipeline actually have?
103+
- [ ] Were secrets exposed only to logs/runtime, or used to publish or deploy?
104+
- [ ] Which environments were reachable: build only, staging, production?
105+
- [ ] Which outputs must now be treated as untrusted?
106+
107+
### Information to Gather
108+
109+
| Data | Source |
110+
|------|--------|
111+
| CI audit logs | CI/CD platform |
112+
| workflow/config diffs | repository history |
113+
| release/deployment history | CI/CD platform, cloud provider, registry |
114+
| artifact digests / provenance | registry, signing system, artifact store |
115+
| runner access and execution logs | runner host / CI platform |
116+
117+
118+
## Containment and Recovery
119+
120+
### Option A: Rebuild from a known-good commit using a clean pipeline
121+
122+
**When:** You can identify a trusted commit and re-establish a trusted build path.
123+
**Impact:** Release cadence slows, but trust is restored more safely.
124+
125+
1. Stand up a clean pipeline or isolated builder
126+
2. Re-verify repository state and workflow definitions
127+
3. Rebuild from a known-good commit
128+
4. Compare output metadata against expected source and release intent
129+
5. Redeploy only from the rebuilt trusted output
130+
131+
### Option B: Roll back to last known-good release
132+
133+
**When:** A trusted prior release exists and rollback is operationally safe.
134+
**Impact:** Feature loss or temporary service degradation may occur.
135+
136+
1. Identify the last trusted artifact and deployment
137+
2. Roll back affected services
138+
3. Verify rollback success in production
139+
4. Continue investigation before resuming normal release flow
140+
141+
### Option C: Keep service paused until trust is re-established
142+
143+
**When:** You cannot distinguish clean from compromised outputs.
144+
**Impact:** Operational disruption, but lower risk of serving malicious artifacts.
145+
146+
1. Pause releases/deployments
147+
2. Communicate impact internally and externally as needed
148+
3. Rebuild trust in source, pipeline, credentials, and artifacts before resuming
149+
150+
151+
## Verification Before Resuming
152+
153+
Do not resume normal delivery until you can answer these clearly:
154+
155+
- [ ] The initial access path is understood well enough to prevent immediate recurrence
156+
- [ ] Compromised credentials have been rotated or invalidated
157+
- [ ] Untrusted artifacts and releases have been identified and handled
158+
- [ ] Build and deploy permissions are re-scoped appropriately
159+
- [ ] A known-good artifact has been rebuilt or a known-good release has been restored
160+
161+
162+
## Hardening After the Incident
163+
164+
- [ ] Separate build permissions from deploy permissions
165+
- [ ] Require stronger approval controls for workflow and release changes
166+
- [ ] Use short-lived credentials where possible
167+
- [ ] Reduce secret exposure to only the jobs that need them
168+
- [ ] Restrict or harden self-hosted runners if used
169+
- [ ] Improve artifact provenance, signing, and release verification
170+
56171

57-
## Mitigation
172+
## Escalation
58173

59-
1. [ ] Audit CI/CD configuration for unauthorized changes
60-
2. [ ] Rebuild from trusted commit using clean pipeline
61-
3. [ ] Implement additional approval requirements
62-
4. [ ] Review and restrict pipeline permissions
174+
Escalate immediately if:
175+
- [ ] production deployments may have been modified
176+
- [ ] signing keys or release credentials may be exposed
177+
- [ ] user-facing artifacts may have been maliciously published
178+
- [ ] the pipeline had access to broader cloud or infrastructure credentials
63179

64-
## Prevention
180+
See [Contacts](../contacts) and [Incident Response Policy](../incident-response-policy).
65181

66-
- [ ] Require approval for CI/CD config changes
67-
- [ ] Use short-lived credentials
68-
- [ ] Implement branch protection
69-
- [ ] Audit pipeline access regularly
70-
- [ ] Use signed commits
71-
- [ ] Separate build and deploy permissions
72182

73183
## Related
74184

docs/pages/incident-management/incident-response-template/runbooks/dependency-attack.mdx

Lines changed: 112 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Runbook: Dependency Attack | Security Alliance"
3-
description: "Stub runbook. Customize with your package management and build procedures."
3+
description: "Example runbook for dependency compromise. Review and customize for your package manager, build flow, and release process before use."
44
tags:
55
- Security Specialist
66
- Operations & Strategy
@@ -21,7 +21,7 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
2121
<TagList tags={frontmatter.tags} />
2222
<AttributionList contributors={frontmatter.contributors} />
2323

24-
> **Stub runbook.** Customize with your package management and build procedures.
24+
> **This is an example runbook.** Review and customize for your package manager, dependency policy, and build procedures before use.
2525
2626
## Quick Reference
2727

@@ -38,41 +38,128 @@ import { TagList, AttributionList, TagProvider, TagFilter, ContributeFooter } fr
3838

3939
- [ ] Unexpected behavior after dependency update
4040
- [ ] Security advisory for a package you use
41-
- [ ] Malicious code found in node_modules or similar
42-
- [ ] Lockfile changes you didn't make
41+
- [ ] Malicious code found in installed dependencies or build output
42+
- [ ] Lockfile changes you did not expect
43+
- [ ] Frontend bundle or released artifact changed more than the source diff would explain
4344

44-
### Confirm Dependency Attack
45+
### Scope Questions
4546

46-
```
47-
npm audit
48-
# or
49-
yarn audit
50-
```
47+
- Did the malicious dependency reach production, or is this still limited to source/build environments?
48+
- Was the dependency executed only during build time, or also in user-facing runtime code?
49+
- Did the dependency have access to CI secrets, registry tokens, or signing material?
50+
- Were any artifacts published or deployed during the exposure window?
5151

52-
Check for recent lockfile changes in git history.
52+
### Differentiation
53+
54+
- If the compromised package was only introduced through your CI/build path, also review [Build Pipeline Compromise](./build-pipeline-compromise)
55+
- If the issue is malicious code being served to users, also review [Frontend Compromise](./frontend-compromise)
56+
- If this is only an advisory on an unused code path, severity may differ from an actively weaponized package
5357

5458
## Immediate Actions
5559

56-
1. [ ] Take down site to stop serving malicious code
57-
2. [ ] Identify the malicious package
58-
3. [ ] Pin dependencies to last known good version
59-
4. [ ] Rebuild from clean environment
60+
### Step 1: Freeze releases that rely on the affected dependency
61+
62+
**Why:** Prevent additional malicious artifacts from being built or published.
63+
64+
- [ ] Pause affected builds and deployments
65+
- [ ] Stop package publishing if your pipeline republishes downstream artifacts
66+
- [ ] Block dependency auto-update jobs until scope is understood
67+
68+
### Step 2: Identify the exact bad package/version path
69+
70+
**Why:** You need a precise package, version, and introduction path before you can cleanly contain it.
71+
72+
- [ ] Record package name and version
73+
- [ ] Identify whether it is direct or transitive
74+
- [ ] Identify which commits or lockfile changes introduced it
75+
- [ ] Determine whether multiple repos or services consume it
76+
77+
### Step 3: Stop trusting recent outputs
78+
79+
**Why:** If malicious code ran during build or packaging, recent artifacts may be untrusted even if source looks clean.
80+
81+
- [ ] Identify builds created during the exposure window
82+
- [ ] Identify deployed versions and published packages that include the dependency
83+
- [ ] Quarantine or withdraw suspicious outputs where possible
84+
85+
### Step 4: Preserve evidence
86+
87+
**Why:** Registry state, lockfiles, and CI evidence can change quickly.
88+
89+
- [ ] Save lockfile and manifest versions from affected builds
90+
- [ ] Save CI logs and artifact metadata
91+
- [ ] Record package tarball hashes, integrity values, and registry metadata where available
92+
93+
## Investigation
94+
95+
### Key Questions
96+
97+
- [ ] Was the package actually malicious, or just vulnerable?
98+
- [ ] Was the malicious code executed in your environment?
99+
- [ ] Did it affect build-time systems, runtime users, or both?
100+
- [ ] Were secrets, signing credentials, or deploy tokens exposed?
101+
- [ ] Which artifacts or releases must now be treated as untrusted?
102+
103+
### Information to Gather
104+
105+
| Data | Source |
106+
|------|--------|
107+
| package/version metadata | registry, lockfile, manifest |
108+
| introduction point | git history, dependency bot PRs |
109+
| build logs | CI/CD platform |
110+
| deployed artifacts using bad dependency | release history, artifact store |
111+
| advisories / upstream incident details | package registry, maintainer advisories |
112+
113+
114+
## Containment and Recovery
115+
116+
### Option A: Revert to the last known-good dependency state
117+
118+
**When:** A trusted prior lockfile/package set exists.
119+
**Impact:** Fastest path in many cases.
120+
121+
1. Revert the dependency or lockfile to a known-good state
122+
2. Rebuild from a clean environment
123+
3. Verify the bad package is no longer present in the output
124+
4. Redeploy only after validating the resulting artifact
125+
126+
### Option B: Replace or remove the affected package
127+
128+
**When:** A clean replacement exists, or the package is non-essential.
129+
**Impact:** May require code changes or degraded functionality.
130+
131+
1. Remove or replace the affected package
132+
2. Regenerate lockfile carefully
133+
3. Rebuild from a clean environment
134+
4. Validate both functionality and resulting dependency tree
135+
136+
### Option C: Keep service paused until trust is re-established
137+
138+
**When:** You cannot clearly determine which artifacts are clean.
139+
**Impact:** Operational disruption, but lower chance of serving malicious code.
140+
141+
1. Pause affected deployments
142+
2. Reconstruct a trusted dependency set
143+
3. Rebuild from a clean environment
144+
4. Resume only after verifying outputs and rotation of any exposed credentials
145+
60146

61-
## Mitigation
147+
## Verification Before Resuming
62148

63-
1. [ ] Remove or replace malicious package
64-
2. [ ] Update lockfile with known good versions
65-
3. [ ] Rebuild using `npm ci` or `yarn --frozen-lockfile`
66-
4. [ ] Redeploy verified build
149+
- [ ] The malicious or suspect dependency is removed from the build
150+
- [ ] A clean rebuild has been produced from a trusted environment
151+
- [ ] Any exposed credentials have been rotated
152+
- [ ] Suspicious builds, releases, or packages have been identified and handled
153+
- [ ] The resulting artifact has been checked against expected changes
67154

68155
## Prevention
69156

70157
- [ ] Use lockfiles and commit them
71-
- [ ] Use `npm ci` / `yarn --frozen-lockfile` in CI
72-
- [ ] Regularly audit dependencies
73-
- [ ] Consider using a private registry
74-
- [ ] Pin exact versions for critical packages
75-
- [ ] Review dependency changes in PRs
158+
- [ ] Use deterministic install commands in CI (`npm ci`, `pnpm install`, `yarn install --immutable`, etc.)
159+
- [ ] Review dependency and lockfile changes in PRs
160+
- [ ] Restrict who can approve dependency update automation
161+
- [ ] Audit critical dependencies and minimize unnecessary package surface area
162+
- [ ] Treat build-time dependencies as part of the production attack surface
76163

77164
## Related
78165

0 commit comments

Comments
 (0)