Skip to content

fix: randomize the captured output delimiter - #415

Open
MikeeI wants to merge 1 commit into
appleboy:masterfrom
MikeeI:fix/capture-output-delimiter
Open

fix: randomize the captured output delimiter#415
MikeeI wants to merge 1 commit into
appleboy:masterfrom
MikeeI:fix/capture-output-delimiter

Conversation

@MikeeI

@MikeeI MikeeI commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Captured stdout currently uses the fixed multiline delimiter EOF, although a remote command may legitimately emit EOF on a line by itself.
This change creates one randomized Bash-only delimiter per capture and uses it for both framing lines while retaining the streaming tee path.

Evidence

Changes

  • Generate one delimiter from eight underscore-separated Bash $RANDOM components for each capture invocation.
  • Use the same quoted delimiter in the opening and closing GITHUB_OUTPUT lines.
  • Keep the drone-ssh | tee pipeline, live logs, byte ordering, and public stdout output unchanged.

Risks and boundaries

  • $RANDOM is seedable pseudo-randomness, not cryptographic entropy; this removes the deterministic collision but not every theoretical or adversarial collision.
  • GitHub warns that delimiter framing cannot safely represent completely arbitrary content without buffering; this pull request intentionally preserves streaming.
  • Nonzero-pipeline cleanup, output without a final newline, and stderr ownership remain unchanged and outside this correction.

Verification

  • bash -n entrypoint.sh && shellcheck entrypoint.sh && git diff --check — passed.
  • Controlled capture writes vor, EOF, and nach — one randomized framing pair encloses all three lines in order.
  • Controlled executable exits 17 — the unchanged pipefail pipeline still returns 17.

I checked the relevant issues, comments, pull requests, discussions, releases, and capture history; this pull request is not a duplicate.

Disclosure

Investigated thoroughly with GPT-5.6 Codex (high reasoning effort), using Oh My Pi as the agent framework.

This report is not generic or unreviewed AI-generated output. Its claims were checked against the cited evidence, and it includes the relevant detail intended to help maintainers resolve the issue.

If reports like this are not useful to the project, please let me know and I will refrain from submitting similar ones. My intent is to help without wasting maintainer time or energy or discouraging their work.

Thank you for your work.

A standalone EOF line is valid remote stdout, but the runner interprets it as the end of the captured multiline value.

Generate one Bash-only randomized delimiter per capture and use it for both framing lines while preserving the streaming tee pipeline and its failure behavior.
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