ci: scan pull requests for credentials and injection with ThreatCrush - #2735
ci: scan pull requests for credentials and injection with ThreatCrush#2735ralyodio wants to merge 3 commits into
Conversation
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
Greptile SummaryThe PR adds a pull-request workflow that installs a pinned ThreatCrush release, scans the checked-out repository, and publishes SARIF results through workflow artifacts, job summaries, code scanning, and same-repository PR comments.
Confidence Score: 4/5The PR should not merge until SARIF-derived values are escaped before being inserted into the Markdown report. The previously reported report-rendering defect remains: scanner-controlled paths and rule IDs are interpolated directly into Markdown table cells and code spans, allowing valid delimiters to produce malformed summaries and PR comments. Files Needing Attention: .github/workflows/threatcrush-scan.yml Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
PR[Pull request] --> Checkout[Checkout merge ref]
Checkout --> Scope[Determine changed files]
Checkout --> Scan[Run ThreatCrush]
Scan --> SARIF[SARIF results]
Scope --> Report[Build scoped Markdown report]
SARIF --> Report
SARIF --> Artifact[Upload artifact]
SARIF --> Security[Upload to Security tab]
Report --> Summary[Job summary]
Report --> Comment[PR comment]
Reviews (2): Last reviewed commit: "ci: drop the ThreatCrush SARIF converter..." | Re-trigger Greptile |
| label = {"error": "HIGH", "warning": "MEDIUM", "note": "LOW"}.get( | ||
| result.get("level", "warning"), "INFO" | ||
| ) | ||
| lines.append(f"| {label} | `{result.get('ruleId','?')}` | `{uri}`:{line_no} |") |
There was a problem hiding this comment.
Unescaped Markdown table fields
A scanned path containing a pipe or backtick is inserted directly into this Markdown table row, causing the job summary and same-repository PR comment to render shifted or malformed finding columns. Escape Markdown table and code-span delimiters in SARIF-derived values before rendering them.
|
Needs a dedicated approval from Maintainers of the project. |
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Signed-off-by: Anthony Ettinger <anthony@chovy.com>
…pack Signed-off-by: Anthony Ettinger <anthony@chovy.com>
Adds one workflow. On each pull request it scans the checked-out repository for
hardcoded credentials, injection, SSRF and unsafe deserialisation, and writes
findings to the Security tab and a comment.
.github/workflows/threatcrush-scan.yml.github/scripts/threatcrush-to-sarif.py— SARIF shim for older CLI versionsReport-only.
failOnis empty, so findings never fail the build. An installor scan failure does fail the job: a scanner that reports clean when it did not
run is worse than no scanner.
Scope: it scans the whole checked-out repository, not only the diff.
Supply chain. Pinned to
@profullstack/threatcrush@0.11.0; the tarball is hashed and checked againsta value in the workflow before install (
npm viewit yourself), installed with--ignore-scripts, actions pinned to commit SHAs, and it runs onpull_requestrather than
pull_request_target.Asked first in #2734.
Disclosure: I maintain ThreatCrush;
MIT and free. Written with AI assistance. Closing this is a fine answer and I
will not send another.