mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* fix(rds): bind PostgreSQL IAM tokens to the published endpoint The PostgreSQL proxy validated IAM auth tokens with the two-argument validator, so a token generated for any host, port or region was accepted as long as the signature and DBUser matched. The MySQL proxy already checked the token against the endpoint it publishes. Thread the same binding into the PostgreSQL handler and validate against it. * fix(rds): carry account and resource ids in the proxy binding RdsService now builds the proxy binding itself at every relay start (instances, clusters, RDS Proxy relays and restart restores) from the published endpoint, port, region, account and DbiResourceId or DbClusterResourceId, so the auth proxy has everything rds-db:connect is scoped to. The convenience startProxy overload that re-derived the region from the relay key is gone along with it. * feat(rds): authorize rds-db:connect when IAM enforcement is on After the token signature checks out, the auth proxy now asks IAM whether the token's principal may perform rds-db:connect on arn:aws:rds-db:<region>:<account>:dbuser:<resource-id>/<db-user>, the same check AWS runs. It only applies when services.iam.enforcement-enabled is on; a caller IAM does not know keeps the filter's bypass. The client still sees the engine's generic authentication failure, and the denial is logged in AWS's wording so the cause is visible server-side. * refactor(rds): rename RdsMysqlBinding to RdsProxyBinding Both engines, Aurora clusters and RDS Proxy relays now validate IAM tokens against it, so the MySQL-specific name was misleading. * docs(rds): describe IAM token endpoint binding and rds-db:connect * test(rds): cover a replayed IAM token in the JDBC compat suite * fix(rds): accept IAM tokens generated for the loopback name of the endpoint Floci advertises the name containers reach it by (host.docker.internal natively, its own address in Docker), while a client on the host connects to the same proxy over the loopback interface and generates its token for localhost or 127.0.0.1. Binding tokens strictly to the advertised host therefore refused every native client; the published port still has to match, so a token for another instance on the same host is still refused. The compatibility workflow sets FLOCI_SERVICES_RDS_ENDPOINT_HOST=floci as it already does for Redshift, so the tests' tokens name what the containerised Floci publishes. * feat(rds): make the PostgreSQL IAM token endpoint binding opt-in Refusing a PostgreSQL token generated for another hostname, port or region matches RDS but breaks clients whose tokens name a different host than the endpoint publishes, so the check now sits behind services.rds.iam-token-endpoint-binding (FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING), off by default. MySQL and MariaDB keep requiring the endpoint as before, and the rds-db:connect check still runs whenever IAM enforcement is on. The compatibility workflow turns the flag on so the replayed-token case stays covered. * fix(rds): refuse an IAM token that reaches the validator without a binding Every proxy publishes a binding, so a token without one has nothing to be checked against; validating its signature alone was a fail-open path. The signature-only validate(token, user) overload and the MySQL handleAuth overloads that passed no binding are removed; production only ever used the ones that pass it. * fix(rds): sanitize the rds-db resource named in the refused connection warning The database user is part of that resource and comes straight from the client's startup message, so it is stripped of control characters like the other client-controlled values in the warning. * docs(rds): call a refused IAM token the engine's ordinary authentication failure The exact message differs per engine, and RDS PostgreSQL words it differently from Floci's handler today, so the docs no longer promise one wording. * docs(rds): move the IAM token binding row into the RDS variables table The row had landed above the page heading, where it rendered as a stray one-row table; it now follows FLOCI_SERVICES_RDS_ENDPOINT_HOST as it does on the RDS page. * fix(rds): bind PostgreSQL IAM tokens to the endpoint by default A stock Floci still accepted a PostgreSQL token generated for another endpoint, the replay this change set out to close, and PostgreSQL and MySQL disagreed about it in a way RDS never has. The endpoint check is now on for every engine. services.rds.iam-token-endpoint-binding (FLOCI_SERVICES_RDS_IAM_TOKEN_ENDPOINT_BINDING=false) stays as the escape hatch for clients that generate tokens for a container name or DNS alias the endpoint does not publish. The compatibility workflow no longer needs to turn the check on. * chore(ci): rerun after a Docker Hub rate limit failed shard 1