slack-event-text-in-mrkdwn
Keep proven event-controlled text out of Slack markup controls.
Why
JSON quoting does not neutralize Slack markup controls in pull-request titles or branch names.
Fix
Use plain_text for event-controlled text, or deliberately encode reserved Slack controls before combining it with trusted markup.
Examples
name: Notifyon: pull_requestjobs: notify: runs-on: ubuntu-latest steps: - id: payload env: TITLE: ${{ github.event.pull_request.title }} run: bash scripts/slack_payload.sh - uses: slackapi/slack-github-action@v4 with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK }} payload: ${{ steps.payload.outputs.payload }}#!/usr/bin/env bashpayload=$(jq -nc --arg title "$TITLE" '{blocks: [{type: "section", text: {type: "mrkdwn", text: $title}}]}')printf 'payload=%s\n' "$payload" >> "$GITHUB_OUTPUT"name: Notifyon: pull_requestjobs: notify: runs-on: ubuntu-latest steps: - id: payload env: TITLE: ${{ github.event.pull_request.title }} run: bash scripts/slack_payload.sh - uses: slackapi/slack-github-action@v4 with: webhook-type: incoming-webhook webhook: ${{ secrets.SLACK_WEBHOOK }} payload: ${{ steps.payload.outputs.payload }}#!/usr/bin/env bashpayload=$(jq -nc --arg title "$TITLE" '{blocks: [{type: "section", text: {type: "plain_text", text: $title}}]}')printf 'payload=%s\n' "$payload" >> "$GITHUB_OUTPUT"Files
**/*.yml**/*.yaml