Harden autopilot steers against prompt injection; fix scrollback flush flash#294
Merged
Merged
Conversation
|
[PR TITLE LINT] PR title does not follow Conventional Commits format. Please update your PR title to follow Conventional Commits format: Allowed types: Examples: You can edit the title at the top of this PR. |
|
[REVIEW NOTIFIER] This PR requires a review from @ldpliu. Once this PR has been reviewed and has the |
|
[REBASE NOTIFIER] Hi @yanmxa! This PR has merge conflicts. The How to fix thisresolve the conflicts — Fix the merge conflicts locally, then push the resolved changes. After fixing:
|
Harden the autopilot steers (Permission, Bash, Question, turn-end continue) against prompt injection from untrusted content: - Compose every steer's system prompt as an immutable control-plane policy plus the user's steering instructions, with the policy in the recency slot and forged <steering_instructions> delimiters stripped, so a shared preset or systemPromptFile can't weaken the trust boundaries. - Render untrusted payloads (tool args, transcripts, questions, bash prompts) as JSON data envelopes through one shared reviewer.RenderDataEnvelope; json.Marshal escapes <, >, & so payload values can't forge the delimiters. - Sanitize bash-prompt answers to a single bounded line and validate the turn-end continue/done/stop decision as a strict state machine. - Feed recent tool results and compact summaries into the continue decision's evidence window, with a tighter per-tool-result cap. - Rename the user-facing "System Prompt" to "Steering Prompt" to reflect that it tunes how the copilot drives without replacing the policy. Signed-off-by: Meng Yan <yanmxa@gmail.com>
Replace the fixed print delay (which briefly left a just-committed block in neither the live view nor native scrollback — the blank-frame flash at the end of a render) with a handoff copy kept in the managed view until the block's tea.Println has been processed. Monotonic ids keep concurrent handoffs ordered. Signed-off-by: Meng Yan <yanmxa@gmail.com>
12e4ab5 to
b2d609b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two unrelated changes, bundled at author request (see the two commits).
Autopilot steer hardening
Guards the autopilot LLM steers (Permission, Bash, Question, turn-end
continue) against prompt injection from untrusted content:
plus the user's steering instructions — policy in the recency slot, forged
</steering_instructions>delimiters stripped — so a shared preset orsystemPromptFilecan't weaken the trust boundaries.prompts) through one JSON data envelope (
reviewer.RenderDataEnvelope);json.Marshalescapes<,>,&, so values can't forge the delimiters.continue/done/stop decision as a strict state machine.
Scrollback flush fix
Removes the blank-frame flash at the end of a streamed render by keeping a
committed block visible in the managed view until its
tea.Printlnintonative scrollback has been processed; monotonic ids keep concurrent handoffs
ordered.