Skip to content

feat(docker): Drop nginx debian#12998

Merged
Maffooch merged 1 commit intoDefectDojo:devfrom
kiblik:drop_nginx_debian
Aug 26, 2025
Merged

feat(docker): Drop nginx debian#12998
Maffooch merged 1 commit intoDefectDojo:devfrom
kiblik:drop_nginx_debian

Conversation

@kiblik
Copy link
Copy Markdown
Contributor

@kiblik kiblik commented Aug 15, 2025

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.

FROM nginx:1.28.0-alpine3.21@sha256:d83c0138ea82c9f05c4378a5001e0c71256b647603c10c186bd7697a4db722d3

This PR drops support for building the nginx-debian image and supports only nginx-alpine.

  • If there are no complaints about this idea in general, I will add related information to the release notes as well (I just do not want to waste time on writing it until it is clear that this PR will pass).
  • If this is accepted, it might be a good idea to also simplify the generation of Docker tags (but in a separate PR).

@kiblik kiblik requested review from mtesauro and valentijnscholten and removed request for Maffooch and mtesauro August 15, 2025 15:38
@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Aug 15, 2025

DryRun Security

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 .github/workflows/release-x-manual-tag-as-latest.yml
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.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Tag with latest tags
run: |
set -x
docker buildx imagetools create -t "${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:latest" ${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:${{ inputs.release_number }}

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.

run: docker compose up --no-deps -d postgres nginx celerybeat celeryworker mailhog uwsgi redis
env:
DJANGO_VERSION: ${{ matrix.os }}
NGINX_VERSION: alpine
- name: Initialize
timeout-minutes: 10
run: docker compose up --no-deps --exit-code-from initializer initializer
env:
DJANGO_VERSION: ${{ matrix.os }}
NGINX_VERSION: alpine
- name: Integration tests
timeout-minutes: 10

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.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Tag with latest tags
run: |
set -x
docker buildx imagetools create -t "${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:latest" ${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}:${{ inputs.release_number }}


All finding details can be found in the DryRun Security Dashboard.

@kiblik kiblik requested a review from Maffooch August 15, 2025 15:38
@kiblik kiblik force-pushed the drop_nginx_debian branch from 30756cf to 90de57d Compare August 15, 2025 15:40
@kiblik kiblik marked this pull request as draft August 15, 2025 15:41
@kiblik kiblik mentioned this pull request Aug 15, 2025
@kiblik kiblik force-pushed the drop_nginx_debian branch 2 times, most recently from 2dfd892 to 22375b1 Compare August 15, 2025 20:20
@kiblik kiblik marked this pull request as ready for review August 17, 2025 18:56
Copy link
Copy Markdown
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not strongly opposed to dropping the debian nginx image - especially since it never really existed... @mtesauro are you good with this?

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@kiblik kiblik force-pushed the drop_nginx_debian branch from 22375b1 to a2409db Compare August 22, 2025 19:36
@kiblik kiblik force-pushed the drop_nginx_debian branch from a2409db to c2bb89f Compare August 22, 2025 19:39
@github-actions
Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/release-x-manual-docker-containers.yml
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kiblik
Copy link
Copy Markdown
Contributor Author

kiblik commented Aug 24, 2025

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.

Fully agree with this. I'm happy to help with this, but I would do it step by step (now nginx, next django).
And I agree. Alpine is a more Docker-preferred solution. It is much smaller, and on average, there are fewer vulnerabilities.

@kiblik kiblik requested review from Maffooch and mtesauro August 24, 2025 10:18
@mtesauro
Copy link
Copy Markdown
Contributor

@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.

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Maffooch Maffooch requested a review from rossops August 25, 2025 02:34
@Maffooch
Copy link
Copy Markdown
Contributor

@rossops leaving the last approval to you so that you're aware of this change

@valentijnscholten
Copy link
Copy Markdown
Member

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 😄

@mtesauro
Copy link
Copy Markdown
Contributor

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.

@Maffooch Maffooch merged commit 4147b68 into DefectDojo:dev Aug 26, 2025
84 checks passed
@kiblik kiblik deleted the drop_nginx_debian branch August 26, 2025 06:02
@valentijnscholten valentijnscholten added this to the 2.50.0 milestone Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants