-
-
Notifications
You must be signed in to change notification settings - Fork 24
[Core feature request] Pinning action versions to commit hashes updateable by bots #1691
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
Comments
Looking at the tj-actions/changed-files attack, it would be great to have:
generates:
Of course, it still has to be checked/verified at the PR level (e.g. when generated by Renovate or something), but a comment is a guide when briefly checking what version am I using. |
You currently can do @file:DependsOn("actions:checkout:b4ffde65f46336ab88eb53be808477a3936bae11") but you only get the untyped binding if the types are coming from the catalog. The bindings server would need to find out the nearest version in the ancestry of the Git history to then use the according types information from the catalog to get typed bindings. Alternatively, we could support a syntax like @file:DependsOn("actions:checkout:4.1.1__b4ffde65f46336ab88eb53be808477a3936bae11") or @file:DependsOn("actions:checkout:b4ffde65f46336ab88eb53be808477a3936bae11__4.1.1") or similar to have both information in the binding. To make this coooperate with dependency update bots, we would need to mark the group or name so that the bindings server knows what to put to the @file:DependsOn("actions:checkout___commit:4.1.1__b4ffde65f46336ab88eb53be808477a3936bae11") so that the |
I think we should think about implementing this because there's fairly strong signal (compared to other feature requests) that users need it - I recall several related discussions.
Right - in fact, it's a task on its own, even if we don't consider referring to action versions by (version, commit hash) pairs. API-wise, I'm leaning towards @file:DependsOn("actions:checkout:4.1.1__b4ffde65f46336ab88eb53be808477a3936bae11") because it's sortable, and the user first sees the version which is more informative. I think we'd also need a separate server route to return the right entries in |
While of course, this means it could again there deliver different results, depending on external state. 🤷♂️
Yes, also for returning multiple results and relying on proper sorting this would work better,
I don't think "server route" if that is really what you meant. It's open for discussion whether then with So in the light of the thoughts in the last paragraph I think we should only treat the version as version/commit pair if the |
Ah yes, it makes perfect sense. I forgot about our already introduced approach for listing versions optimized for version ranges.
I agree the more explicit
Not sure if I understand it. We should ensure that the pair is valid, that is: the version tag points to the commit hash specified in the pair. We don't want a situation where the commit hash points to v1.2.3 and the given version is v4.5.6, even if the typings happen to be compatible. |
I hope you miss a "not", otherwise I don't get what you mean.
You said "in fact, it's a task on its own, even if we don't consider referring to action versions by (version, commit hash) pairs.".
I'm not so sure about that. So we could be reluctant and have the user be responsible to give a senseful pair. Or we can be restrictive and verify that the given version is the version of that commit or the nearest version in the ancestry. Or some user has So I'm not so sure whether it might be better to here just trust what the user specified. |
Of course, sorry for that! Regarding validating the pair, thanks for outlining some problems that may indeed occur with it. While we can go with how vanilla GitHub Actions work and not validate the tag at all, I think we're in an unique position to provide some validation before even the workflow runs, and it would be a waste to not use this opportunity in some way. My intuition tells me that most of the time, the corresponding version tag exists, and if it ceases to exist, the user should know about it. For example, if the tag was removed because of a security concern, failing fast (not even letting the workflow to run) gives the user a chance to decide what to do in such case. This shifts the tradeoff towards correctness and safety by failing the workflow, which some users may not like. That's why while I'd push towards having the validation in the default, more convenient notation ( I think what we should do next is to put together something like an Architectural Decision Record that would describe various use cases and proposed API, what's not allowed, what the tradeoffs are, and so on. Inferring the final decisions from this discussion becomes more challenging, and such a summarizing step will be good also retrospectively. I can describe it and then we can move iterating on the API there, as PR comments. |
@Vampire @szpak here's an initial version of a design doc, to make the discussion and the description of the proposed approach more structured: https://github.com/typesafegithub/design-docs/blob/enhancements-commit-hash/2025-04-27%20Enhancements%20to%20referring%20to%20actions%20by%20commit%20hash.md. It still misses some details, or comparison of pros/cons, but I think it's a good starting point. We can comment on it in this PR: typesafegithub/design-docs#1 |
What feature do you need?
By default, when using a binding provided by the bindings server, we refer by the major or full version. It can be a branch or a tag. While major version tags/branches change and it's expected, full versions shouldn't. However, technically nothing stops the action owner to hard-reset some full version branch/tag to point to a different commit, and no one will notice it.
That's why, as a part of security hardening, some workflow owners use full SHA-1 of commits they want to use for each action. It guarantees the action's code won't silently change.
Users of github-workflows-kt can already do it using
_customVersion
constructor argument:However, dependency updating bots cannot update such commit hashes.
In theory we could try allowing such format when specifying a dependency on an action:
@file:DependsOn("actions:checkout:b4ffde65f46336ab88eb53be808477a3936bae11")
but then, even if we make this commit hash be updated to the right value, there's no mechanism to keep the full version in the comment, like shown in the below example.
Do you have an example usage?
Is there a workaround for not having this feature? If yes, please describe it.
No way to make the dependency updating bots work, just specifying the commit hash as version.
The text was updated successfully, but these errors were encountered: