Skip to content

fix: reject malformed RTK rewrite output - #12

Open
pawcio25 wants to merge 1 commit into
ogallotti:mainfrom
pawcio25:fix/reject-malformed-rtk-output
Open

fix: reject malformed RTK rewrite output#12
pawcio25 wants to merge 1 commit into
ogallotti:mainfrom
pawcio25:fix/reject-malformed-rtk-output

Conversation

@pawcio25

Copy link
Copy Markdown

Summary

  • Reject malformed rtk rewrite stdout containing embedded newlines, carriage returns, or NUL bytes.
  • Keep the plugin fail-open by leaving the original command unchanged when malformed rewrite output is seen.
  • Add a malformed_output metric and redacted warning so operators can diagnose the event without leaking command text.
  • Document the graceful degradation behavior and add changelog entry.

Why

Hermes passes terminal commands to a shell. If RTK ever emits diagnostic text, corrupted output, or a multi-line command on stdout, applying the whole string as the rewritten terminal command could execute unintended extra shell statements. This hardens the boundary between RTK stdout and Hermes command execution while preserving existing behavior for normal single-line rewrites with trailing whitespace.

Test Plan

  • python -m pytest
  • python -m build
  • python -m twine check dist/*

Local result: 61 passed; both wheel and sdist passed twine check.

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