Skip to content

Review follow-ups for #76: keep webhook URLs out of argv and output - #79

Merged
rahuldotiyer merged 1 commit into
mcp-parity-query-alertfrom
mcp-parity-query-alert-review
Nov 26, 2026
Merged

rahuldotiyer merged 1 commit into
mcp-parity-query-alertfrom
mcp-parity-query-alert-review

Conversation

@rahuldotiyer

@rahuldotiyer rahuldotiyer commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to @norbertdurcansk's review of #76. They're in a separate PR because the repo ruleset refuses direct pushes to existing branches. This PR targets #76's branch, so merging it puts these changes into #76.

  • --slack-webhook, --discord-webhook and --webhook take @path or @-, like --config does, so the URL stays out of ps and shell history. Trailing whitespace is trimmed. The help text and example use @-.
  • --email "" is rejected before any call, as an empty webhook already was.
  • -o json prints only the known result fields (alert_id, query_id, channel, cron_expression, next_execution_time), not the raw tool result. So a URL the tool might echo back later never reaches the output. The schema doesn't promise to leave it out.
  • The URL-hiding test now uses a result that contains the URL and checks both text and JSON output. It fails if JSON goes back to printing the raw result.
  • The help text says where its cron list comes from (setQueryAlert's description). Nothing in this repo checks the help for drift. The comparison is a step in a weekly Amp scheduled check, recorded in its parity map under "Notes for the drift check". It is not a CI check.

go test ./... and go vet ./... pass.

No visual surface: CLI only.

Review follow-ups on #76: webhook flags accept @path and @- so the URL
stays out of the process list and shell history; --email rejects empty
values; JSON output is built from the known result fields instead of the
raw tool result, so an echoed URL never reaches it; the URL-hiding test
now uses a result that contains the URL, in text and JSON output.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a2147b-3c2e-76b3-aeaf-0aafbe53d879

@norbertdurcansk norbertdurcansk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with suggestions. go test ./cmd/query/ and go vet pass at 3903b15, and TestAlertOutputNeverShowsAnEchoedWebhookURL is a real regression test: it fails if JSON output goes back to PrintRawJSON(raw). Building the output from a typed struct instead of filtering the raw result is the right default for any tool result that could carry secrets.

suggestion (PR description): the description says the weekly MCP-to-CLI drift check now compares the cron list with query alert and schedule set help. But only alert.go and alert_test.go change here, and this repo has no drift-check workflow (.github/workflows has only ci, codeql and release). If the check lives in another repo or routine, link that change. Otherwise drop the sentence, so nobody assumes help-text drift is covered when it may not be.

question: before this change, a field missing from the tool result was left out of -o json. Now it prints as "" (or 0 for query_id). Is that the contract you want for scripts that read this output, or should the fields use omitempty?

Comment thread cmd/query/alert.go Resolved
Comment thread cmd/query/alert_test.go Resolved

Copy link
Copy Markdown
Contributor Author

Thanks. PR description: I replaced the sentence. The drift check is a weekly Amp scheduled check, not something in this repo, and the description now says so and links its parity map.

omitempty: you're right. I want missing fields left out, as they were when the command printed the raw result. 44e7be9 adds omitempty to every field, and a test checks that a partial result prints only the fields it has. Since the ruleset blocks pushes to this branch, I'll merge this approved PR and open the follow-up against #76.

@rahuldotiyer
rahuldotiyer merged commit 5926a06 into mcp-parity-query-alert Nov 26, 2026
6 checks passed

Copy link
Copy Markdown
Contributor Author

Follow-up is #80.

rahuldotiyer added a commit that referenced this pull request Nov 26, 2026
…80)

Review follow-ups on #79: JSON output leaves out fields the tool did not
return, as it did when printing the raw result; a test pipes the webhook
URL through standard input with a trailing newline; the empty --email
check names the input that reaches it.


Amp-Thread-ID: https://ampcode.com/threads/T-01a2147b-3c2e-76b3-aeaf-0aafbe53d879

Co-authored-by: Amp <amp@ampcode.com>
rahuldotiyer added a commit that referenced this pull request Nov 26, 2026
* Add dune query alert for the MCP's setQueryAlert

core#8168 added setQueryAlert to the Dune MCP server. 'dune query alert'
calls it: it sets the query's schedule and creates or replaces the alert
for one channel (email, Slack, Discord, or a webhook). The result carries
no webhook URL, so the command prints it as it is.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a2147b-3c2e-76b3-aeaf-0aafbe53d879

* Keep webhook URLs out of argv and output in dune query alert (#79)

Review follow-ups on #76: webhook flags accept @path and @- so the URL
stays out of the process list and shell history; --email rejects empty
values; JSON output is built from the known result fields instead of the
raw tool result, so an echoed URL never reaches it; the URL-hiding test
now uses a result that contains the URL, in text and JSON output.


Amp-Thread-ID: https://ampcode.com/threads/T-01a2147b-3c2e-76b3-aeaf-0aafbe53d879

Co-authored-by: Amp <amp@ampcode.com>

* Cover webhook @- input and omit missing fields from query alert JSON (#80)

Review follow-ups on #79: JSON output leaves out fields the tool did not
return, as it did when printing the raw result; a test pipes the webhook
URL through standard input with a trailing newline; the empty --email
check names the input that reaches it.


Amp-Thread-ID: https://ampcode.com/threads/T-01a2147b-3c2e-76b3-aeaf-0aafbe53d879

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
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.

2 participants