Repository navigation
Enforce HTTPS on VICAR downloads in runtime and builder Dockerfiles - #51
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…mages curl followed redirects with any protocol, so a redirect to plain HTTP would have been fetched. --proto =https limits the initial request and every redirect to HTTPS, --tlsv1.2 sets the TLS floor, and -f fails the build on an HTTP error instead of handing an error page to tar. Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Project Requirements: PASSPR #51 is a small hardening change. In terrain-intelligence-generator/docker/Dockerfile and builder/Dockerfile, the four VICAR release downloads change from
3. Test coverage
Automated pre-check hints
Evaluated at Criteria: |
Summary
Fixes the four SonarCloud
docker:S6506alerts by enforcing HTTPS on the VICAR release downloads. The fourdocker:S6471(root default user) alerts are left unfixed on purpose: switching any of these images to a non-root default breaks documented workflows today, and the changes needed to make it safe are in files owned by other in-flight security PRs (see below).--proto =httpsrestricts the first request and every redirect to HTTPS (GitHub redirects release assets torelease-assets.githubusercontent.com, which stays HTTPS).--tlsv1.2sets a TLS floor.-fmakes a 4xx/5xx fail theRUNstep instead of passing an HTML error page totar. The image contents don't change.Alert mapping
docker/Dockerfile:26--proto "=https" --tlsv1.2 -fLdocker/Dockerfile:53builder/Dockerfile:53builder/Dockerfile:65docker/Dockerfile:99(runtime)builder/Dockerfile:14fullfeatured/Dockerfile:33visor/Dockerfile:22Why the non-root default (S6471) isn't in this PR
These are interactive tool containers that write output into a bind-mounted host directory. The
tigCLI already drops root where it can: on Linux it runs with--user $(id -u):$(id -g)(Docker) or--userns keep-id(rootless Podman), inspec.pybuild_run_specandbuild.py. AUSERline in the image doesn't change those paths. It does break every path that relies on the image default:docs/install-macos.md).spec.pyandbuild.pyskip--user/keep-idwhensys.platform == "darwin", so the container runs as the image's default user.podman machineis rootless Podman in a Linux VM, and only container root maps to the VM user that owns the shared home directory. Reproduced with rootless Podman on Linux, using a workspace owned by the invoking user:tigandtig --build(builder image) would no longer be able to write outputs on macOS/Podman.docker run -v $PWD:/workspace ..., as documented in the release notes generated bybuild-publish-terrain-intelligence-generator.yml, interrain-intelligence-generator/README.md/docs/demos/building-from-source.md(builder), and inbuild-builder-image.sh. A fixed image uid only works when it happens to match the host uid. With amktemp -dworkspace owned by uid 1001 (the GitHub runner uid),docker run --user 1000:1000 -v $D:/workspace→Permission denied.test-visor-image.sh(MSL marsrad step),test-fullfeatured-image.sh,test-docker-image.sh,test-product-pipeline.sh, and the inline tests in the build workflow all write into amktemp -dbind mount without--user. The visor and fullfeatured variant workflows run their tests on pull requests, so this PR would go red.All the files needed to make a non-root default safe (
tig-cli/src/tig_cli/spec.py, the workflows, thetest-*.shscripts) belong to the other security PRs running in parallel, so changing them here would cause conflicts. Suggested follow-up once those merge:spec.py/build.py, pass--userns keep-idfor Podman on macOS as well (Docker Desktop already maps ownership);--user "$(id -u):$(id -g)"to the test scripts, the workflow's inline tests, and the documenteddocker runexamples;tiguser (fixed uid) andUSER tigtodocker/andbuilder/, and invisor/+fullfeatured/switchUSER root→ install calibration →USER tig. Note thatexamples/airflow-k8s-pipeline/k8s/worker/Dockerfilealready setsUSER rootbefore itsRUN, so it isn't affected.Verification
settings.xml, not committed):docker/Dockerfile→EXIT 0,builder/Dockerfile→EXIT 0. Both VICAR tarballs downloaded through the new flags../terrain-intelligence-generator/test-docker-image.sh tig-runtime:https-test→ 15 passed, 0 failed.docker run --user $(id -u):$(id -g) -v $PWD:/build <builder> bash -c 'cp $V2TOP/p2/prog/gen/gen.* /build/ && vicar-build gen'→gencompiled and linked.oraclelinux:8(curl 7.61.1): both release URLs resolve with the new flags (1 redirect, HTTPS, HTTP 206 on a range request).curl --proto "=https"refuses anhttp://URL and an HTTPS→HTTP redirect (Protocol "http" not supported or disabled).RUNstep itself, and the only CI-wired places for an image test are the workflows/test-*.shscripts owned by the parallel PRs.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/3b988076be934f7bb6332ef577d5a516
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/3b988076be934f7bb6332ef577d5a516?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings