Skip to content

Fix SC2086: Quote $GITHUB_OUTPUT in safe-inputs config generation#7921

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-shellcheck-sc2086
Dec 27, 2025
Merged

Fix SC2086: Quote $GITHUB_OUTPUT in safe-inputs config generation#7921
pelikhan merged 2 commits intomainfrom
copilot/fix-shellcheck-sc2086

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

Shellcheck flagged 10 SC2086 violations across 5 workflows where $GITHUB_OUTPUT was unquoted in shell scripts, risking word splitting and glob expansion.

Changes

  • pkg/workflow/mcp_servers.go: Added quotes around $GITHUB_OUTPUT variable references in safe-inputs MCP server configuration generation (lines 293-294)
// Before
yaml.WriteString("          echo \"safe_inputs_api_key=${API_KEY}\" >> $GITHUB_OUTPUT\n")

// After  
yaml.WriteString("          echo \"safe_inputs_api_key=${API_KEY}\" >> \"$GITHUB_OUTPUT\"\n")
  • 5 workflow lock files: Automatically recompiled with quoted variable references

Impact

Prevents potential shell expansion issues if $GITHUB_OUTPUT ever contains spaces or glob characters. All 10 SC2086 violations resolved.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login -json GO111MODULE ux-amd64/bin/go GOINSECURE GOMOD GOMODCACHE /home/REDACTED/go/GO111MODULE -V=f�� GOPATH GOPROXY ux-amd64/pkg/tool/linux_amd64/compile GOSUMDB GOWORK ux-amd64/bin/go ux-amd64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login workflows 9679301/b374/_testmain.go /home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linux-amd64/pkg/tool/linux_amd64/li--git-dir GOSUMDB GOWORK nk /home/REDACTED/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linrev-parse -o tags/v5 nk by/ba918fc0ac40182b5e8ab27898391712307f30a4211a5743c8fa67cdf974802b/log.json -s -w l/linux_amd64/liuser ps (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login tags/v6 -tests /usr/bin/git by/ba918fc0ac401infocmp GO111MODULE l/linux_amd64/coxterm-color git rev-�� c8fa67cdf974802b -bun.git /usr/bin/git -json GO111MODULE ux-amd64/bin/go git (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Fix SC2086: Add missing quotes in 5 workflows</issue_title>
<issue_description>## Objective

Fix 10 occurrences of shellcheck SC2086 info-level issues across 5 workflows by adding proper quotes around variable references.

Problem

Unquoted variables can lead to unexpected word splitting or pathname expansion:

echo $variable        # ❌ Can split on whitespace, expand globs
command $arg         # ❌ May cause unexpected behavior

Solution

Add double quotes:

echo "$variable"     # ✅ Preserves spaces, prevents expansion
command "$arg"       # ✅ Treats as single argument

Why This Matters

  • Prevents word splitting on spaces/tabs/newlines
  • Prevents glob expansion (*, ?, etc.)
  • Ensures variables are treated as single arguments
  • Makes script behavior more predictable

Approach

  1. Search for unquoted variable usage: grep -n '\$[A-Za-z_]' .github/workflows/*.md
  2. Identify the 10 specific SC2086 violations from actionlint output
  3. Add quotes around each variable reference
  4. Recompile workflows: make recompile
  5. Verify with actionlint

Files to Modify

5 workflow .md files in .github/workflows/ (10 total occurrences)

Acceptance Criteria

AI generated by Plan Command for discussion #7889

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 27, 2025
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SC2086 by adding missing quotes in workflows Fix SC2086: Quote $GITHUB_OUTPUT in safe-inputs config generation Dec 27, 2025
Copilot AI requested a review from mnkiefer December 27, 2025 20:13
@pelikhan pelikhan marked this pull request as ready for review December 27, 2025 20:36
@pelikhan pelikhan merged commit 7f2aa91 into main Dec 27, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-shellcheck-sc2086 branch December 27, 2025 20:36
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.

[plan] Fix SC2086: Add missing quotes in 5 workflows

3 participants