mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* fix(rds): grant the MySQL/MariaDB master user RDS-master-equivalent privileges The stock mysql/mariadb images grant MYSQL_USER only ALL on MYSQL_DATABASE plus USAGE, so a non-root master user cannot CREATE DATABASE, CREATE USER or GRANT. Real RDS master users perform these routinely, and the terraform and pulumi mysql providers run them right after connecting; against Floci they failed with ERROR 1044. After the DB container starts, exec a root GRANT ALL PRIVILEGES ON *.* WITH GRANT OPTION for the master user, reusing the exec-with-retry machinery the PostgreSQL rds_iam init already uses (extracted into a shared execUntilSuccess). Real RDS withholds SUPER, FILE and SHUTDOWN from its master grant list; the emulator grants ALL for simplicity, mirroring how POSTGRES_USER is already a superuser. A root master is skipped: the images create no separate user for it and root already holds every privilege. * fix(rds): deliver the master grant as a one-time init script and escape the username Review follow-ups from #2679: - Escape single quotes and backslashes in the GRANT statement. Floci does not enforce AWS's MasterUsername charset anywhere, so an unescaped name could break out of the string literal in SQL executed as root. - Replace the post-start root exec with a /docker-entrypoint-initdb.d script installed between container create and start. The images run init scripts exactly once, against an empty data directory, as root, after creating the master user, so a reboot on a reused volume never re-runs the grant and never needs to re-authenticate as root. This removes the reboot-after-password-rotation failure: MYSQL_ROOT_PASSWORD only takes effect on first initialization, so the rotated password can never open a root session on a reused volume. - The tar-and-copy shape follows CodeBuildRunner.copySourceToContainer.