Skip to content

fix(security): repair scanners and remove vulnerable Gradio 3.x - #6

Merged
zskbot merged 33 commits into
mainfrom
fix/security-scans-and-gradio-vulnerabilities
Nov 16, 2026
Merged

zskbot merged 33 commits into
mainfrom
fix/security-scans-and-gradio-vulnerabilities

Conversation

@zskbot

@zskbot zskbot commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Upgrade the Hugging Face Space from Gradio 3.x to Gradio 6.x and migrate the legacy InferenceApi call to InferenceClient.
  • Add explicit security floors for httpx2>=2.12.0 and httpcore2>=2.12.0 to address all six OSV findings previously reported against 2.9.1.
  • Add Python 3.10/3.11 dependency-resolution, import, and syntax smoke tests for the Space.
  • Remove PHPMD's continue-on-error so scanner failures cannot be reported as success.
  • Verify scanner reports exist and avoid SARIF upload attempts on fork pull requests where the token is read-only.
  • Print Grype SARIF finding details in Actions logs so any remaining critical container vulnerability can be traced to its package and CVE.

Validation

  • Dependency floors are based on OSV advisories: HTTPX2 2.12.0 fixes the decompression amplification issue; HTTPX2/httpcore2 2.10.0 fixes the SOCKS5 WebSocket TLS issue.
  • PyPI metadata confirms HTTPX2 2.12.0 supports Python 3.10; the new matrix tests Python 3.10 and 3.11.
  • GitHub Actions has been triggered for the updated head SHA. Results are pending; do not treat queued jobs as passing.
  • The prior Grype run failed at the Critical threshold but did not expose package details in its job log. The new workflow prints those details for targeted remediation.

Safety

  • PR remains open and unmerged.
  • No Production deployment.
  • No secrets, tokens, or environment variables changed.

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Uses of the API

Migrate the Space’s model call from the removed legacy InferenceApi to InferenceClient and adapt generation arguments and output handling.

  • huggingface-space-kimi-demo/app.py L2-9, L24-33, L43-44

Configuration

Update scanner workflows to use supported actions and invocation formats, grant required SARIF permissions, safely gate optional integrations, and avoid uploading missing reports.

  • .github/workflows/anchore.yml L1 (removed lines), L5-9, L17-54
  • .github/workflows/apisec-scan.yml L5-9, L18-49 (+4 small edits)
  • .github/workflows/codescan.yml L1 (removed lines), L4, L10-16
  • .github/workflows/defender-for-devops.yml L1-3, L9-16, L21-50
  • .github/workflows/fortify.yml L5-16, L21-49 (+3 small edits)
  • .github/workflows/jscrambler-code-integrity.yml L27-31 (+6 small edits)
  • .github/workflows/mobsf.yml L1 (removed lines), L5-9, L17-38
  • .github/workflows/neuralegion.yml L1-27, L32-39
  • .github/workflows/nowsecure-mobile-sbom.yml L1-10, L17 (removed lines), L20-45
  • .github/workflows/nowsecure.yml L1-13, L17 (removed lines), L20-49
  • .github/workflows/osv-scanner.yml L1, L7-18, L23-33
  • .github/workflows/phpmd.yml L5-9, L19-24, L33-44 (+1 small edits)
  • .github/workflows/pyre.yml L1-28
  • .github/workflows/sonarcloud.yml L1-30 (9 small edits)
  • .github/workflows/sonarqube.yml L22-30 (+6 small edits)
  • .github/workflows/veracode.yml L5-10, L18-75 (+3 small edits)

Raise the Space’s Gradio and HTTP transport dependency floors to remove the vulnerable Gradio 3.x line and flagged transport versions.

  • huggingface-space-kimi-demo/requirements.txt L1-8

Tests

Add a Python-version matrix smoke check that compiles the Space and verifies its imports and dependency security floors.

  • .github/workflows/huggingface-space-python.yml L1-56

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T14:58:37.612296Z
We couldn’t complete this review. Comment @codex review to try again.
b7c8001 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/mobsf.yml" line_range="35" />
<code_context>

       - name: Upload mobsfscan report
-        uses: github/codeql-action/upload-sarif@v3
+        if: always() && hashFiles('results.sarif') != ''
+        uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
         with:
</code_context>
<issue_to_address>
**Failed scans appear successful**

When mobSF or PHPMD fails before writing its SARIF file, `|| true`, `continue-on-error`, and the SARIF guard suppress the scanner failure and skip the upload, so the workflow reports success without scan results.

Make scanner failures fail the workflow instead of silently skipping the upload when SARIF is missing.

Also at `.github/workflows/phpmd.yml:37`.
</issue_to_address>

### Comment 2
<location path=".github/workflows/defender-for-devops.yml" line_range="36" />
<code_context>
+        uses: microsoft/security-devops-action@v1.6.0
+        id: msdo
+      - name: Upload results to Security tab
+        uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
+        with:
+          sarif_file: ${{ steps.msdo.outputs.sarifFile }}
</code_context>
<issue_to_address>
**Fork reports are not uploaded**

When a pull request comes from a fork, the read-only `GITHUB_TOKEN` makes `upload-sarif` fail with a permission error, so the scan reports are not uploaded.

Add fork-specific handling for SARIF uploads so the read-only token does not make the upload fail.

Also at `.github/workflows/mobsf.yml:36-37`, `.github/workflows/phpmd.yml:38`.
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: .github/workflows/mobsf.yml:35, .github/workflows/defender-for-devops.yml:36


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/mobsf.yml Outdated

- name: Upload mobsfscan report
uses: github/codeql-action/upload-sarif@v3
if: always() && hashFiles('results.sarif') != ''

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Failed scans appear successful

When mobSF or PHPMD fails before writing its SARIF file, || true, continue-on-error, and the SARIF guard suppress the scanner failure and skip the upload, so the workflow reports success without scan results.

Make scanner failures fail the workflow instead of silently skipping the upload when SARIF is missing.

Also at .github/workflows/phpmd.yml:37.

Prompt for AI agents
In `.github/workflows/mobsf.yml` at line 35:

**Failed scans appear successful**

When mobSF or PHPMD fails before writing its SARIF file, `|| true`, `continue-on-error`, and the SARIF guard suppress the scanner failure and skip the upload, so the workflow reports success without scan results.

Make scanner failures fail the workflow instead of silently skipping the upload when SARIF is missing.

Also at `.github/workflows/phpmd.yml:37`.

uses: microsoft/security-devops-action@v1.6.0
id: msdo
- name: Upload results to Security tab
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Fork reports are not uploaded

When a pull request comes from a fork, the read-only GITHUB_TOKEN makes upload-sarif fail with a permission error, so the scan reports are not uploaded.

Add fork-specific handling for SARIF uploads so the read-only token does not make the upload fail.

Also at .github/workflows/mobsf.yml:36-37, .github/workflows/phpmd.yml:38.

Prompt for AI agents
In `.github/workflows/defender-for-devops.yml` at line 36:

**Fork reports are not uploaded**

When a pull request comes from a fork, the read-only `GITHUB_TOKEN` makes `upload-sarif` fail with a permission error, so the scan reports are not uploaded.

Add fork-specific handling for SARIF uploads so the read-only token does not make the upload fail.

Also at `.github/workflows/mobsf.yml:36-37`, `.github/workflows/phpmd.yml:38`.

@zskbot
zskbot merged commit e9b1043 into main Nov 16, 2026
28 of 33 checks passed
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.

2 participants