Repository navigation
[repository-quality] Repository Quality: Setup Shell Script & Shell-Out Hardening #75423
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-11-07T12:57:25.784Z.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🎯 Repository Quality Improvement Report - Setup Shell Script & Shell-Out Hardening
Analysis Date: 2026-11-06
Focus Area: Setup Shell Script & Shell-Out Hardening
Strategy Type: Custom
Custom Area: Yes —
actions/setup/shruns in every compiled workflow, and no earlier run has audited it.Executive Summary
actions/setup/shholds 110 shell scripts that run in every compiled workflow. 15 of them (about 14%) have noset -e-style strict mode. Nine of those are non-test scripts:append_agent_step_summary.sh,create_cache_memory_dir.sh,generate_git_patch.sh,kvm_access.sh,mask_otlp_common.sh,print_firewall_logs.sh,proxy_env_lib.sh,release_integrity.shandrun_awf_with_startup_retries.sh. Some may be deliberately lenient, but none of them document that choice. Across the repo, 70 of 183.shfiles lackset -euo pipefail.On the JS side,
actions/setup/js/start_mcp_gateway.cjs:1313builds a shell pipeline withexecSyncand a template string. The port is sanitised first, so this is safe today. It is still a fragile pattern, andexecFileSyncwould remove the class of risk. Only 2 non-test.cjsfiles still useexecSync(.The Makefile has a shellcheck install target, but it is not obvious that every script is linted at a consistent severity. Test files and the 15 scripts above are the likely gaps.
Full Analysis Report
Current State Assessment
Metrics Collected:
set -evariant.shfiles withoutset -euo pipefail.cjsfiles usingexecSync(Findings
Strengths
start_mcp_gateway.cjs.Areas for Improvement
execSyncwith an interpolated shell pipeline instart_mcp_gateway.cjs:1313.sed -ion git config inclean_git_credentials*.sh: GNU-only and silently tolerates failure (|| true). Check whether this is intentional.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add or justify strict mode in setup scripts
Priority: High
Estimated Effort: Medium
Focus Area: Shell hardening
Description: Review the 9 non-test scripts listed above. Add
set -euo pipefailwhere safe. Where leniency is intentional, add a header comment saying why and use explicit|| trueon the commands that may fail.Acceptance Criteria:
actions/setup/shhas strict mode or a documented exemption.Code Region:
actions/setup/sh/*.shTask 2: Replace shell-string execSync with execFileSync
Priority: Medium
Estimated Effort: Small
Focus Area: Shell-out safety
Description: Replace the
execSyncpipeline instart_mcp_gateway.cjs:1313withexecFileSync("ss", ["-tlnp"])and filter the output in JS. Check the one other file that still usesexecSync(.Acceptance Criteria:
.cjsfile usesexecSyncwith interpolated strings.Code Region:
actions/setup/js/start_mcp_gateway.cjsTask 3: Enforce shellcheck across all scripts in CI
Priority: Medium
Estimated Effort: Small
Focus Area: CI/lint
Description: Add a
make lint-shelltarget that runs shellcheck over all.shfiles, including tests, and wire it into the existing lint flow. Fix or annotate the findings.Acceptance Criteria:
make lint-shellexits 0.Code Region:
Makefile,.github/workflows/ci.ymlTask 4: Document shell script conventions
Priority: Low
Estimated Effort: Small
Focus Area: Documentation
Description: Add a short script template and header convention to
actions/setup/README.mdcovering strict mode,histexpand, and when|| trueis acceptable.Acceptance Criteria:
Code Region:
actions/setup/README.md📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
Short-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
execSynctemplate strings: 1 → 0Next Steps
Generated by Repository Quality Improvement Agent
All reactions