Skip to content

fix: server robustness for dmesg grep, handler panics, exec cancellation and MPA expiry - #646

Open
sfc-gh-pkowalewski wants to merge 5 commits into
mainfrom
pkowalewski/robustness-fixes
Open

sfc-gh-pkowalewski wants to merge 5 commits into
mainfrom
pkowalewski/robustness-fixes

Conversation

@sfc-gh-pkowalewski

@sfc-gh-pkowalewski sfc-gh-pkowalewski commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

A few robustness fixes in the server:

  • SysInfo.Dmesg compiles the grep pattern up front and returns InvalidArgument for one that doesn't parse, the same way LocalFile.Read already does.
  • The server now recovers from handler panics, logging them and returning Internal for that request instead of exiting.
  • Exec runs commands in their own process group and kills the whole group when the request is cancelled, so background processes don't outlive the call or hold its output pipes open.
  • MPA actions expire based on when they were stored. Approving an action used to reset its age, so repeated approvals could keep it around indefinitely.

Compile the grep expression before reading kernel messages and return
InvalidArgument when it doesn't parse, matching LocalFile.Read.
Install unary and stream interceptors at the front of the chain that turn a
panic into an Internal error and log it, so one bad request fails on its own
instead of taking the server down.
Exec now starts commands in their own process group and, when the request
context is done, kills the whole group. Previously only the direct child was
killed, so anything it had started kept running and could hold the output
pipes open well past the deadline.
Approve used to reset the action's timestamp, so repeated approvals kept an
action from ever reaching maxMPAApprovedAge. Track the creation time instead
and use it for both expiry and eviction.
…cancellation

RunCommand now kills the group on cancellation even after the direct child
has exited, so processes it left in the background can't keep Run waiting on
their output. Killing a group that no longer exists reports os.ErrProcessDone.
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.

1 participant