ci: scan pull requests for credentials and injection with ThreatCrush - #2
Open
ralyodio wants to merge 5 commits into
Open
ci: scan pull requests for credentials and injection with ThreatCrush#2ralyodio wants to merge 5 commits into
ralyodio wants to merge 5 commits into
Conversation
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
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.
Adds a pull-request workflow that scans the diff for hardcoded credentials,
injection, SSRF and unsafe deserialisation. Results go to the Security tab as
SARIF and to a comment on the pull request.
What it does on this repository
Nothing flagged. That is the whole report — the comment on a pull request
would say the same.
Opened alongside the question in
#1, which is the place to say no or ask for
changes. This is only the diff, so it is there to read rather than imagine —
closing either one is a fine answer.
This is not a CodeQL replacement, and it is worth saying where it differs.
CodeQL does semantic dataflow analysis and is better at it than this is — a
repository already running it is not missing much by closing this. Two gaps it
does fill:
paid GitHub Code Security / Secret Protection on private ones. This is MIT and
free on both, so the same gate can run across a mixed set of repositories.
only the language with the most source files unless it's explicitly configured
otherwise. In a polyglot repository the rest goes unscanned by default; this
reads every file it is pointed at.
It is additive and report-only, so running both costs a few CI minutes and
changes nothing else.
It is report-only.
failOnis empty, so it annotates and never fails a build.A repository with pre-existing findings should get a report on its first install,
not a blocked pull request — a gate that fires on everything gets switched off
within a day. Tighten it to
critical,highin the workflow once any backlog istriaged.
.github/workflows/threatcrush-scan.yml— the workflow.github/scripts/threatcrush-to-sarif.py— a compatibility shim for CLI versionsolder than native SARIF output; unused once the installed CLI can emit it itself
Permissions are least-privilege (
contents: read,pull-requests: write,security-events: write). It runs onpull_request, notpull_request_target,so contributor code never executes with your secrets in scope. The SARIF upload
is
continue-on-errorand degrades quietly where code scanning is unavailable.The CLI is pinned to
@profullstack/threatcrush@0.11.0and installed with--ignore-scripts, and checkout runs withpersist-credentials: false. Ascanner that installs a floating version, runs its dependencies' lifecycle
scripts and leaves a token in
.git/configis asking you to trust more than itis worth, and none of that is needed to read a diff. Bump the pin whenever you
like — nothing here updates itself.
Disclosure: I maintain ThreatCrush.
It is free and MIT, and the workflow installs it from npm — nothing here phones
home. If this is not something you want, closing it is the right answer, and I
will not send another.