Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#86

Merged
glenn-jocher merged 1 commit into
mainfrom
alert-autofix-1
May 15, 2025
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#86
glenn-jocher merged 1 commit into
mainfrom
alert-autofix-1

Conversation

@glenn-jocher
Copy link
Copy Markdown
Member

@glenn-jocher glenn-jocher commented May 15, 2025

Potential fix for https://github.com/ultralytics/thop/security/code-scanning/1

To fix the issue, we will add a permissions block to the notify job. Based on the job's functionality, it only needs contents: read to access repository metadata and statuses: read to check the status of previous jobs. No write permissions are required. This change will explicitly limit the permissions of the GITHUB_TOKEN for the notify job.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved GitHub Actions workflow security by specifying required permissions for publishing. 🔒

📊 Key Changes

  • Added explicit permissions (contents: read, statuses: read) to the publish workflow job in GitHub Actions.

🎯 Purpose & Impact

  • Enhances security by limiting workflow access to only necessary repository data.
  • Follows GitHub best practices for workflow permissions, reducing potential risks.
  • No impact on end users or package functionality; this is a behind-the-scenes improvement for maintainers.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@UltralyticsAssistant UltralyticsAssistant added devops GitHub Devops or MLops enhancement New feature or request labels May 15, 2025
@glenn-jocher glenn-jocher marked this pull request as ready for review May 15, 2025 19:14
@UltralyticsAssistant
Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a PR to ultralytics/thop 🚀! This is an automated response to help ensure a smooth review process. An Ultralytics engineer will also assist you soon.

  • Define a Purpose: Please ensure the purpose of your fix is clearly described in your PR, and consider linking to any relevant issues if you haven't already. Clear commit messages that follow project conventions are appreciated.
  • Synchronize with Source: Make sure your PR is up to date with the main branch of ultralytics/thop. If needed, update by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Please confirm that all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, kindly address them.
  • Update Documentation: If your changes affect any features or workflows, update the documentation as needed.
  • Add Tests: If applicable, add or update tests to cover your changes and verify all tests pass successfully.
  • Sign the CLA: If this is your first Ultralytics PR, please sign our Contributor License Agreement (CLA) by commenting "I have read the CLA Document and I sign the CLA".
  • Minimize Changes: Please keep your changes to the minimum required for your fix. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

You can find more details in our Contributing Guide. If you have any questions, feel free to ask. Thank you for helping make Ultralytics even better! 🔒✨

@glenn-jocher glenn-jocher merged commit e3aee1c into main May 15, 2025
4 checks passed
@glenn-jocher glenn-jocher deleted the alert-autofix-1 branch May 15, 2025 19:15
@UltralyticsAssistant
Copy link
Copy Markdown
Member

Fantastic work, @glenn-jocher! 🚀 Merging this PR marks another important step in strengthening our project’s security practices. As Benjamin Franklin once said, “An ounce of prevention is worth a pound of cure”—your attention to detail in refining our workflow permissions truly embodies this wisdom. Thank you for helping to safeguard our repository and setting a great example for best practices. Your contributions are deeply appreciated!

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

Labels

devops GitHub Devops or MLops enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants