Skip to content

fix: Fix DB configuration in docker-compose file - #920

Open
t-naumenko wants to merge 2 commits into
mainfrom
fix-db-config
Open

t-naumenko wants to merge 2 commits into
mainfrom
fix-db-config

Conversation

@t-naumenko

Copy link
Copy Markdown
Collaborator

Pull Request

Description

Fixes an insecure default database configuration in the shipped Docker Compose
deployments. docker-compose.yml and docker-compose-quick.yml started MySQL
as root with an empty password and published port 3306 to the host
(docker-compose-quick.yml additionally set MYSQL_ALLOW_EMPTY_PASSWORD=yes).
Since these are the documented quick-start deployment path, anyone able to
reach the published port could connect to the database as root without
credentials and read/write all LPVS data.

CVSS 3.1: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
CWE-1392 (Use of Default Credentials), CWE-258 (Empty Password in
Configuration File), CWE-16 (Configuration), CWE-668 (Exposure of Resource to
Wrong Sphere)

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing

Verified manually with docker compose (Docker Compose v2), against both docker-compose.yml and docker-compose-quick.yml:

  • docker compose config with no .env present fails immediately with the Set MYSQL_ROOT_PASSWORD in .env ... error, instead of silently starting with empty credentials.
  • With .env populated, docker compose up -d mysqldb initializes cleanly with no permission errors.
  • Connected directly as the new non-root lpvs user and confirmed it has exactly the privileges the app needs: SHOW TABLES, plus ALTER TABLE (covers Hibernate's ddl-auto=update schema updates) succeed against the lpvs schema.
  • Confirmed via lsof/docker network inspect that port 3306 is no longer reachable from the host and the network holds no stray endpoints after docker compose down.
  • Confirmed the app's spring.datasource/database_dump.sql/Hibernate config do not require any privilege beyond standard DDL/DML on the lpvs schema (no GRANT/CREATE USER/system-schema access anywhere in the codebase), so the least-privilege user is sufficient for both the regular and quick-start scenarios (they share the same lpvs/mysqldb service definitions — docker-compose-quick.yml only adds an ngrok tunnel on top)

Test Configuration:

  • Java: v17
  • Docker Compose: v2
  • LPVS Release: v2.2.4 (main)

Checklist:

  • My code follows the style guidelines of this project
  • My code meets the required code coverage for lines (90% and above)
  • My code meets the required code coverage for branches (80% and above)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Tetiana Naumenko <t.naumenko@samsung.com>
@t-naumenko t-naumenko added this to the v2.2.5 milestone Sep 9, 2026
@t-naumenko t-naumenko self-assigned this Sep 9, 2026
@t-naumenko t-naumenko added documentation Improvements or additions to documentation docker Pull requests that update Docker code fix labels Sep 9, 2026
@codecov-commenter

codecov-commenter commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.67%. Comparing base (e3b6c56) to head (e0f4816).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #920   +/-   ##
=========================================
  Coverage     93.67%   93.67%           
  Complexity      427      427           
=========================================
  Files            30       30           
  Lines          1801     1801           
  Branches        233      233           
=========================================
  Hits           1687     1687           
  Misses           49       49           
  Partials         65       65           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Tetiana Naumenko <t.naumenko@samsung.com>

@o-kopysov o-kopysov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
We need to re-generate documentation after merging PR.

@tdrozdovsky tdrozdovsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update Docker code documentation Improvements or additions to documentation fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants