Skip to content

Add support to modify and ignore incoming connection parameters#2

Merged
bentsku merged 5 commits into
masterfrom
fix/6131
Jun 10, 2022
Merged

Add support to modify and ignore incoming connection parameters#2
bentsku merged 5 commits into
masterfrom
fix/6131

Conversation

@bentsku
Copy link
Copy Markdown

@bentsku bentsku commented Jun 3, 2022

This PR allows the proxy to modify and ignore the incoming connection parameters, allowing for example Redshift connector to connect to a Postgres server. A release on pypi will be needed.

List of allowed connection parameters: https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-PARAMKEYWORDS

@bentsku bentsku requested review from dfangl and whummer June 3, 2022 19:02
Copy link
Copy Markdown
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

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

LGTM! At some point we might need to introduce a handler for connection requests as well, but this seems good so far!

We will have to see if keeping the whitelist up to date takes a lot of work or not.

@@ -0,0 +1,42 @@

ALLOWED_CONNECTION_PARAMETERS = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably have to adjust this list for each new postgresql version, but seems like a good solution for now!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, I thought about either going through a modular approach for connection handlers, or instead setting it directly. As we only have postgres after our proxy, I thought it could be done directly for now, but not closing any doors!
For the whitelist, I made a small script fetching and parsing the postgres documentation page linked above, so it is pretty fast but needs to be thought about, that's a thing.

Copy link
Copy Markdown
Member

@whummer whummer left a comment

Choose a reason for hiding this comment

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

Nice set of changes @bentsku 👍 - great detective work! 🔍

Comment thread postgresql_proxy/interceptors.py Outdated
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.

3 participants