Skip to content

ci: scan pull requests for credentials and injection with ThreatCrush - #2735

Open
ralyodio wants to merge 1 commit into
Acode-Foundation:mainfrom
ralyodio:threatcrush-scan
Open

ci: scan pull requests for credentials and injection with ThreatCrush#2735
ralyodio wants to merge 1 commit into
Acode-Foundation:mainfrom
ralyodio:threatcrush-scan

Conversation

@ralyodio

Copy link
Copy Markdown

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 versions

Report-only. failOn is empty, so findings never fail the build. An install
or 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 against
a value in the workflow before install (npm view it yourself), installed with
--ignore-scripts, actions pinned to commit SHAs, and it runs on pull_request
rather 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.

Signed-off-by: Anthony Ettinger <anthony@chovy.com>
@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a pull-request security-scanning workflow that installs a pinned ThreatCrush release, scans the checkout, uploads SARIF, and publishes a report. It also adds a compatibility converter for ThreatCrush versions without native SARIF output.

  • Verifies the scanner package integrity before installation and disables install scripts.
  • Converts legacy terminal output into SARIF with completion and finding-count validation.
  • Uploads successful analyses to code scanning, retains the SARIF artifact, and reports results through the job summary and same-repository PR comments.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking report-rendering issue for findings whose file paths contain Markdown delimiters.

The scanning and fail-closed conversion paths have no established blocking defect, but unescaped SARIF-derived paths can corrupt finding rows in the generated GitHub Markdown report.

Files Needing Attention: .github/workflows/threatcrush-scan.yml

Important Files Changed

Filename Overview
.github/workflows/threatcrush-scan.yml Adds the complete report-only scanning workflow; the generated Markdown report does not escape table delimiters in SARIF-derived fields.
.github/scripts/threatcrush-to-sarif.py Adds a fail-closed legacy-output-to-SARIF converter with count validation, path normalization, severity mapping, and stable rule identifiers.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  PR[Pull request] --> Checkout[Checkout without persisted credentials]
  Checkout --> Install[Download and verify ThreatCrush]
  Install --> Detect{Native SARIF supported?}
  Detect -->|Yes| Native[Scan to SARIF]
  Detect -->|No| Legacy[Scan to terminal output]
  Legacy --> Convert[Convert output to SARIF]
  Native --> Validate[Validate SARIF exists]
  Convert --> Validate
  Validate --> Upload[Upload to Security tab and artifact]
  Validate --> Report[Build job-summary and PR report]
Loading

Fix all with Greploop

Fix All in Codex Fix All in Claude Code

Reviews (1): Last reviewed commit: "ci: add the ThreatCrush security scan wo..." | 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} |")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Fix in Codex Fix in Claude Code

@UnschooledGamer

Copy link
Copy Markdown
Collaborator

Needs a dedicated approval from Maintainers of the project.

@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants