safeoutputs: fail fast on invalid stdin JSON payload mode instead of falling through to “no arguments” - #53455
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves safeoutputs diagnostics for malformed stdin JSON payloads.
Changes:
- Fails fast on invalid or non-object JSON payloads.
- Logs captured stdin size and prevents fallback to misleading help.
- Adds focused parser and end-to-end regression tests.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/mcp_cli_bridge.cjs |
Adds payload validation, diagnostics, and early error routing. |
actions/setup/js/mcp_cli_bridge.test.cjs |
Tests invalid payload handling and main-path behavior. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
| parsed = JSON.parse(trimmedStdin); | ||
| } catch (err) { | ||
| const parseError = getErrorMessage(err); | ||
| throw new Error(`stdin is not valid JSON: ${parseError}. JSON payload mode was requested ${isExplicitJsonSentinel ? "with '.'" : "from piped stdin with no flags"}. Pass --key value flags instead, or correct the JSON.`); |
|
Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Review the workflow run logs for details. @copilot please refresh the branch if possible, then run the
Please post a short follow-up describing the fix.
|
|
@copilot Please take another pass on this PR. Refresh the branch if possible, review any unresolved feedback, and run the skill before handing back to maintainers. Run: https://github.com/github/gh-aw/actions/runs/32059494377
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in 35222d3. I updated safeoutputs payload parsing so explicit |
I refreshed against |
|
🎉 This pull request is included in a new release. Release: |
JSON stdin payload mode (
safeoutputs <tool> ./ piped stdin with no flags) was swallowingJSON.parsefailures and incorrectly surfacing “No arguments provided,” which misdiagnosed real payload errors. This change makes payload-mode parse/object-shape failures explicit and stops the misleading help fallback.Payload-mode error semantics
parseToolArgsnow throws when JSON payload mode is requested and stdin is:.sentinel vs piped stdin/no flags) and corrective guidance.Main-path routing change
mainnow catches argument-parse failures before help/tool-call routing.Operational diagnostics
Focused regression coverage
.+ invalid JSON,Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output.
Review the workflow run logs for details.
Run: https://github.com/github/gh-aw/actions/runs/32057540470> Generated by 👨🍳 PR Sous Chef · gpt54 · 12.9 AIC · ⌖ 8.58 AIC · ⊞ 8.8K · ◷