Skip to content

Audit what an exec's command did - #146

Merged
andrelcunha merged 1 commit into
devfrom
fix/exec-audit
Oct 28, 2026
Merged

andrelcunha merged 1 commit into
devfrom
fix/exec-audit

Conversation

@andrelcunha

Copy link
Copy Markdown
Member

Closes #141, found by the otter_cloud contract test against v0.17.1.

The bug

POST /api/jails/{name}/exec was audited through the generic step logger. That records only Jail Deck's own failure to run a command. So an exec that ran was always written as success: true, exit_code: 0, with no timed_out, whatever the command did. The audit log couldn't say a command failed or was killed, which is the one question exec is audited to answer.

The fix

  • A command that ran is still a successful entry, as JD-016 says (a non-zero exit is a 200). It now carries the command's own exit_code, timed_out and duration_ms.
  • A command that couldn't run is audited exactly as before: a failed entry with the error.
  • The endpoint's docs say so, and the audit entry's field comment now notes that duration_ms appears on exec entries too.

Checked

  • A new test covers a non-zero exit, a timeout, and exit 0, and asserts the entry, not the response. All three cases fail against the old code and pass now.
  • make check passes.

The audit output changes for exec entries; the next release's CHANGELOG will say so under API.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrelcunha
andrelcunha merged commit ee95630 into dev Oct 28, 2026
@andrelcunha
andrelcunha deleted the fix/exec-audit branch October 28, 2026 21:38
This was referenced Oct 28, 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.

Exec's audit entry records exit_code 0 and no timed_out, whatever the command did

1 participant