Repository navigation
fix(extract-version): pass inputs through the environment and check them - #27
Merged
Merged
Conversation
The composite action put the release tag, the PR number, the repository, the suffix and the workflow type straight into its script with ${{ }}, so a release tag name holding shell syntax ran in the calling job, which in a release holds id-token and packages write. Every input now reaches the script through env:, and each is checked before use: the release tag is v<major>.<minor>.<patch> with an optional -prerelease and +build, the PR number is digits, the repository is owner/name, the suffix is empty or -<tag characters>. A value with a line break can no longer add an output. Build metadata is dropped from the image tag only, since a container tag cannot hold "+".
This repository's own release workflow interpolated the tag the same way, and validated it only after the script had run and written its outputs; it now takes it through env: and validates before writing anything.
Tested by running the action's script with 14 inputs: valid release, release candidate, build metadata, PR and main values give the same outputs as before; $( ), ";", a line break, a missing v, a non-numeric PR number, a bad suffix and a bad repository are refused, and nothing in them runs. Every caller's existing release tags (bindy, bindcar, forage, kube-condition, sceau) pass the new check.
Signed-off-by: Erick Bourgeois <erick@jeb.ca>
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.
The composite action put the release tag, the PR number, the repository, the suffix and the workflow type straight into its script with ${{ }}, so a release tag name holding shell syntax ran in the calling job, which in a release holds id-token and packages write. Every input now reaches the script through env:, and each is checked before use: the release tag is v.. with an optional -prerelease and +build, the PR number is digits, the repository is owner/name, the suffix is empty or -. A value with a line break can no longer add an output. Build metadata is dropped from the image tag only, since a container tag cannot hold "+".
This repository's own release workflow interpolated the tag the same way, and validated it only after the script had run and written its outputs; it now takes it through env: and validates before writing anything.
Tested by running the action's script with 14 inputs: valid release, release candidate, build metadata, PR and main values give the same outputs as before; $( ), ";", a line break, a missing v, a non-numeric PR number, a bad suffix and a bad repository are refused, and nothing in them runs. Every caller's existing release tags (bindy, bindcar, forage, kube-condition, sceau) pass the new check.
Signed-off-by: Erick Bourgeois erick@jeb.ca