Repository navigation
refactor(betterleaks): move scan to scripts/scan.sh and harden it - #7
Merged
Merged
Conversation
Review of the action's shell code (shellcheck, shell guidelines): - single scan script shared by the action and tests/scan-local.sh - repository mounted read-only; report written under RUNNER_TEMP - image pull retried; pull/scanner errors fail without a leak email - email names the scanned commit and PR head branch - set -euo pipefail, validated inputs (mode, booleans, paths inside workspace) - readability fixes in the committer email step
docker run -v "$PWD:/path" matched secret-literal-assignment (PWD read as a password name). Allowlist matches of the form PWD:/... only; pwd=..., DB_PWD: ... are still reported. Self-test covers both.
Contributor
Author
|
Follow-up commit 52b5ec6: |
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.
Review of the action's shell code. actionlint runs shellcheck on workflow
run:blocks but not on a compositeaction.yml, so the action's Bash had never been linted. Findings were checked against shellcheck 0.10 (all optional checks) and GitHub'sshell.instructions.mdguidelines.betterleaks/scripts/scan.sh;action.ymlandtests/scan-local.shboth call it$RUNNER_TEMP/betterleaks/git rev-parse HEAD) andgithub.head_refpull_requestit showed the merge commit andN/mergeset -euo pipefailin all scriptsbash -e -o pipefailwithout-umode,true/falseinputs,path/configmust stay inside the workspace; invalidfallback-emailreportedfail-on-leak: yesused to disable failing silentlyshoptinside a function (${1,,}instead), no variable namedsourceNew outputs:
result(clean/leaks) andcommit. Existing outputs and inputs unchanged.Tests
-o allminus brace-style / Actions env-var / function-in-if notes)scan.sh: leak/clean in git and dir mode, layered config, base off, 5 invalid-input cases, image pull failure with retry — all as expected;scan-local.shon helm5 and this reporesult/commitoutputs, report outside the workspace, invalidmode/fail-on-leak/pathfail the step, pull failure is an error with one retry and no result, email containsCommit: <scanned sha>After merging
Move
v1(onmain):git checkout main && git pull && git tag -f v1 && git push -f origin v1