Repository navigation
ci: Resolve ref-version-mismatch, stale-action-refs, superfluous-actions, and unpinned-uses - #742
Open
hashcatHitman wants to merge 2 commits into
Conversation
See: https://github.com/actions/checkout/releases/tag/v6.0.2 See: https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd..0c366fd6a839edf440554fa01a7085ccba70ac98 The only difference is the update to the changelog. Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
| toolchain: ${{ matrix.rust }} | ||
| - run: rustup toolchain add ${TOOLCHAIN} && rustup default ${TOOLCHAIN} | ||
| env: | ||
| TOOLCHAIN: ${{ matrix.rust }} |
Collaborator
There was a problem hiding this comment.
Why can't we use dtolnay/rust-toolchain?
Member
Author
There was a problem hiding this comment.
- It doesn't really offer much over using
rustupdirectly, especially for very simple toolchain needs like we have here. So using this action instead of the pre-installedrustupdoes extra work and increases our attack surface/supply chain risk. Even ifdtolnayalready has write access to this repo (I don't know if they do or not), depending on this action when we don't need to is just a possible path to compromise in the future when they might not have write access anymore. (which, to be clear, I am not suggesting I thinkdtolnayis going to try to do anything. I am suggesting ifdtolnaywere to have their account or credentials compromised, the attackers could then act on their behalf) - It doesn't have proper releases/tags. The only release/tag is v1, and the tag just gets moved around to new commits, making it impossible to properly satisfy
ref-version-mismatchandstale-action-refs. We could tellzizmor/crabwatchto ignore those lints, but because there's no proper version comment that would match the hash consistently, Dependabot can't keep this action updated. An alternative would be to track the literal tag v1 or themasterbranch itself, which should remove the need to update the action to get additional fixes, but that leads tounpinned-usesfailing, which is also not desirable. Similarly, we could configurezizmor/crabwatchto ignore that as well, but unless there's a concrete reason to prefer the action over usingrustupdirectly, it's just better for our security posture to do away with it.
Ultimately, my goal is just to get the lints to pass so we can enable them and improve our security posture across the rust-lang repos. It is preferable to replace the action with rustup directly, but if you have a reason to prefer the action, there are other ways I can satisfy the lints. If you do have a reason and want to keep using the action, I'd need to know if you'd rather stick on a commit, which puts you at risk of falling far behind on updates, or if you'd rather track the tag/branch directly, which leads to less stability and slightly increased supply chain risk over using a commit or rustup directly.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In pursuit of getting more
zizmorlints enforced acrossrust-langrepos throughcrabwatch, this PR fixes all findings of theref-version-mismatch,stale-action-refs,superfluous-actions, andunpinned-usesrules (there were no findings forunpinned-usesin this repo, though).For
actions/checkout, it seems 6.0.2 may have been re-tagged at some point. You can compare the old commit and the new commit here: https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd..0c366fd6a839edf440554fa01a7085ccba70ac98The only difference is changelog entries being added.
For
dtolnay/rust-toolchain, it seems like re-tagging is the only tagging it knows. Fortunately,rustupis already installed onubuntu-latest,windows-latest, andmacos-latest. Switching to usingrustupdirectly clearsref-version-mismatchandstale-action-refs, with the added benefit of clearingsuperfluous-actions.The hash pin format is supported by tools like Dependabot and Renovate, which can update the pinned hashes and their associated comments. If you'd like help setting either of those up, let me know which you prefer, and if you'd like it in this PR or a new one.