Skip to content

Commit 73a970b

Browse files
authored
Merge commit from fork
* fix: variable interpolation/injection in scripts github actions variable interpolation works differently than interpolation in bash syntax. The only safe way for untrusted user input is in general to store it in an env variable for scripts to access and use plain old bash string interpolation. The place where variables are still interpolated 'raw' are places that are either guaranteed to be a commit hash, or a number, as per github action inputs. * be resilient against expansion in 'publish' workflow even though this requires elevated access, pass event input as an environment variable in the 'publish' workflow to avoid injection of arbitrary commands frrom the input string
1 parent 7cbe9e5 commit 73a970b

5 files changed

Lines changed: 29 additions & 22 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ jobs:
123123

124124
- name: Run js-framework-benchmark/webdriver-ts npm run bench
125125
working-directory: js-framework-benchmark/webdriver-ts
126-
run: xvfb-run npm run bench -- --framework keyed/yew keyed/yew-hooks --runner playwright --chromeBinary "${{ steps.setup-chrome.outputs.chrome-path }}"
126+
run: xvfb-run npm run bench -- --framework keyed/yew keyed/yew-hooks --runner playwright --chromeBinary "$CHROME_PATH"
127+
env:
128+
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
127129

128130
- name: Transform results to be fit for display benchmark-action/github-action-benchmark@v1
129131
run: |

.github/workflows/main-checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ jobs:
105105
- name: Run tests - yew
106106
run: |
107107
cd packages/yew
108-
CHROMEDRIVER=$(which chromedriver) cargo test --features csr,hydration,ssr,test --target wasm32-unknown-unknown
109-
GECKODRIVER=$(which geckodriver) cargo test --features csr,hydration,ssr,test --target wasm32-unknown-unknown
108+
CHROMEDRIVER="$(which chromedriver)" cargo test --features csr,hydration,ssr,test --target wasm32-unknown-unknown
109+
GECKODRIVER="$(which geckodriver)" cargo test --features csr,hydration,ssr,test --target wasm32-unknown-unknown
110110
111111
- name: Run tests - yew-router
112112
run: |
113113
cd packages/yew-router
114-
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown
115-
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown
114+
CHROMEDRIVER="$(which chromedriver)" cargo test --target wasm32-unknown-unknown
115+
GECKODRIVER="$(which geckodriver)" cargo test --target wasm32-unknown-unknown
116116
117117
unit_tests:
118118
name: Unit Tests on ${{ matrix.toolchain }}

.github/workflows/publish-api-docs.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ jobs:
4040
exit 1
4141
fi
4242
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
43-
echo "PR_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
44-
echo "COMMIT_SHA=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_ENV
43+
echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_ENV
44+
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
45+
env:
46+
PR_BRANCH: ${{ github.event.workflow_run.head_branch }}
47+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
4548

4649
- if: github.event.workflow_run.event == 'push'
4750
name: Apply push environment
@@ -59,5 +62,5 @@ jobs:
5962
commentURLPath: "/next/yew"
6063
# PR information
6164
prNumber: "${{ env.PR_NUMBER }}"
62-
prBranchName: "${{ env.PR_BRANCH }}"
65+
prBranchName: ${{ env.PR_BRANCH }}
6366
commitSHA: "${{ env.COMMIT_SHA }}"

.github/workflows/publish-website.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ jobs:
4040
exit 1
4141
fi
4242
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
43-
echo "PR_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
44-
echo "COMMIT_SHA=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_ENV
43+
echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_ENV
44+
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
45+
env:
46+
PR_BRANCH: ${{ github.event.workflow_run.head_branch }}
47+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
4548

4649
- if: github.event.workflow_run.event == 'push'
4750
name: Apply push environment
@@ -59,5 +62,5 @@ jobs:
5962
commentURLPath: "/docs/next"
6063
# PR information
6164
prNumber: "${{ env.PR_NUMBER }}"
62-
prBranchName: "${{ env.PR_BRANCH }}"
65+
prBranchName: ${{ env.PR_BRANCH }}
6366
commitSHA: "${{ env.COMMIT_SHA }}"

.github/workflows/publish.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,25 @@ jobs:
4747
version: =1.1.1
4848

4949
- name: Cargo login
50-
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
50+
run: echo ${{ secrets.CRATES_IO_TOKEN }} | cargo login
5151

52-
- name: Build command
52+
- name: Release yew
5353
shell: bash
5454
env:
5555
PACKAGES: ${{ github.event.inputs.packages }}
56+
LEVEL: ${{ github.event.inputs.level }}
5657
run: |
57-
output=""
58-
for pkg in ${{ github.event.inputs.packages }}
59-
do
60-
output+="--package $pkg "
58+
arguments=()
59+
for pkg in $PACKAGES; do
60+
arguments+=("--package" "$pkg")
6161
done
62-
echo "pkg=$output" >> $GITHUB_ENV
63-
64-
- name: Release yew
65-
run: cargo release ${{ github.event.inputs.level }} --execute --no-confirm ${{ env.pkg }}
62+
cargo release "$LEVEL" --execute --no-confirm "${arguments[@]}"
6663
6764
- name: Collect release info
6865
id: releaseinfo
69-
run: cargo run -p collect-release-info -- ${{ github.event.inputs.packages }}
66+
env:
67+
PACKAGES: ${{ github.event.inputs.packages }}
68+
run: cargo run -p collect-release-info -- $PACKAGES
7069

7170
- name: Create a version branch
7271
if: github.event.inputs.level != 'patch'

0 commit comments

Comments
 (0)