Skip to content

fix: [#277] remove public MySQL port exposure for security#278

Merged
josecelano merged 1 commit into
mainfrom
277-mysql-port-publicly-exposed
Jan 20, 2026
Merged

fix: [#277] remove public MySQL port exposure for security#278
josecelano merged 1 commit into
mainfrom
277-mysql-port-publicly-exposed

Conversation

@josecelano
Copy link
Copy Markdown
Member

Summary

Fixes a security vulnerability where MySQL port 3306 was publicly accessible from outside the VM, allowing anyone on the network to connect to the database.

Problem

The MySQL service in the Docker Compose template exposed port 3306 to all network interfaces:

ports:
  - "3306:3306"

This allowed external connections to the database:

$ mysql -h <VM_IP> -P 3306 -u tracker_user -p -e "SELECT 1;"
+---+
| 1 |
+---+
| 1 |
+---+

Solution

Removed the ports section from the MySQL service. The database remains accessible to the Tracker container through Docker's internal database_network, and the healthcheck still works because mysqladmin ping runs inside the container.

Changes

  • Removed ports: - "3306:3306" from MySQL service in docker-compose.yml.tera
  • Added security comment explaining why port is not exposed
  • Updated unit test to verify port is NOT exposed

Verification

Tested by deploying a MySQL environment and confirming:

  • nc -zv <VM_IP> 3306 times out (port not accessible externally)
  • ✅ All containers report healthy status including MySQL
  • ✅ Tracker can still connect to MySQL via internal Docker network

Related

Closes #277


Issue Specification: docs/issues/277-mysql-port-publicly-exposed.md

MySQL port 3306 was publicly accessible from outside the VM, allowing
anyone on the network to connect to the database. This posed a security
risk as the database credentials could be brute-forced.

Changes:
- Removed ports: - "3306:3306" from MySQL service in docker-compose
- Added security comment explaining why port is not exposed
- Updated unit test to verify port is NOT exposed

MySQL remains accessible to the Tracker via Docker's internal
database_network, and the healthcheck still works because mysqladmin
ping runs inside the container.

Closes #277
@josecelano
Copy link
Copy Markdown
Member Author

ACK b645f66

@josecelano josecelano merged commit 2d24c49 into main Jan 20, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: MySQL port 3306 is publicly exposed in Docker Compose configuration

1 participant