Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/incidents.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pipeline still calls it there.
| am. `am_description_from_the_head` | A dependency security run's pull request had the right code after a review round and the wrong description. Its table still showed the plan (five packages as major version jumps the final manifest no longer makes, a headline counting twenty major versions), its count of fixed advisories had never been compared with the final lockfile, the round that fixed the code wrote that it could not edit the description and left the corrections to a person, and the repository's second app (a CMS studio no CI job builds) took a package an override moved to a new major and was never built. | The description is a function of the head. A dependency pull request's table and headline are what the lockfile on the head resolves compared with the base branch; an advisory counts as fixed only at or past its patched version; what can't be read is said as not known and the plan is marked as a plan. Every write of a description goes through `description::save`, every path that moves the head rebuilds it through `description::head_moved`, and a round's sentence that hands the description to a person is taken out and becomes the rebuild. A sentence a run writes into a file that says a check passes needs that check's recorded passing result, or it is taken out. Every workspace project that takes a changed package line is built when its manifest declares a build, CI job or not; a project that can't be proven in the sandbox is named with why, and a build only the bumps break feeds the take-out. |
| an. `an_six_database_findings` | Security, Infrastructure showed six database findings, every one a one-command runbook with no pull request although the databases were in the team's code. The same CVE stood on an operating system update, an Aurora PostgreSQL patch and a MySQL upgrade. A database with a Terraform-generated identifier and an Aurora cluster defined through a module were "not found in code". A patch and an upgrade pending on one cluster were unrelated rows, an update on a second instance was dropped, and the account was read one page deep. | An advisory is attached only where it applies (service, engine, version range, kind of action, date); an action AWS publishes with no CVE list gets none. An action is named for what it means on its ARN. One database's pending actions are one ordered set of rows. The defining code is found from stack records, resource type and attributes, module calls and variable files, graded, and a guess never becomes a pull request. An update with a code equivalent is a pull request on the line that sets the value; one that cannot be expressed in code stays a complete runbook and says why. A change that would replace a database is refused. |
| ao. `ao_stopped_log_finding` | Two log findings of one production service stayed on the Logs page as Critical and New, each with "Create fix PR" and "Not started automatically: not sure the repo is ...; check it and start the fix", a day and a half after their error had stopped: 735 matching lines in one six-hour window, then none while the service wrote its usual volume. The team had fixed the cause the day before. Only time closed a finding (three days without a line), so a problem that was over read as a live emergency that needed a person. | Every analysis counts each open finding's own lines on its own log group and keeps the count with the lines the group wrote. Two analyses in a row with no matching line at the service's usual volume make the finding stopped: shown and counted as stopped, never New or a live critical, with no automatic fix and no stale "choose a repo" reason. When the service itself went quiet nobody can tell, and it stays as it was. A burst that stopped after a change in its repo resolves after one day instead of three, with that evidence in the reason; an error that keeps coming back keeps its longer period. Seen again, it is live again and its fix may start. Evidence for the repo that couldn't be weighed is weighed again next sweep and never put to a person. |
| ap. `ap_closed_pr_keeps_findings` | An admin closed CoderHelm's dependency fix pull request for a repository to start again and cancelled its fix run. On the Security page every checkbox for that repository was off, the header's too, with nothing to say why: 274 findings still read "in a pull request" a day later. The pull request webhook recorded the close on the run and never told the findings, cancelling a run wrote only the run, and the one comparison with GitHub was the last step of the scheduled sweep, behind the time every team's sources and triage left, reading a failed request as "still open". | A finding is `pr_open` only while its pull request is open and `fixing` only while its run works (`common::security_release`). A pull request closed unmerged gives its findings back with who closed it and when, a cancelled or closed run releases what it claimed, a reopened pull request takes its findings back, and a merge fixes them: on the webhook or the person's action, and again on every sweep, first for each team and on a clock of its own, bounded and in turn, so a missed webhook and records stale from before heal within a sweep. A person asking for a fix always gets one; automatic fixes wait a week after a person said no. Retry on the run is a new request from the findings as they are now and opens a new pull request. GitHub not answering is never read as open, closed or merged. |
| ba. `ba_verdict_on_old_commit` | A run finished as Done with its pull request ready while its own reviewer stood at "Changes requested" on a commit older than the head, and the run page said a person was needed and that merging was the team's call. The last fix was pushed, and the wake-up that found CI green with no event to read completed the run through an ending that skips the review step, so the new head was never reviewed. | Every completion and the sweep look at the finished run's pull request (`pr_watch`): no reviewer verdict on the head asks for the review of that commit, once per head; changes requested on the head get their fix round, and when the run's rounds are over the findings are deferred on the pull request with the reason. The run page names the one true reason the pull request is where it is (`common::merge_standing`) and names a person only for the team's own rule, with where it is set. |
| bb. `bb_flaky_not_broken` | An end-to-end workflow failed on a timeout in a spec the change never touched, as it had on unrelated pull requests that week. The run spent fix rounds editing the spec's timeout and a retry helper. Where the GitHub App may not write Actions, the re-run tried first was refused and the same fix round followed. | Before a CI fix round the failure is judged (`common::flaky_checks`): a failure naming a changed file is the change's; a check with a record of failing and then passing on one commit of other pull requests, naming no changed file, is re-run once and no code changes for it, and the pull request says which check, the evidence and what was done. A refused re-run is said with the permission by name and still changes no code. The record is per repository and learns only from a commit that failed and then passed unchanged. |
| bc. `bc_stays_through_merge_and_deploy` | Pull requests were left as they were after their runs finished: one conflicted after its base moved, one went red a day later on a commit status no event carries, and one merged by a person had its production deploy fail with nothing watching. | A finished run's pull request is looked at on completion and by the sweep: a conflict starts the conflict round once per base commit, red checks not red on the base go to the fix loop once per head, and a merge by anyone gets its merge commit's deploy watched once. A deploy of CoderHelm's own change that fails on checks passing before the merge gets a revert pull request with the failing jobs as evidence, ready for the team's approval and never merged by CoderHelm; files changed again since are never overwritten. |
Expand Down
1 change: 1 addition & 0 deletions services/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub mod reachability;
pub mod review_config;
/// Security fixes: advisories, triage, fix runs and cards (gateway and worker).
pub mod security_fixes;
pub mod security_release;
pub mod settings_index;
/// Setup: the settings registry, the repo analysis, runs, apply and undo.
pub mod setup;
Expand Down
12 changes: 11 additions & 1 deletion services/common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,11 @@ pub struct SecurityEventMessage {
pub team_id: String,
#[serde(default)]
pub installation_id: u64,
/// `dependabot_alert`, `security_advisory`, `push`, `scan` or `fix`.
/// `dependabot_alert`, `security_advisory`, `push`, `scan`, `fix`, or
/// one of the release kinds (`common::security_release`): `pr` (a
/// pull request closed or reopened), `run` (a fix run a person
/// cancelled or closed) and `retry` (a person's Retry of a fix run
/// whose pull request is gone).
pub kind: String,
/// `owner/name`; empty for a scan of every repository.
#[serde(default)]
Expand All @@ -622,6 +626,12 @@ pub struct SecurityEventMessage {
/// `fix`: how the picked findings combine into pull requests.
#[serde(default)]
pub combine: crate::security_fixes::Combine,
/// `pr`: the pull request's number (in `repo`).
#[serde(default, skip_serializing_if = "is_zero_u64")]
pub pr_number: u64,
/// `run` and `retry`: the fix run's ticket (`SEC-...`).
#[serde(default, skip_serializing_if = "String::is_empty")]
pub ticket: String,
}

/// One repository's stale pull request preview (`common::stale_prs`).
Expand Down
47 changes: 42 additions & 5 deletions services/common/src/security_fixes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,16 @@ pub struct PrRef {
/// `open`, `merged` or `closed`.
pub state: String,
pub adopted: bool,
/// Closed without merging: when (`security_release::settle_pr`).
#[serde(skip_serializing_if = "Option::is_none")]
pub closed_at: Option<String>,
/// ...and who closed it: a GitHub login, or the name of the person who
/// closed its run in CoderHelm. None when GitHub does not say.
#[serde(skip_serializing_if = "Option::is_none")]
pub closed_by: Option<String>,
/// A person closed it (false: CoderHelm did, for a reason of its own).
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub closed_by_person: bool,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
Expand Down Expand Up @@ -355,14 +365,19 @@ pub struct FindingState {
pub withdrawn: Vec<String>,
/// The fix run working on it.
pub ticket: Option<String>,
/// When that run was started for it: a run of the ticket that began
/// after this is the one it waits on (`security_release::settle_run`).
pub claimed_at: Option<String>,
/// What the last triage read (so it isn't read twice).
pub triaged: Option<String>,
/// When the last triage ran: verdicts are read again weekly (the code
/// changes; an unchanged read reuses the verdict at no cost).
pub triaged_at: Option<String>,
/// The tier its first card posted at: a later rise to P0 posts again.
pub carded_tier: Option<Tier>,
/// A person closed its pull request unmerged: not opened again until.
/// Its pull request closed unmerged, or its fix run ended without one:
/// automatic fixes don't start again until then. A person asking for a
/// fix never waits on it.
pub hold_until: Option<String>,
pub merged_at: Option<String>,
/// Stages whose card posted (`new`, `half`, `deadline`, ...).
Expand Down Expand Up @@ -2163,7 +2178,9 @@ pub fn requested_units(
st.requested_by.is_some()
&& st.requested_as == combine
&& f.status == Status::Open
&& f.pr.is_none()
// A pull request that closed unmerged is history, not a
// claim: the person asked for a new one.
&& f.pr.as_ref().is_none_or(|p| p.state != "open")
})
.map(|(f, _)| f.id.clone())
.collect();
Expand Down Expand Up @@ -5041,7 +5058,12 @@ pub struct Group {
pub malware: bool,
pub epss: Option<f64>,
pub manifests: Vec<String>,
/// The open pull request a member is in; otherwise the last one (merged,
/// or closed unmerged with who closed it and when).
pub pr: Option<PrRef>,
/// The fix run working on a member (`fixing`) or behind its open pull
/// request, so the dashboard can link to it.
pub ticket: Option<String>,
pub finding_ids: Vec<String>,
pub advisories: Vec<GroupAdvisory>,
}
Expand Down Expand Up @@ -5099,12 +5121,18 @@ fn verdict_rank(v: Verdict) -> u8 {
/// package). Open members decide an open group's tier and due date.
pub fn groups(findings: &[(Finding, FindingState)]) -> Vec<Group> {
let mut by: BTreeMap<String, Vec<&Finding>> = BTreeMap::new();
for (f, _) in findings {
by.entry(group_key(f)).or_default().push(f);
let mut tickets: BTreeMap<String, String> = BTreeMap::new();
for (f, st) in findings {
let key = group_key(f);
if let (Status::Fixing | Status::PrOpen, Some(t)) = (f.status, &st.ticket) {
tickets.entry(key.clone()).or_insert_with(|| t.clone());
}
by.entry(key).or_default().push(f);
}
let mut out: Vec<Group> = by
.into_iter()
.map(|(key, members)| {
let ticket = tickets.get(&key).cloned();
let status = members
.iter()
.map(|f| f.status)
Expand Down Expand Up @@ -5174,7 +5202,13 @@ pub fn groups(findings: &[(Finding, FindingState)]) -> Vec<Group> {
.filter_map(|f| f.advisory.epss)
.max_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal)),
manifests,
pr: members.iter().find_map(|f| f.pr.clone()),
pr: members
.iter()
.filter_map(|f| f.pr.as_ref())
.find(|p| p.state == "open")
.or_else(|| members.iter().find_map(|f| f.pr.as_ref()))
.cloned(),
ticket,
finding_ids: members.iter().map(|f| f.id.clone()).collect(),
advisories,
}
Expand Down Expand Up @@ -7860,6 +7894,7 @@ mod tests {
ci: None,
state: "merged".into(),
adopted: false,
..Default::default()
});
a.1.pr_opened_at = Some("2026-11-10T12:00:00Z".into());
a.1.merged_at = Some("2026-11-11T10:00:00Z".into());
Expand Down Expand Up @@ -7994,6 +8029,7 @@ mod tests {
ci: Some("passing".into()),
state: "open".into(),
adopted: false,
..Default::default()
});
v[5].0.status = Status::PrOpen;
v[6].0.status = Status::Dismissed;
Expand Down Expand Up @@ -8538,6 +8574,7 @@ mod tests {
ci: Some("pending".into()),
state: "open".into(),
adopted: false,
..Default::default()
});
st.bundled = true;
st.ticket = Some("SEC-OPEN".into());
Expand Down
Loading
Loading