Skip to content

SLOP-268: escape all fields in monit Slack payload - #417

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-268-monit-slack-json-escaping
Open

tosfos wants to merge 1 commit into
masterfrom
SLOP-268-monit-slack-json-escaping

Conversation

@tosfos

@tosfos tosfos commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • _sources/scripts/monit-slack.sh JSON-escaped only $MONIT_DESCRIPTION; $MONIT_HOST, $MONIT_SERVICE and $MONIT_DATE were interpolated raw into a hand-built JSON string.
  • Any " or \ in those monit-provided values (service names are free text from .monitrc) produced invalid JSON, so Slack rejected the request and the alert was silently dropped.
  • Fix: build the whole payload with one python3 json.dumps call, passing every field via the environment. Behavior and message format are unchanged for normal values.

Jira: SLOP-268 (covers the escaping/injection defect only; the ICON/MONIT_COLOR override bug is tracked separately in SLOP-69)

Test plan

  • bash -n passes
  • Harness with hostile inputs (MONIT_SERVICE='apache - status "Connection reset"', backslashes/quotes in date):
    • old code → jq: parse error (invalid JSON)
    • new code → valid JSON, all fields round-trip intact (Host=wiki-node-1, Service=apache - status "Connection reset")
  • CI e2e suite green

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cbbc24f9-f96b-4250-b4a3-80cc2c45a452


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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