feat(docker): Drop nginx debian#12998
Conversation
|
This pull request contains findings related to potential command injection vulnerability, information disclosure through workflow logs, and an unpinned Docker image version, with none of the issues being considered blocking risks.
Information Disclosure via `set -x` in
|
| Vulnerability | Information Disclosure via set -x |
|---|---|
| Description | The set -x command in the GitHub Actions workflow causes commands to be printed to the workflow logs after variable expansion. The command docker buildx imagetools create -t "${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:latest" ${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:${{ inputs.release_number }} uses the ${{ inputs.release_number }} variable. While release_number itself is not inherently sensitive, if a user were to provide sensitive information in this input field, it would be exposed in plain text in the public workflow logs. The env.DOCKER_ORG and matrix.docker-image variables are also exposed, but these are not typically sensitive. |
Unpinned Docker Image Version in .github/workflows/integration-tests.yml
| Vulnerability | Unpinned Docker Image Version |
|---|---|
| Description | The CI/CD workflow explicitly sets the NGINX_VERSION environment variable to alpine. This floating tag is then used in the docker-compose.yml file to specify the Nginx image version. Using a floating tag like 'alpine' instead of a specific version with a digest introduces a supply chain risk. The underlying image can change without any modification to the repository's code, leading to non-reproducible builds and the potential for new, unvetted vulnerabilities to be introduced automatically. |
django-DefectDojo/.github/workflows/integration-tests.yml
Lines 73 to 86 in c2bb89f
Command Injection in .github/workflows/release-x-manual-tag-as-latest.yml
| Vulnerability | Command Injection |
|---|---|
| Description | The inputs.release_number from the workflow dispatch trigger is directly interpolated into a shell command executed via run:. This allows an attacker with permissions to trigger the workflow to inject arbitrary shell commands. For example, if inputs.release_number is set to 1.0.0; rm -rf /, the rm -rf / command would be executed on the GitHub Actions runner. |
All finding details can be found in the DryRun Security Dashboard.
30756cf to
90de57d
Compare
2dfd892 to
22375b1
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
22375b1 to
a2409db
Compare
a2409db to
c2bb89f
Compare
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
mtesauro
left a comment
There was a problem hiding this comment.
I'm actually not a fan of musl c library vs glibc but since the final base image of Nginx is Alpine, I agree that mixing Debian and Alpine doesn't make sense for the Nginx image.
There was a problem hiding this comment.
Approved is in itself it looks OK. However I think we should consider droppding Debian alltogether, i.e. also for the django image. Although I am a fan of Debian, the go-to base image seems to be alpine for most projects. The images will be ~20% smaller as well. And we can simplify our workflows, plus reduce the maintenance load on version update PRs.
cc @mtesauro @Maffooch
Fully agree with this. I'm happy to help with this, but I would do it step by step (now nginx, next django). |
|
@valentijnscholten @kiblik I've been working on wolfi based images to provide hardened containers for the project. I'd prefer to keep the Debian images around until we have a hardened replacement that uses glibc TBH. The reason I'm not a fan of Alpine is the choice of musl and the strange bugs that can slip in when most distros use glibc. glibc has much better QA / QE / testing coverage due to it's much wider usage. Here's an example of these odd and painful bugs - or here or here. Networks keep getting faster and disk storage is ridiculously cheap so trading off better tested underlying OS vs image size feels like a pretty good trade to me. |
|
@rossops leaving the last approval to you so that you're aware of this change |
|
In think the situation around Alpine had improved over the years. But I don't have a strong opinion on which distro to use. But I would like to switch to one distro only at some point 😄 |
I agree with the idea of a single distro for our containers. Give me bit to finish the hardened containers and I think everyone will be happy as they should have few to no vulns and be as small as feasible. |
Both Django and Nginx have been available for a long time in Debian and Alpine alternatives. However, Nginx has never been the true Debian image. Yes, Debian was used in the building phase, but only for running
collectstatic. But final image is based on Alpine every time.django-DefectDojo/Dockerfile.nginx-debian
Line 76 in 2b63f9e
This PR drops support for building the nginx-debian image and supports only nginx-alpine.