isoos / postgresql-dart

Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.
https://pub.dev/packages/postgres
BSD 3-Clause "New" or "Revised" License
128 stars 34 forks source link

Feature Request: SSL connection with client side certificate #18

Open mbalmer opened 2 years ago

mbalmer commented 2 years ago

The libpq C library allows the use of client side SSL certificates to secure a connection to the PostgreSQL server. As I saw no mention of client side certificates in the API documentation, I wonder if this feature could be added.

isoos commented 2 years ago

@mbalmer: I'm happy to review PRs and merge them, if you are up to contribute this feature. Bonus if we could add an end2end test for it too.

mbalmer commented 2 years ago

I only discovered this library a few days ago, so I first need to understand the code (and learn how create a library using flutter ;)

Am 23.11.2021 um 11:12 schrieb István Soós @.***>:

@mbalmer https://github.com/mbalmer: I'm happy to review PRs and merge them, if you are up to contribute this feature. Bonus if we could add an end2end test for it too.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isoos/postgresql-dart/issues/18#issuecomment-976366012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIAH7LS7DGNBBGSF5EYJLUNNSJTANCNFSM5ITC7YAA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

isoos commented 2 years ago

@mbalmer: the package is designed for server-side apps, and not for mobile apps. Just mentioning this, as you have mentioned flutter...

mbalmer commented 2 years ago

My plan is to have a PostgreSQL client app running on a tablet in the same LAN as the PostgreSQL server. Are there any concerns when using this in a flutter app?

Adding a client side certificate should be straightforward, as a optional SecuritityContext object can be passed to the call to SecureSocket.connect() on line 315 of connection.dart

Am 23.11.2021 um 11:30 schrieb István Soós @.***>:

@mbalmer https://github.com/mbalmer: the package is designed for server-side apps, and not for mobile apps. Just mentioning this, as you have mentioned flutter...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isoos/postgresql-dart/issues/18#issuecomment-976380365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIAHYRUH77N63DI3RHLSLUNNUODANCNFSM5ITC7YAA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

isoos commented 2 years ago

I have no idea how the Flutter app will handle connections if/when there is context switch between apps. Maybe a connection pool with strict settings helps there (e.g. package:postgres_pool), you'll need to try it first :)

mbalmer commented 2 years ago

I will give that a try. My work is in a proof of concept state only...

Am 23.11.2021 um 11:39 schrieb István Soós @.***>:

I have no idea how the Flutter app will handle connections if/when there is context switch between apps. Maybe a connection pool with strict settings helps there (e.g. package:postgres_pool), you'll need to try it first :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/isoos/postgresql-dart/issues/18#issuecomment-976386664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIAH23EVZZHZXX2ZIBK33UNNVO5ANCNFSM5ITC7YAA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.