Skip to content

ci: fix Discord notification failing on issue titles with quotes#22

Merged
swstegall merged 1 commit into
developfrom
fix/discord-notify-json-escaping
May 31, 2026
Merged

ci: fix Discord notification failing on issue titles with quotes#22
swstegall merged 1 commit into
developfrom
fix/discord-notify-json-escaping

Conversation

@swstegall

Copy link
Copy Markdown
Owner

Problem

The issues: opened workflow's Notify Discord step hand-built its JSON payload by interpolating ${{ github.event.issue.title }} straight into the curl -d string. Any issue title containing a " (or \, or a control char) produced invalid JSON, so Discord rejected it:

{"message": "The request body contains invalid JSON.", "code": 50109}

The step exited non-zero and no notification was sent. This is independent of how the issue is created (web UI, gh, API) — it is purely about the title characters. Plain-titled issues happened to work.

Fix

  • Build the payload with jq -n --arg content ... '{content: $content}' so the title is JSON-escaped correctly.
  • Pass ISSUE_TITLE / ISSUE_URL / DISCORD_WEBHOOK_URL via env: instead of inline ${{ }} in the run: block — this also closes a shell-injection vector (a crafted title like `id` / $(...) would otherwise execute on the runner).

Verified locally: the new pipeline yields valid JSON for a hostile title (Man0u0 "Flowers for All" — Ul'dah; $(whoami) \id` \backslash`), with the injection payload appearing as literal text.

The same fix is applied to the sibling repos (Garlemald-Client, meteor-decomp). No approval needed — self-merge once CI is green.

🤖 Generated with Claude Code

…titles)

The "Notify Discord" step in the issue-opened workflow hand-built its JSON
by interpolating ${{ github.event.issue.title }} straight into the curl
-d string. Any title containing a double quote (or backslash/control char)
produced invalid JSON and Discord rejected it (code 50109), so the step
failed and no notification was sent. Issues #25 and #26 (quoted titles)
hit exactly this.

Encode the payload with `jq -n --arg`, and pass the title/URL via env vars
(which also closes a shell-injection vector from `${{ }}` in `run:`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@swstegall
swstegall merged commit 151c28e into develop May 31, 2026
5 checks passed
@swstegall
swstegall deleted the fix/discord-notify-json-escaping branch May 31, 2026 20:06
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