Repository navigation
Potential fix for code scanning alert no. 1: Workflow does not contain permissions - #110
Conversation
โฆ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>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
|
๐ Hello @glenn-jocher, thank you for submitting an
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! ๐ ๐ ๏ธ PR SummaryMade with โค๏ธ by Ultralytics Actions ๐ SummaryAdds explicit write permissions to the GitHub Actions โTag and Releaseโ workflow to ensure it can create tags and releases โ ๐ Key Changes
๐ฏ Purpose & Impact
|
|
๐ Great merge, @glenn-jocher โ thank you! โSimplicity is the ultimate sophistication.โ โ Leonardo da Vinci. Your update to set explicit Appreciate the clean, pragmatic improvement! See details in the merged pull request #110. ๐ |
Potential fix for https://github.com/ultralytics/assets/security/code-scanning/1
To fix the problem, explicitly declare the least-privileged
permissionsblock in the workflow configuration. This should be set at the root level (applies to all jobs unless overridden), or directly within thetag-and-releasejob definition. For this workflow, since it creates tags and releases, it needscontents: write(for tagging and release creation). If the workflow also uses the API in other ways (e.g., managing issues or PRs), other permissions may be required, but for the observed steps,contents: writeshould suffice.The minimal fix is to add:
at the root of the YAML file (after the
namekey and beforeon:), applying least privilege for the necessary GITHUB_TOKEN operations.Specifically:
.github/workflows/tag.ymlname: Tag and Release.No additional imports or external code are required.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
๐ ๏ธ PR Summary
Made with โค๏ธ by Ultralytics Actions
๐ Summary
Adds explicit GitHub Actions permissions to allow the Tag and Release workflow to create tags/releases reliably. ๐ง๐
๐ Key Changes
contents: writein.github/workflows/tag.yml.๐ฏ Purpose & Impact
GITHUB_TOKEN, preventing permission-related failures. โ