ci: route github_release version parsing through env, not shell interpolation - #12230
Open
camgrimsec wants to merge 1 commit into
Open
ci: route github_release version parsing through env, not shell interpolation#12230camgrimsec wants to merge 1 commit into
camgrimsec wants to merge 1 commit into
Conversation
|
@camgrimsec is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Hi @camgrimsec, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
6 tasks
…polation
The Delete next version rc0 tag in the CI environment step parsed
${{ steps.version.outputs.current_release }} by interpolating it
directly into a bash here-string (IFS='.' read <<< "..."). The value
originates from VERSION.txt in the checked-out ref, so a poisoned
VERSION.txt on a fetched branch could inject a shell token into a step
that later runs git tag -d in a job with contents: write.
Route the value through the step env: block and reference it as
"$CURRENT_RELEASE" so the shell treats it as an opaque string.
Behavior is unchanged: same IFS split, same NEXT_MINOR arithmetic,
same NEXT_TAG format. Same env-var pattern used in the release
workflow (deepset-ai#11856, deepset-ai#11857).
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.
Proposed change
Follow-up in the same style as #11856 and #11857: move the one remaining
${{ ... }}expansion inside arun:body ingithub_release.ymlinto the step'senv:block.Before
After
Two lines added (an
env:header plusCURRENT_RELEASE:), one line changed ("$CURRENT_RELEASE"in place of the${{ }}inside the here-string). One file touched.Why
The value read here (
steps.version.outputs.current_release) is produced byawk -F \\- '{print $1}' < VERSION.txt, so today the here-string is safe as long asVERSION.txton the checked-out ref is well-formed. That's why this is a low-risk, mechanical change: it's the same pattern already used everywhere else in the release workflow after #11856 and #11857.The reason to keep extending it here:
contents: write(the job scope forncipollo/release-actionfurther down) and later invokesgit tag -d "$NEXT_TAG". If anything ever makes it intoVERSION.txtother thanawk's first-field (a manual edit, a partial commit on a release branch, a mis-parsed prerelease format), an unexpected token would land directly in the shell body.run:body reading a${{ steps.*.outputs.* }}value) and recommends passing it throughenv:.template-injectionhit forgithub_release.yml; every other${{ ... }}in the file is already either in anenv:block or anif:/with:field.What is not changed
awk -F \\- '{print $1}' < VERSION.txtparsing step above.IFS='.' read -r MAJOR MINOR _split and theNEXT_MINOR = MINOR + 1arithmetic.NEXT_TAGformat string.git rev-parse --verify/git tag -dcalls.Generate release notesstep, which already bindsEARLIEST_VERSIONviaenv:.The tag that gets deleted, the branch it's deleted from, and the condition under which the step runs are all identical to the previous behavior.
Verification
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/github_release.yml'))"succeeds.+3,-1) in one file.${{ ... }}expression that previously appeared inside arun:body in this file is now bound at the step'senv:.Checklist
Thanks.