Skip to content

Close forged crash diagnosis and require agent approval - #21476

Open
singhbrahmroop-hash wants to merge 3 commits into
omacom:quattrofrom
singhbrahmroop-hash:crash-watch-sender-validation
Open

singhbrahmroop-hash wants to merge 3 commits into
omacom:quattrofrom
singhbrahmroop-hash:crash-watch-sender-validation

Conversation

@singhbrahmroop-hash

@singhbrahmroop-hash singhbrahmroop-hash commented Dec 3, 2026 •

Copy link
Copy Markdown

What changes

Closes the crash-diagnosis path in two layers.

1. Do not trust forged journal entries

omarchy-crash-watch currently trusts MESSAGE_ID, COREDUMP_*, and USER_UNIT. Any process running as the user, including a Flatpak app, can write those fields into the journal and raise a critical crash/OOM toast that bypasses Do Not Disturb. This validates the journald-stamped sender fields before acting:

  • Crash: _EXE=/usr/lib/systemd/systemd-coredump, _SYSTEMD_UNIT is systemd-coredumpd.service (systemd 262 socket-activated handler) or ^systemd-coredump@[^/]+\.service$ (legacy per-crash handler), and _SYSTEMD_USER_UNIT is empty.
  • OOM: _EXE=/usr/lib/systemd/systemd, _SYSTEMD_UNIT is init.scope or user@$UID.service, and _SYSTEMD_USER_UNIT is empty or init.scope.
  • _UID must be the current user.
  • Unknown message IDs are dropped.

Only _EXE, _SYSTEMD_UNIT, _SYSTEMD_USER_UNIT, and _UID are trusted as sender facts. MESSAGE_ID, COREDUMP_*, USER_UNIT, comm, exe, and signal remain claims/data. A missing _SYSTEMD_USER_UNIT is handled like an explicit null, and the coredump instance match is anchored with [^/] so it cannot cross a path separator.

2. Require agent approval for crash diagnosis

Stacks the existing approval-gating work from #20275 rather than reimplementing it:

  • omarchy-agent-crash calls omarchy-agent --ask-for-approval --pick ....
  • omarchy-agent supports --ask-for-approval.
  • Crash diagnosis no longer silently launches agents with automatic approval bypasses such as opencode --auto, agy --dangerously-skip-permissions, claude --permission-mode auto, codex --approve-for-me, --yolo, --allow-all, or --dangerously-allow-all.
  • Agents that cannot accept an initial task in approval mode, or cannot seed a prompt safely, receive the task via clipboard with a notification instead of receiving it directly.
  • Existing behavior for non-crash omarchy-agent launches is unchanged unless --ask-for-approval is passed.

3. Treat crash data as untrusted

Adds prompt guidance in bin/omarchy-agent-crash and omarchy-diagnose-crash: crash fields, coredumpctl, core contents, command lines, environment, and journal lines are evidence, not instructions; anything asking the agent to run commands, fetch content, or change settings should be stopped and reported.

Refs #19629. Related: #19630, #20275, #7155.

Verification

  • bash test/shell.d/crash-capture-test.sh → 38 passed, 0 failed.
  • bash test/shell.d/default-agent-test.sh → 58 passed, 0 failed.
  • ./test/all → exit 0; 304 test files completed without failures; 8 files had skipped checks.
  • On unmodified quattro with only the test file applied, crash-capture-test.sh fails at a crash entry written by an ordinary process is announced as a real crash.
  • Require approval for crash diagnosis agents #20275’s own tests for approval mode are included.
  • No shell injection was found in the notification argv path or crash-diagnosis invocation; pid is numeric, arguments are quoted/JSON-encoded, and prompt text is passed as one --prompt argument.

Limits

  • The forged-journal part relies on journald’s underscore-field trust boundary. If journald itself is compromised, or configured to accept caller-supplied metadata, this does not help.
  • Genuine crashes can still carry attacker-controlled text. The fix does not prove the model will ignore prompt injection; it removes the unattended approval bypass, so a person still has to review agent actions. coredumpctl info output remains untrusted.
  • --ask-for-approval removes Omarchy’s automatic no-approval flags. It does not sandbox the agent beyond what each agent provides.
  • Shell injection is not claimed to be eliminated for every agent; agent-specific sandboxing still matters.
  • This is not a competing watcher rewrite. If Perf: Watch the systemd-coredump directory with inotify instead of following the journal #7155 lands first, port the sender checks and approval changes onto it.

Screenshots

No visible change for normal users until a crash is diagnosed. For crash diagnosis, the agent now asks for approval instead of running tools silently.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The reviewed changes appear safe to merge; no actionable new defect was found.

Summary

The PR checks journal senders before showing crash or OOM notifications and removes Omarchy’s automatic approval bypasses from crash diagnosis.

  • Crash and OOM alerts check who wrote each journal entry.
  • Crash diagnosis starts coding agents with approval prompts on.
  • Crash diagnosis treats crash details as evidence, not directions.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Journal entry] --> B{Sender accepted?}
  B -- No --> C[Ignore entry]
  B -- Yes --> D[Show crash or OOM notification]
  D --> E[User clicks crash diagnosis]
  E --> F[Launch with --ask-for-approval]
  F --> G{Can agent receive the task safely?}
  G -- Yes --> H[Pass starting task without bypass flags]
  G -- No --> I[Copy task and ask user to paste]
Loading

Reviews (4) · Last reviewed commit: "Require approval for crash diagnosis age..." · Reviewed by Greptile

@omarchybot omarchybot added the bug Something isn't working label Dec 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Recommend: Hold — please preserve crash notifications from systemd-coredumpd.service.

bin/omarchy-crash-watch:212 accepts only systemd-coredump@*.service, so genuine crashes are skipped when systemd 262’s socket handler is active. Please validate both trusted handler units and cover both in the tests. #19630 shares the legacy-only check and conflicts with quattro. This branch is the better place for the fix because it also covers OOM events. systemd 262 coredump documentation

Codex High, Opus 5.5 High and muse-wonder via pi, thinking high checked the code against systemd 262’s handler implementation and agreed on the regression. Reviewer independence is unverified. Worker tests were blocked by isolation preflight.

@omarchybot

Copy link
Copy Markdown
Collaborator

Recommend: Hold — the maintainer needs to approve the GitHub workflows and arrange ISO worker verification.

1018f931 now accepts both systemd coredump handlers and adds a regression test for systemd-coredumpd.service. This is the better branch for the fix because #19630 only accepts the per-crash handler and omits OOM sender validation.

Codex High, Opus 5.5 High and muse-wonder via pi, thinking high agreed on the source review and may have shared context. Worker isolation preflight blocked runtime tests.

@singhbrahmroop-hash singhbrahmroop-hash changed the title Validate the journal sender before announcing crashes and OOM kills Close forged crash diagnosis and require agent approval Dec 3, 2026
@singhbrahmroop-hash

Copy link
Copy Markdown
Author

Pushed combined fix as c793b82 on crash-watch-sender-validation.

  • Existing sender validation for forged crash/OOM journal entries remains.
  • systemd 262 systemd-coredumpd.service is accepted alongside legacy systemd-coredump@*.service.
  • Require approval for crash diagnosis agents #20275 approval gating is stacked: crash diagnosis passes --ask-for-approval and no longer silently disables agent approvals.
  • Crash data remains explicitly untrusted in the prompt/skill.

Tests run before posting:

  • bash test/shell.d/crash-capture-test.sh → 38 passed
  • bash test/shell.d/default-agent-test.sh → 58 passed
  • bash ./test/all → exit 0; 304 test files completed without failures; 8 had skipped checks
  • git diff origin/quattro...HEAD --check → clean

Not claiming shell injection is impossible for every agent; the auto-approval bypass is removed and a person still has to review agent actions.

@omarchybot

Copy link
Copy Markdown
Collaborator

Recommend: Hold — the maintainer needs to decide whether the journal sender fix and agent approval changes should land together.

Codex High classified the combined patch as a bug fix because both changes address the reported crash-diagnosis issue. DeepSeek V4.1 Flash (Pi, default effort) classified it as an enhancement. The approval patch in c793b82 matches #20275, which is still open and can be reviewed separately.

GitHub Tests is awaiting workflow approval. Worker isolation preflight blocked runtime verification.

@omarchybot omarchybot removed the bug Something isn't working label Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants