fix: sonarqube findings#125
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
There are several good hardening changes here: moving action inputs through env vars, verifying downloaded artifacts, A few things I’d fix before merge:
The archived-template deletion is large and probably fine if intentional, but it makes this PR much harder to audit |
TimPietruskyRunPod
left a comment
There was a problem hiding this comment.
Requesting changes (details inline). Shell hardening ([[ ]], quoted expansions, passing inputs via env: to avoid ${{ }} shell injection) and the verified/pinned downloads all look good.
- PR says third-party actions are SHA-pinned, but several are still floating.
sonarqube.ymltriggers onpush:for all branches.- whitespace/newline nits (also noted by @kodxana).
TimPietruskyRunPod
left a comment
There was a problem hiding this comment.
Both requested changes are in and verified: third-party actions are now pinned to commit SHAs across the workflows/composite actions, and sonarqube.yml is scoped to push: [main] + pull_request. Thanks!
Summary
Addresses all SonarQube findings on the active codebase except one Security Hotspot ("container running as root") which is tracked separately. Also cleans up long-archived templates and bumps
RELEASE_VERSIONto1.0.6.Shell-script hardening (Bash & SonarQube
bash:*)[ ... ]→[[ ... ]]everywhere (bake.sh,container-template/start.sh,scripts/update-template-readme.sh,official-templates/*/pre_start.sh,official-templates/*/Dockerfile).$VAR→"$VAR") so paths with spaces / unset vars don't silently misbehave (start.shSSH-host-key block, Jupyter token, etc.).>&2) inscripts/update-template-readme.sh.pytorch/Dockerfile: enableSHELL ["/bin/bash", "-o", "pipefail", "-c"]and splitTORCH="torch==X torchvision==Y ..."into a real array withread -ra TORCH_PKGS <<<so each pin reachespipas a separate argument.Supply-chain pinning + integrity checks (
docker:*, GH Actions)docker/bake-action→6614cfa25e...reviewdog/action-shellcheck→4c074582...SonarSource/sonarqube-scan-action→7006c449...sonarsource/sonarqube-quality-gate-action→cf038b0e...curl | bash:get-pip.py: pinned to commit0d4515b4; separate hashed copy for Python 3.9 (pip/3.9/get-pip.py).filebrowser: pinned tov2.63.5, replaces the upstreamcurl … | bashinstaller with verified tarball.runpodctl(autoresearch): pinnedv2.3.0, SHA-256 verified.--proto '=https' --tlsv1.2.base/requirements.txt: pinhf_transfer,ipywidgets,jupyter-archive.autoresearch/Dockerfile:uv sync --frozen --no-buildso no source-distributionsetup.pyruns at build time.GitHub Actions injection hardening (
github-actions:*).github/actions/update-readme/action.ymlno longer interpolates${{ inputs.* }}directly into shell scripts. Inputs are passed asenv:vars (TEMPLATE_PATH,TEMPLATE_ID) and referenced as"${TEMPLATE_PATH}", etc.packages: writepermission frombase.yml,nvidia.yml,rocm.yml.HTML hardening (
Web:*,javascript:*) incontainer-template/proxy/readme.html<html lang="en">.integrity="sha512-…",crossorigin="anonymous",referrerpolicy="no-referrer".type="module"so we canawaitcleanly and ditch the.then(...)chain.Welcome-banner fix
base/Dockerfile: bashrc banner was usingprintf "%s"with embedded\n, which rendered literal\nin the SSH login screen. Switched to a heredoc (cat <<'BANNER' … BANNER) so newlines and prompt formatting render correctly.SonarQube setup
.github/workflows/sonarqube.yml: scan + quality-gate job on every push.sonar-project.propertieswith project key and a coverage exclusion forscripts/scrub-stale-metadata.py.Cleanup
archived/(kasm-desktop, discoart, bittensor, fast-stable-diffusion, invokeai, oobabooga, stable-diffusion-comfyui, stable-diffusion-webui, tensorflow, vs-code, vscode-server, plus archivedpytorch). Net-13 581 / +153lines — these have been unused for releases and were generating SonarQube noise.RELEASE_VERSION1.0.5→1.0.6.Known remaining SonarQube finding
One Security Hotspot is intentionally left for a follow-up PR:
Follow-ups
setcap/ explicitUSER rootblocks).