mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 15:49:33 -05:00
* fix(rds): forward PostgreSQL startup parameters through the proxy The RDS proxy parsed the client's StartupMessage but opened the backend session with only user and database, so options, application_name and every other run-time parameter were silently dropped. Forward them in the order the client sent them. The proxy keeps setting user and database itself, and drops _pq_. protocol extension requests, which it does not negotiate with the backend. An IAM login for a role other than the master still sends only user and database: its backend session is the master's until the handover, and a startup "-c role=<master>" would outlive SET SESSION AUTHORIZATION, so RESET ROLE would regain the master. Redshift keeps today's behaviour, as its drivers send parameters PostgreSQL rejects. * fix(rds): relay PostgreSQL's refusal of the backend login to the client Forwarding startup parameters makes new backend refusals possible, such as replication=true with no pg_hba.conf entry allowing it. PostgreSQL answers those with an ErrorResponse where the proxy expected an Authentication message, and the proxy reported only "Backend database authentication failed". Every read that expects an Authentication message now reads a refusal whole and the proxy sends it to the client unchanged, so the client sees PostgreSQL's SQLSTATE and reason. This covers a refusal before the password exchange and one after it. Other unexpected replies keep the generic error. * test(rds): reuse the IAM auth harness and the handler's startup parser Fold the IAM startup-parameter check into iamSessionRunsAsTheRoleNamedInTheToken, let backendStartupFor start its auth thread through startIamAuth, and make PostgresProtocolHandler.parseStartupParams package-private so the test no longer keeps its own copy.