Skip to content

feat: add secret-scan and trufflehog-scan actions#30

Open
KlausNie wants to merge 27 commits intomainfrom
feat/security-scan-actions
Open

feat: add secret-scan and trufflehog-scan actions#30
KlausNie wants to merge 27 commits intomainfrom
feat/security-scan-actions

Conversation

@KlausNie
Copy link
Member

@KlausNie KlausNie commented Mar 16, 2026

Examples:

Summary

  • Extracts secret_scanner and trufflehog-package-analysis jobs from the now-deleted flutter-security-checks reusable workflow into standalone composite actions
  • secret-scan: wraps max/secret-scan@master with optional include-path / exclude-path inputs
  • trufflehog-scan: wraps trufflesecurity/trufflehog@main with optional base, exclude-paths, and include-paths inputs; caller is expected to checkout with fetch-depth: 0

Test plan

KlausNie added 27 commits March 17, 2026 16:48
Extracts the secret_scanner and trufflehog-package-analysis jobs from
the flutter-security-checks workflow into reusable composite actions.
Docker-based trufflesecurity/trufflehog@main fails on k8s runners
because the workspace volume mount is not accessible inside the
container. Install the binary directly and run it via a shell script.
/usr/local/bin is not writable on the k8s self-hosted runner.
RUNNER_TEMP is always writable; adding it to GITHUB_PATH makes
trufflehog available in subsequent steps.
The Docker mounting works fine on the k8s runner. The actual failure
was a git safe.directory mismatch — git 2.35.2+ refuses repos owned
by a different uid inside the container. Adding a safe.directory config
step before the action resolves this.

Also adds a head input and simplifies path args inline.
The runner mounts RUNNER_TEMP/_github_home as /github/home inside the
Docker container and sets HOME to that path. Writing safe.directory /tmp
into that gitconfig makes git inside the TruffleHog container trust the
mounted workspace.
Use docker run directly with -v $GITHUB_WORKSPACE:/repo so the
absolute path is mounted explicitly instead of relying on the official
action's -v .:/tmp which doesn't resolve correctly on this runner.
Run trufflehog in 'github' mode so it fetches directly from the GitHub
API using GITHUB_TOKEN. Avoids all Docker volume mounting entirely.
Use --pr flag with the pull request number so TruffleHog fetches
directly via GitHub API, avoiding Docker volume mount issues on k8s runners.
Use 'trufflehog git <remote-url>' with --since-commit and --branch
instead of the github subcommand, which doesn't support PR-scoped scanning
in the OSS version. This clones directly from GitHub via the API token
and avoids Docker volume mount issues on k8s runners.
Parse JSON output and emit ::error file=...,line=...:: annotations
so findings appear inline in the PR diff view.
Use -v GITHUB_WORKSPACE:/repo and file:///repo so TruffleHog scans
the already-checked-out repo. GITHUB_TOKEN is no longer required.
The official Docker action gets the workspace mounted by GitHub's runner
infrastructure directly, bypassing DinD. No GITHUB_TOKEN needed.
Replaces the failed DinD volume-mount experiment with the working
remote git clone strategy: TruffleHog clones the repo via
oauth2 token URL, scans since the PR base commit, and emits
inline GitHub Actions annotations via Python JSON parsing.
Downloads the TruffleHog Linux binary from GitHub Releases at run time
and scans the locally checked-out repo (file:// URL). This removes the
need for Docker volume mounts (which fail on DinD k8s runners) and
removes the GITHUB_TOKEN requirement from the action entirely.
Before running TruffleHog, the script now:
1. Downloads cosign v3.0.5 (pinned, SHA256-verified as trust anchor)
2. Uses cosign to verify TruffleHog's checksums.txt against its
   cosign certificate + signature from the release
3. Verifies the tarball SHA256 against the verified checksums file
@KlausNie KlausNie force-pushed the feat/security-scan-actions branch from b94b653 to c105642 Compare March 17, 2026 15:48
@KlausNie KlausNie requested a review from nasirky March 17, 2026 15:56
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.

1 participant