OWASP / OWASP/SecurityShepherd
Move database configuration from build-time to runtime environment variables
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 515
- Avg merge
- 3h 46m
- Merged PRs (30d)
- 1
Description
Problem
Database configuration (database.properties, mongo.properties) is currently generated at Docker image build time via printf in the Dockerfile (line 28-29). This has several drawbacks:
- Changing any setting requires rebuilding the image — admins can't tune pool sizes, timeouts, or credentials without a full rebuild
- New pool settings aren't exposed — the HikariCP connection pool settings (
pool.maximumPoolSize,pool.minimumIdle,pool.leakDetectionThreshold, etc.) added in #800 have no way to be configured in a standard deployment - Secrets baked into image layers —
DB_PASSis written viaprintfin aRUNstep, making it visible indocker image history
Proposed solution
Replace the build-time printf with a runtime entrypoint script that generates database.properties and mongo.properties from environment variables when the container starts.
Benefits
- Change settings by restarting the container, no rebuild needed
- Pool tuning via
.envordocker-compose.yml(e.g.DB_POOL_MAX_SIZE=20) - Secrets only exist at runtime, not in image layers
- Standard Docker pattern that admins expect
Example
# docker-compose.yml
environment:
- DB_HOST=secshep_mariadb
- DB_PORT=3306
- DB_USER=root
- DB_PASS=secret
- DB_SCHEMA=core
- DB_POOL_MAX_SIZE=10
- DB_POOL_MIN_IDLE=2
- DB_POOL_LEAK_DETECTION_THRESHOLD=60000
- MONGO_HOST=secshep_mongo
- MONGO_PORT=27017
An entrypoint script would generate the properties files from these env vars (with sensible defaults) before starting Tomcat.
Related
- #536 — connection exhaustion issue (motivation for pool settings)
- #800 — connection pooling implementation (adds configurable pool settings)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Dockerfile at lines 28-29 and inspect the existing database.properties and mongo.properties generation, then review the docker-compose.yml environment examples. Add a runtime entrypoint that creates both files before Tomcat starts, including the pool settings and sensible defaults. Done means configuration changes work after a restart and DB_PASS is not present in Docker image history.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, mariadb, mongodb
- Domain
- database, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100