Repository navigation
Harden manual-dispatch workflows and resolve CKV_GHA_7 linter failures - #8
Merged
Merged
Conversation
…essions Co-authored-by: austinsager <294792209+austinsager@users.noreply.github.com>
Co-authored-by: austinsager <294792209+austinsager@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A few newly added input-validation checks still allow unsafe/pathspec patterns (and one hex-color regex is overly permissive), leaving avoidable gaps in the stated hardening.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses Checkov CKV_GHA_7 findings in admin/maintenance workflow_dispatch workflows while hardening several user-controlled inputs that flow into shell/git operations.
Changes:
- Normalizes CKV_GHA_7 skip directives on affected manual-dispatch workflows.
- Adds/expands validation and safer argument passing for workflow inputs used in shell commands.
- Tightens release workflow toggles by converting booleans to explicit
choiceinputs and using strict equality inif:conditions.
File summaries
| File | Description |
|---|---|
| .github/workflows/update_chromium_files.yml | Adds CKV_GHA_7 suppression alignment and validates Chromium version components as numeric. |
| .github/workflows/rename_directory.yml | Adds path validation and uses env-mapped, quoted args with git mv --. |
| .github/workflows/import_file_from_chromium.yml | Adds import-path validation and switches URL construction to env-mapped variables. |
| .github/workflows/download_icon_from_fontawesome.yml | Adds input validation and switches script invocation to env-mapped variables with safe quoting. |
| .github/workflows/delete_committed_file.yml | Adds filename validation and safer injection of the target into the history-rewrite command. |
| .github/workflows/build_and_sign_release_apk.yml | Converts manual toggles to choice inputs and replaces contains() checks with strict equality. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| FILENAME: ${{ github.event.inputs.filename }} | ||
| run: | | ||
| git filter-branch --force --index-filter "git rm --cached --ignore-unmatch ${{ github.event.inputs.filename }}" --prune-empty --tag-name-filter cat -- --all | ||
| if [ -z "$FILENAME" ] || [ "${FILENAME#/}" != "$FILENAME" ] || [ "${FILENAME#../}" != "$FILENAME" ] || [[ "$FILENAME" == *"/../"* ]] || [[ "$FILENAME" == *"'"* ]] || [[ "$FILENAME" == *$'\n'* ]]; then |
Comment on lines
+79
to
+82
| if [ -z "$FILE_NAME_IN_CHROMIUM" ] || [[ "$FILE_NAME_IN_CHROMIUM" == */* ]] || [[ "$FILE_NAME_IN_CHROMIUM" == *$'\n'* ]]; then | ||
| echo "::error::Invalid Chromium icon filename: $FILE_NAME_IN_CHROMIUM" | ||
| exit 1 | ||
| fi |
| exit 1 | ||
| fi | ||
|
|
||
| if [ -n "$FILL_COLOR" ] && [[ ! "$FILL_COLOR" =~ ^#[0-9A-Fa-f]{3,8}$ ]]; then |
| DESTINATION_DIRECTORY: ${{ github.event.inputs.destination_directory }} | ||
| run: | | ||
| for path_value in "$SOURCE_DIRECTORY" "$DESTINATION_DIRECTORY"; do | ||
| if [ -z "$path_value" ] || [ "${path_value#/}" != "$path_value" ] || [ "${path_value#../}" != "$path_value" ] || [[ "$path_value" == *"/../"* ]] || [[ "$path_value" == *$'\n'* ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run source-code linterwas failing on CKV_GHA_7 across admin workflows usingworkflow_dispatch.inputs. This PR keeps required manual controls but makes the rule handling explicit and tightens input handling in shell-executed paths.Checkov suppression alignment (CKV_GHA_7)
build_and_sign_release_apk.ymlrename_directory.ymldelete_committed_file.ymlimport_file_from_chromium.ymldownload_icon_from_fontawesome.ymlupdate_chromium_files.yml(also flagged in the failing run)Input-safety hardening for shell execution
${{ github.event.inputs.* }}inrun:commands with env-mapped variables.--and quoted expansions) where paths feed git/shell operations.Workflow-specific tightening
rename_directory.yml: validates source/destination paths beforegit mv.delete_committed_file.yml: validates filename and safely injects target into history-rewrite command.import_file_from_chromium.yml: validates import path before download/decode/add flow.download_icon_from_fontawesome.yml: whitelists icon type, validates icon name and output filename, validates optional hex fill color.build_and_sign_release_apk.yml: constrains manual toggles to explicitchoicevalues and replacescontains()checks with strict equality.