Skip to content

Pls trust only crash entries written by systemd-coredump - #19630

Open
Edward-cmyk wants to merge 1 commit into
omacom:quattrofrom
Edward-cmyk:crash-watch-trust-coredump-only
Open

Edward-cmyk wants to merge 1 commit into
omacom:quattrofrom
Edward-cmyk:crash-watch-trust-coredump-only

Conversation

@Edward-cmyk

Copy link
Copy Markdown

What changes

Fixes #19629.

omarchy-crash-watch announced any journal entry with the core-dump MESSAGE_ID and the user's UID. Any process can write those fields (Flatpak apps get the journal socket by default), so a forged entry put up a critical, Do-Not-Disturb-bypassing "Process crashed" toast. One click then handed its text to an agent launched with approvals off. Details are in the issue.

  • bin/omarchy-crash-watch: only entries whose _EXE is /usr/lib/systemd/systemd-coredump and whose _SYSTEMD_UNIT matches systemd-coredump@*.service are announced. journald stamps both fields from the sender's process and cgroup, so the sender can't set them. Running systemd-coredump from the user's own session doesn't pass either, because the unit then is user@UID.service.
  • bin/omarchy-agent-crash: the prompt now tells the agent that the process name, binary and everything from coredumpctl or the core came from the crashed program. It must treat them as evidence, not instructions, and stop and tell the user if any of it reads like a request.
  • omarchy-diagnose-crash skill: a short "Crash data is untrusted" section with the same rule, plus: never paste crash fields into a shell unquoted.

Not in this PR: crash diagnoses still launch with each agent's approval-skipping flags. Changing that touches every agent in omarchy-agent, so it should be a separate change.

Verification

  • test/shell.d/crash-capture-test.sh: the existing fixture now carries the _EXE/_SYSTEMD_UNIT of a real entry, and three new cases pass. An entry forged by an ordinary process gets no toast; systemd-coredump run from the user session gets no toast; a forged entry doesn't stop the real crash after it from being announced. All 31 cases pass. Against the old watcher, the first new case fails.
  • test/shell.d/provision-user-test.sh (references the skill) passes.
  • Real data: the three most recent genuine core dumps in my journal (Omarchy 4.5.0-3) all pass the new filter, with _EXE=/usr/lib/systemd/systemd-coredump and _SYSTEMD_UNIT=systemd-coredump@<n>-<…>.service, and still produce their toast.
  • Not checked: the full ./test/all run; other distros' systemd-coredump paths (Omarchy is Arch-only).

Screenshots

No visible change: genuine crash toasts look the same; forged ones no longer appear.

omarchy-crash-watch announced any journal entry carrying the core-dump
MESSAGE_ID and this user's UID. Any process can write those fields, a
Flatpak app included, so a forged entry put up a critical "Process
crashed" toast that bypasses Do Not Disturb, and one click handed its
text to an agent launched with approvals off.

Require the journald-stamped _EXE and _SYSTEMD_UNIT of the system's
systemd-coredump service, which a sender cannot set. Tell the agent, in
the prompt and in the skill, that crash data is untrusted input.
@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

This PR limits crash notifications to entries sent by systemd-coredump.

  • The crash watcher only announces entries from the system crash handler.
  • Crash diagnoses treat dump contents as untrusted evidence.

No actionable issues were found. The full test suite was not run during this review.

Reviews (2) · Last reviewed commit: "Trust only crash entries written by syst..." · Reviewed by Greptile

@Edward-cmyk Edward-cmyk changed the title Trust only crash entries written by systemd-coredump Pls trust only crash entries written by systemd-coredump Nov 21, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 High in Codex read the diff, the existing crash watcher and diagnosis entry point, their callers, and #19629. I classify this as a bug fix, but the configured classifier, deepseek-v4p1-flash, returned no usable answer, so the required classification remains unresolved. No second opinion reviewed the implementation, no tests ran, and no changes were pushed. Verification awaits a completed classification; there is nothing requested from the author at this stage.

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 High in Codex checked this diff against current quattro, and Opus 5.5 High reviewed the two approaches. #7155 already ties crash events to individual coredump service runs, so I’ve queued the crash-data guidance from this PR for #7155. #20275 separately adds approval prompts to crash diagnosis.

This branch conflicts with the out-of-memory watcher changes in #20446. A conflict resolution needs to keep sender validation on the crash path and update the crash fixtures in the out-of-memory tests. This was a source review. Worker verification against current quattro is pending, and GitHub marks the Tests and translation workflows as requiring action. The choice between the two fixes is with the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

2 participants