Skip to content

Set workflow token permissions#27

Merged
glenn-jocher merged 1 commit into
mainfrom
fix-codeql-workflow-permissions
Apr 23, 2026
Merged

Set workflow token permissions#27
glenn-jocher merged 1 commit into
mainfrom
fix-codeql-workflow-permissions

Conversation

@glenn-jocher
Copy link
Copy Markdown
Member

@glenn-jocher glenn-jocher commented Apr 23, 2026

Summary

  • add explicit contents: read permissions to CI and Replicate push workflows

CodeQL alerts

Addresses:

Validation

  • Parsed workflow YAML with yaml.safe_load()
  • git diff --check

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

🔐 This PR updates GitHub Actions workflows to use explicit read-only repository permissions, improving CI/CD security without changing functionality.

📊 Key Changes

  • Added a top-level permissions block with contents: read to .github/workflows/ci.yml
  • Added the same permissions setting to .github/workflows/push.yml
  • Applies to both:
    • the main CI workflow
    • the workflow that pushes YOLO to Replicate

🎯 Purpose & Impact

  • Improves security by limiting GitHub Actions workflows to the minimum access they need 🛡️
  • Reduces risk from overly broad default token permissions in automated workflows
  • Aligns the repository with GitHub Actions security best practices ✅
  • Should have no impact on normal development or deployment behavior, since these workflows only need read access to repository contents 🚀

@UltralyticsAssistant UltralyticsAssistant added priority: low Low urgency; can wait behind higher-priority work. security Security-related events labels Apr 23, 2026
@UltralyticsAssistant
Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/replicate 🚀 PR! This is an automated message to help streamline review, and an engineer will assist you shortly. Please review the checklist below to support a smooth integration of your changes 🔐

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/replicate main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

Copy link
Copy Markdown
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

This PR looks clean. Adding top-level permissions: contents: read to both workflows is a sensible least-privilege hardening change, and nothing in the provided diff suggests a functional regression.

@glenn-jocher glenn-jocher merged commit 6c9e0c8 into main Apr 23, 2026
13 checks passed
@glenn-jocher glenn-jocher deleted the fix-codeql-workflow-permissions branch April 23, 2026 23:04
@UltralyticsAssistant
Copy link
Copy Markdown
Member

Merged! 🎉 Thanks for the thoughtful security improvement here, @glenn-jocher.

Adding explicit read-only permissions to the GitHub Actions workflows is a small change with meaningful impact, strengthening CI/CD security while keeping behavior unchanged. As Benjamin Franklin said, “An ounce of prevention is worth a pound of cure.” This update reflects that perfectly by reducing unnecessary access and aligning the repo with GitHub Actions best practices.

Really appreciate the care and attention to detail on this one 🙌

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

Labels

priority: low Low urgency; can wait behind higher-priority work. security Security-related events

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants