Repository navigation
chore(ci): hardening workflows using zizmor - #2292
Conversation
05012f2 to
df9cfd9
Compare
IceTDrinker
left a comment
There was a problem hiding this comment.
Thanks that's already a huge bit you did here
Reviewed 52 of 64 files at r1, 18 of 18 files at r2, all commit messages.
Reviewable status: all files reviewed, 17 unresolved discussions (waiting on @nsarlin-zama)
.github/workflows/aws_tfhe_backward_compat_tests.yml line 131 at r2 (raw file):
echo "PULL_REQUEST_MD_LINK=[pull-request](${PR_BASE_URL}${{ github.event.pull_request.number }}), " >> "${GITHUB_ENV}" env: PR_BASE_URL: ${{ vars.PR_BASE_URL }}
what's vars ?
.github/workflows/benchmark_gpu.yml line 78 at r2 (raw file):
run: | echo "${INPUTS_PROFILE}" | sed 's|\(.*\)[[:space:]](.*)|\1|' echo "profile=$?" >> "${GITHUB_OUTPUT}"
$? is the exit code ?
.github/workflows/benchmark_gpu.yml line 84 at r2 (raw file):
run: | echo "${INPUTS_PROFILE}" | sed 's|.*[[:space:]](\(.*\))|\1|' echo "name=$?" >> "${GITHUB_OUTPUT}"
same here
.github/workflows/benchmark_gpu.yml line 99 at r2 (raw file):
all_precisions: ${{ inputs.all_precisions }} secrets: BOT_USERNAME: ${{ secrets.BOT_USERNAME }}
this is a way to restrict secret access ?
.github/actions/gpu_setup/action.yml line 47 at r1 (raw file):
shell: bash run: | CUDA_PATH=/usr/local/cuda-${CUDA_VERSION}
unquotted var expand
.github/workflows/approve_label.yml line 10 at r1 (raw file):
permissions: {}
what are empty permissions ?
.github/actionlint.yaml line 22 at r1 (raw file):
# Sed is used to extract a value from a string in our case, this task cannot be # performed by the ${variable//search/replace} pattern. - 'shellcheck reported issue in this script: SC2001:.+'
let's avoid disabling lints, if there are other ways to perform the same thing let's use that, otherwise you may use python as the shell for a step
.github/workflows/benchmark_signed_integer.yml line 66 at r2 (raw file):
run: | echo "OP_FLAVOR=[\"default\"]" >> "${GITHUB_ENV}" if [[ "${INPUTS_BENCH_TYPE}" == "both" ]]; then
missing env var setup ?
.github/workflows/benchmark_integer.yml line 66 at r2 (raw file):
run: | echo "OP_FLAVOR=[\"default\"]" >> "${GITHUB_ENV}" if [[ "${INPUTS_BENCH_TYPE}" == "both" ]]; then
missing env var setup ?
.github/workflows/aws_tfhe_backward_compat_tests.yml line 90 at r1 (raw file):
id: backward_compat_sha run: | SHA=$(git ls-remote ${{ env.REPO_URL }} refs/heads/"${BACKWARD_COMPAT_BRANCH}" | awk '{print $1}')
replace the ${{ env.REPO_URL }} by ${REPO_URL}, also make sure it is quoted ?
or maybe replace by the url directly ?
.github/workflows/aws_tfhe_backward_compat_tests.yml line 108 at r1 (raw file):
with: persist-credentials: 'false' token: ${{ env.CHECKOUT_TOKEN }}
${{ secrets.CHECKOUT_TOKEN }}
?
.github/workflows/benchmark_shortint.yml line 123 at r2 (raw file):
--database tfhe_rs \ --hardware "hpc7a.96xlarge" \ --project-version "${{ env.COMMIT_HASH }}" \
don't use env. when it's an env var, use the ${} expansion directly
.github/workflows/benchmark_shortint.yml line 125 at r2 (raw file):
--project-version "${{ env.COMMIT_HASH }}" \ --branch "${REF_NAME}" \ --commit-date ${{ env.COMMIT_DATE }} \
here as well
.github/workflows/benchmark_shortint.yml line 126 at r2 (raw file):
--branch "${REF_NAME}" \ --commit-date ${{ env.COMMIT_DATE }} \ --bench-date "${{ env.BENCH_DATE }}" \
and again
.github/workflows/benchmark_gpu_erc20.yml line 36 at r2 (raw file):
run: | echo "${INPUTS_PROFILE}" | sed 's|\(.*\)[[:space:]](.*)|\1|' echo "profile=$?" >> "${GITHUB_OUTPUT}"
this is the exit code
.github/workflows/benchmark_gpu_erc20.yml line 42 at r2 (raw file):
run: | echo "${INPUTS_PROFILE}" | sed 's|.*[[:space:]](\(.*\))|\1|' echo "name=$?" >> "${GITHUB_OUTPUT}"
this is the exit code
.github/workflows/benchmark_zk_pke.yml line 80 at r2 (raw file):
if: github.event_name == 'workflow_dispatch' run: | if [[ "${INPUTS_BENCH_TYPE}" == "both" ]]; then
missing env var setup ?
|
Previously, IceTDrinker (Arthur Meyre) wrote…
This blocks all permissions for GITHUB_TOKEN, which are very (very) broad by default. |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
Sure |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
Nope, look in the top-level |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
It's an environment variable set up at the repository level (like any secrets) but it is handled as plaintext. |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
Hmm you're right, I've to find another way to do what I want. Maybe a python script like you mention above. |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
What do you mean ? |
|
Previously, IceTDrinker (Arthur Meyre) wrote…
Ok. |
7e200bb to
dc3eaab
Compare
soonum
left a comment
There was a problem hiding this comment.
Reviewable status: 52 of 64 files reviewed, 5 unresolved discussions (waiting on @IceTDrinker and @nsarlin-zama)
.github/actionlint.yaml line 22 at r1 (raw file):
Previously, IceTDrinker (Arthur Meyre) wrote…
let's avoid disabling lints, if there are other ways to perform the same thing let's use that, otherwise you may use python as the shell for a step
The only simple solution I can think of, is to reduce the globing of files to specific files.
.github/workflows/benchmark_gpu.yml line 99 at r2 (raw file):
Previously, soonum (David Testé) wrote…
What do you mean ?
Oh I got it. Yes you're right. If we use secrets: inherits then the sub workflow can see all of our secrets. This situation is not problematic as long as the sub-workflows are tfhe-rs ones.
b0ccfa1 to
7ed637d
Compare
IceTDrinker
left a comment
There was a problem hiding this comment.
Reviewed 7 of 12 files at r4, 31 of 35 files at r5, 5 of 5 files at r6, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nsarlin-zama)
.github/workflows/ci_lint.yml line 35 at r6 (raw file):
- name: Lint workflows run: | make lint_workflow
this does not run zizmor ? maybe group lints and security under lint_workflow ?
.github/actions/gpu_setup/action.yml line 29 at r6 (raw file):
sha256sum -c checksum bash cmake-"${CMAKE_VERSION}"-linux-x86_64.sh --skip-license sudo ln -s cmake-"${CMAKE_VERSION}"-linux-x86_64/bin/cmake /usr/local/bin
unclear this ln is correct, also you could put in in $HOME/.local/bin to avoid the sudo stuff
.github/actions/gpu_setup/action.yml line 34 at r6 (raw file):
env: CMAKE_VERSION: ${{ inputs.cmake-version }} CMAKE_SCRIPT_SHA: "6e4fada5cba3472ae503a11232b6580786802f0879cead2741672bf65d97488a"
having a variable version but a fixed sha seems weird, should be a fixed version as well ?
841015c to
32f58d9
Compare
54a595c to
bcc6fcf
Compare
This is part of security issues remediation campaign after having analyzed workflow using zizmor cargo tool.
Usage of bash script to download and extract the final binary has been dropped. Instead, the tarball is directly fetched according to the ACTIONLINT_VERSION value and the integrity of the tarball is checked with an hardcoded SHA256 sum.
This is redundant with the use of gpu_setup.yml action.
bcc6fcf to
d099228
Compare
IceTDrinker
left a comment
There was a problem hiding this comment.
Thanks!
Reviewed 2 of 2 files at r8, 5 of 5 files at r9, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @nsarlin-zama)

This is part of security issues remediation campaign after having analyzed workflows using zizmor cargo tool.
This change is