cytopia / cytopia/docker-dvwa

entrypoint appends to the config file, resulting in errors after

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
63
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Hello,

First of all, thanks for all the hard work on this container setup. We've done it in the past, but never as comprehensive as this project.

There is a small issue with how the PHP config is written. Namely, it appends on each container start, rather than overwriting it, and it's visible only when the PHP error logging is enabled. This becomes an issue if the container is restarted: the main page doesn't redirect to login.php, and all pages show a fair number of warnings (that number increments with each container restart).

https://github.com/cytopia/docker-dvwa/blob/master/docker/entrypoint.sh#L113

main page:
![image](https://github.com/cytopia/docker-dvwa/assets/3235494/5b2cb489-6ab1-4db9-93c1-fc75a8126e96)

login page:
![image](https://github.com/cytopia/docker-dvwa/assets/3235494/c5208bc5-9384-4c16-8194-b8180a0778e7)

One way to solve it would be to write out the entire file via entrypoint, without having a static config + dynamic append. For example, a combined version:

```
###
### Create configuration
###

cat > /var/www/html/config/config.inc.php <
EOF
```

Cheers!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in docker/entrypoint.sh around line 113 and inspect how /var/www/html/config/config.inc.php is written. Recreate the issue by restarting the container with PHP error logging enabled, then verify that the configuration is recreated rather than accumulated and that warnings do not increase across restarts.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php, shell
Domain
backend, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.