Skip to content

🌱 harden git workflows#2512

Open
PrashantR30 wants to merge 1 commit into
NVIDIA:mainfrom
PrashantR30:main
Open

🌱 harden git workflows#2512
PrashantR30 wants to merge 1 commit into
NVIDIA:mainfrom
PrashantR30:main

Conversation

@PrashantR30

@PrashantR30 PrashantR30 commented Jun 2, 2026

Copy link
Copy Markdown

Description

This PR hardens GitHub Actions workflows by disabling persisted Git credentials on checkout steps and explicitly scoping workflow permissions to the minimum required access.

The changes reduce the risk of unintended GITHUB_TOKEN exposure to later workflow steps while preserving existing CI behavior. Workflows that only read repository contents now use read-only permissions, while image publishing workflows keep the required package write permissions.

Checklist

  • No secrets, sensitive information, or unrelated changes
  • removed actions: write as the workflow only uses actions/stale to label, comment on, and close issues and does not appear to require permissions to manage workflow runs or other GitHub Actions resources.
  • Lint checks passing (make lint)
  • Generated assets in-sync (make validate-generated-assets)
  • Go mod artifacts in-sync (make validate-modules)
  • Test cases are added for new code paths

Testing

Validated the workflow YAML changes manually.
No application code was changed. This PR only updates GitHub Actions workflow configuration for credential and permission hardening, but still we let the test run to validate if the workflow operation works.

@copy-pr-bot

copy-pr-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@PrashantR30 PrashantR30 force-pushed the main branch 3 times, most recently from 0936b38 to c53cfa8 Compare June 3, 2026 10:36
@rahulait

rahulait commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Thanks @PrashantR30 for this change. Is there a specific reason why a subset of workflows were updated? For example, coverage.yaml, release-images-list.yaml, etc were not touched.

Comment thread .github/workflows/image-builds.yaml Outdated
timeout-minutes: 15
permissions:
contents: read
packages: write

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.

This seems like giving more than needed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually with

permissions:
  contents: read
  packages: write

I wanted to guarantee:

  1. can read repository
  2. can push GHCR manifest
  3. cannot modify PRs
  4. cannot modify issues
  5. cannot create releases
  6. cannot push commits

So from a security-hardening perspective, I was thinking it is better than relying on the defaults permissions.

@PrashantR30 PrashantR30 force-pushed the main branch 3 times, most recently from 7fcac6c to 0ada2f6 Compare June 15, 2026 14:40
Signed-off-by: PrashantR30 <pramhit@mirantis.com>
- uses: actions/checkout@v6
name: Check out code
with:
persist-credentials: false

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.

indentation error

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.

3 participants