Forge-controlled text reaches the console unsanitized through the gh and glab adapters #469
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#469
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found triaging IW-437 (noticed during phase 2 code review, while hardening the Forgejo HTTP path).
WHAT. GitHubClient.createPullRequest (core/adapters/GitHubClient.scala:688-712) and GitLabClient.createMergeRequest (core/adapters/GitLabClient.scala:568-592) pass the raw stderr of gh and glab into ForgeCreateError.Other with no filtering and no length limit. That message travels through PhasePr.createPrAndGate (core/commands/PhasePr.scala:121-125) to System.err.println in LiveConsole.err (core/commands/LiveCommandEnv.scala:61).
THE ASYMMETRY. ForgejoClient.bodySnippet strips control characters and bidirectional formatting characters and caps the length of an HTTP response body. The two CLI adapters apply no equivalent to the subprocess stderr they forward. So a remote whose branch name, title or error text carries an ANSI escape or a right-to-left override can still reorder or repaint what iw phase-pr prints - through the CLI path rather than the HTTP path.
THE GENERAL POINT. Text that a forge controls reaches the console through EVERY transport an adapter uses, so a sanitizer placed on one transport leaves the others open.
PROPOSED FIX. One shared sanitizer applied to every forge-controlled string an adapter forwards to the console: the gh and glab stderr paths as well as the Forgejo response body. Extracting the existing bodySnippet logic is the obvious starting point.
PRE-EXISTING. Nothing in IW-437 introduced the CLI path or changed how it forwards stderr; phase 2 was scoped to the Forgejo create-pull-request fall-through.
Intake: agent-ready
Workflow: diagnostic
Reason: all gates passed
Analysis: project-management/issues/IW-469/analysis.md on branch IW-469
Implement: needs-human
Reason: batch-implement exit 1 — the kanon plugin did not compile against the iw-cli core of this branch, so no phase ran.
fetchPullRequestForBranchnow returnsEither[TrackerError, …](iw-cli #778), and the installed kanon plugin (lib/batch/ForgeCatchUp.scala) still expectsEither[String, …]. The issue itself is not at fault: update the kanon plugin, then release the issue toagent-readyagain. batch-implement.log was not written; the lines below are the command output.Release: the implement loop failed this issue for a reason outside it. The kanon plugin did not compile against iw-cli main, because the tracker port now returns TrackerError (iw-cli #778). The plugin fix is dev-docs #484, and iw-cli 0.22.1 carries the core change. The issue goes back to the implement loop.