fix: release notification secrets context and script injection#50
fix: release notification secrets context and script injection#50abhizipstack merged 2 commits intomainfrom
Conversation
- Move secrets check from job-level if to step-level env (secrets
context is not available in jobs.<id>.if — only github, inputs,
needs, and vars are allowed)
- Pass release event data via env variables instead of direct ${{ }}
interpolation in run block to prevent script injection
- Skip Slack post if no message was built
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| .github/workflows/release-notification.yml | Correctly fixes secrets-context misuse, script injection via env: variables, and adds a skip guard on the Slack post step. No remaining issues. |
Sequence Diagram
sequenceDiagram
participant GH as GitHub Release Event
participant Step1 as Build Slack Payload
participant Step2 as Post to Slack
participant Slack as Slack Webhook
GH->>Step1: release published (tag_name, name, html_url)
Note over Step1: if: env.SLACK_WEBHOOK_URL != ''
alt SLACK_WEBHOOK_URL secret is set
Step1->>Step1: env vars TAG, RELEASE_NAME, URL bound from secrets/event
Step1->>Step1: printf → TEXT, jq --arg → PAYLOAD (JSON-safe)
Step1-->>Step2: outputs.payload = JSON string
Note over Step2: if: steps.message.outputs.payload != ''
Step2->>Slack: POST webhook with payload
else SLACK_WEBHOOK_URL secret is empty
Step1-->>Step2: skipped (outputs.payload = '')
Note over Step2: skipped — no webhook configured
end
Reviews (2): Last reviewed commit: "fix: build full JSON payload in shell to..." | Re-trigger Greptile
tahierhussain
left a comment
There was a problem hiding this comment.
LGTM
Note: Please make sure to address the security issue raised by Greptile.
Use jq to build the Slack payload JSON in the shell step instead of interpolating untrusted values into the payload block. This ensures release names with quotes or backslashes produce valid JSON. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Greptile P1 addressed in 2bc148b — full JSON payload is now built in the shell step using |
What
secretscontext usage in release notification workflowrun:blockWhy
secretscontext is not available injobs.<id>.if(onlygithub,inputs,needs,varsallowed) — actionlint was failing${{ }}interpolation of release event data inrun:block is a script injection riskHow
secrets.SLACK_WEBHOOK_URLcheck from job-levelifto step-levelenvguardTAG,RELEASE_NAME,URL) viaenv:variables instead of inline${{ }}in shellif: ${{ steps.message.outputs.text != '' }}on "Post to Slack" stepCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
SLACK_WEBHOOK_URLsecretRelevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Screenshots
N/A
Checklist
🤖 Generated with Claude Code