Skip to content

Close 9 open CodeQL/Dependabot alerts (workflow permissions + torch in test fixtures)#1035

Merged
ackizilkale merged 3 commits intomasterfrom
fix/codeql-workflow-permissions-and-torch
May 6, 2026
Merged

Close 9 open CodeQL/Dependabot alerts (workflow permissions + torch in test fixtures)#1035
ackizilkale merged 3 commits intomasterfrom
fix/codeql-workflow-permissions-and-torch

Conversation

@ackizilkale
Copy link
Copy Markdown
Contributor

Closes the 9 remaining open security alerts on master:

Commits

1. fd198a4 — Add explicit GITHUB_TOKEN permissions to workflows

File Scopes Why
publish.yml workflow: contents: read
publish-github-release job: contents: write
PyPI upload uses TWINE_USERNAME/PASSWORD (independent of GITHUB_TOKEN). The release-creation job needs contents: write for softprops/action-gh-release.
run_tests.yml contents: read
pull-requests: write
Coverage step uses marocchino/sticky-pull-request-comment which posts on PRs.
run_tests_staging.yml / run_tests_prod.yml contents: read Cron callers; the PR-comment step has if: github.event_name == 'pull_request' so it never fires here.

2. 8f5714d — Bump torch to 2.8.0 in test runner fixtures

Test fixtures only — not shipped SDK code:

  • tests/runners/dummy_vllm_models/requirements.txt: torch==2.6.02.8.0
  • tests/runners/hf_mbart_model/requirements.txt: torch==2.6.02.8.0

Covers both CVEs:

Test plan

🤖 Generated with Claude Code

ackizilkale and others added 2 commits May 5, 2026 18:02
Closes the five `actions/missing-workflow-permissions` CodeQL alerts.
- publish.yml: workflow-level `contents: read`; the `publish-github-release`
  job overrides with `contents: write` (needed by softprops/action-gh-release
  to create the GitHub Release). PyPI upload uses TWINE_USERNAME/PASSWORD,
  not GITHUB_TOKEN, so no extra scope needed there.
- run_tests.yml: `contents: read` + `pull-requests: write` (for
  marocchino/sticky-pull-request-comment posting coverage results).
- run_tests_staging.yml / run_tests_prod.yml: `contents: read` only —
  these are scheduled callers that delegate to run_tests.yml, and the
  PR-comment step has `if: github.event_name == 'pull_request'` so it
  never fires on cron runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes Dependabot alerts #35, #37, #45, #46:
- CVE-2025-2953 (low) "PyTorch susceptible to local Denial of Service" — patched in 2.7.1-rc1
- CVE-2025-3730 (medium) "PyTorch Improper Resource Shutdown or Release" — patched in 2.8.0

These are dummy fixtures used by the SDK's runner-protocol tests, not
production SDK code. Bumping to 2.8.0 covers both CVEs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses remaining CodeQL and Dependabot security alerts by tightening default GITHUB_TOKEN permissions across GitHub Actions workflows and updating the pinned torch version used only in test runner fixtures.

Changes:

  • Add explicit permissions blocks to workflows to avoid overly broad default GITHUB_TOKEN scopes.
  • Grant job-scoped contents: write only where GitHub Releases are created.
  • Bump torch from 2.6.0 to 2.8.0 in test runner fixture requirements to pick up CVE fixes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/publish.yml Adds explicit workflow token permissions and scopes contents: write to the release job only.
.github/workflows/run_tests.yml Adds explicit token permissions for checkout and PR coverage commenting.
.github/workflows/run_tests_staging.yml Adds explicit contents: read permissions for scheduled staging test invocations.
.github/workflows/run_tests_prod.yml Adds explicit contents: read permissions for scheduled prod test invocations.
tests/runners/dummy_vllm_models/requirements.txt Updates test-fixture torch pin to 2.8.0.
tests/runners/hf_mbart_model/requirements.txt Updates test-fixture torch pin to 2.8.0.

Comment on lines +25 to +28
permissions:
contents: read
pull-requests: write # for sticky-pull-request-comment posting coverage results

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.

@copilot apply changes based on this feedback

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.

Done in commit 3e11ae6. Workflow-level permissions are now contents: read only. pull-requests: write has been moved to a new dedicated coverage-comment job that has if: github.event_name == 'pull_request' at the job level, so it never runs on push to master. The build job uploads code-coverage-results.md as an artifact (for Linux + Python 3.11 only), which the new job downloads before posting the PR comment.

… coverage-comment job

Agent-Logs-Url: https://github.com/Clarifai/clarifai-python/sessions/5d065865-0235-4e06-add6-90ef405f2466

Co-authored-by: sanjaychelliah <65780631+sanjaychelliah@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 62%
clarifai.cli.templates 67%
clarifai.cli.templates.toolkits 100%
clarifai.client 64%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 69%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 61%
clarifai.runners.pipeline_steps 45%
clarifai.runners.pipelines 77%
clarifai.runners.utils 61%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 56%
clarifai.utils 62%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
examples 64%
Summary 61% (12536 / 20612)

Minimum allowed line rate is 50%

@ackizilkale ackizilkale merged commit fd36387 into master May 6, 2026
17 of 19 checks passed
@ackizilkale ackizilkale deleted the fix/codeql-workflow-permissions-and-torch branch May 6, 2026 18:44
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.

4 participants