Skip to content

chore: add support for Git tag aliases in vuln GHA check #1065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025

Conversation

behnazh-w
Copy link
Member

Summary

This PR adds a utility function to identify the highest semantic version tag from a set of Git tags, specifically for cases where multiple tags point to the same commit SHA in a third-party GitHub Action. This is necessary because a single release may have multiple tag aliases, such as v4 and v4.2.1 and we want to consistently resolve to the most specific and recent tag.

Description of changes

The new find_highest_git_tag function uses Python’s packaging.version module to determine the highest (most recent) version according to semantic versioning rules. It handles common edge cases such as empty tag sets and invalid version strings, raising a custom GitTagError when appropriate.

This functionality is especially useful for automation workflows that need to programmatically resolve the latest stable tag associated with a GitHub Action or similar dependency, ensuring accurate and consistent version comparisons.

Related issues

This change addresses an issue where the v4 tag (an alias for v4.2.1) was incorrectly selected during the GitHub Action vulnerability check. Since v4 is numerically lower than the patched version v4.1.3, the check failed even though the underlying code was up to date. By resolving to the highest version (v4.2.1), this function ensures the highest tag is used if there are aliases.

@behnazh-w behnazh-w requested a review from tromai as a code owner April 23, 2025 05:52
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 23, 2025
tromai
tromai previously approved these changes Apr 23, 2025
@behnazh-w behnazh-w merged commit 25484be into main Apr 23, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants