Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker entrypoints: use bash everywhere #11942

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Mar 4, 2025

Some entrypoint scripts where using sh which doesn't recognize if [[... used in places like wait_for_database_to_be_reachable

Fixes these errors on startup:

/entrypoint-uwsgi.sh: 21: [[: not found

Credits to @9alexx3 on Slack for suggesting this fix.

@github-actions github-actions bot added the docker label Mar 4, 2025
Copy link

dryrunsecurity bot commented Mar 4, 2025

DryRun Security Summary

The PR modifies Docker entrypoint scripts by switching from sh to bash and introduces potential security vulnerabilities related to file copying, sensitive script references, and exposed network endpoints.

Expand for full summary

The PR updates Docker entrypoint scripts by changing the shell interpreter from sh to bash across multiple files, with minor script modifications.

Security findings:

  1. In entrypoint-uwsgi.sh: Potential security risk in file copying mechanism from /app/docker/extra_settings/ directory, which could be exploited if an attacker can manipulate files in this location.
  2. Multiple scripts reference /secret-file-loader.sh and /reach_database.sh, which may contain sensitive configuration or credentials.
  3. Exposed HTTP endpoint on 0.0.0.0:8081 in entrypoint-uwsgi.sh for Kubernetes liveness checks, which requires careful network configuration.

Code Analysis

We ran 7 analyzers against 4 files and 0 analyzers had findings. 7 analyzers had no findings.

View PR in the DryRun Dashboard.

@kiblik
Copy link
Contributor

kiblik commented Mar 4, 2025

I would like to know how it is possible that the tests passed (like before this fix).

@valentijnscholten
Copy link
Member Author

I don't know all the intricate details of how sh and bash handle errors with or without set -e and within or outside of subshells and within or outside of functions.

Looking at this post: https://stackoverflow.com/questions/4072984/how-do-i-get-the-effect-and-usefulness-of-set-e-inside-a-shell-function I don't think I want to know :-)

Copy link
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

@valentijnscholten valentijnscholten changed the title entrypoints: use bash everywhere docker entrypoints: use bash everywhere Mar 8, 2025
@mtesauro mtesauro merged commit dcbb8a5 into DefectDojo:bugfix Mar 11, 2025
76 checks passed
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.

6 participants