feat: support sslmode=verify-ca and sslmode=verify-full with sslrootcert for PostgreSQL#294
Merged
tianzhou merged 15 commits intobytebase:mainfrom Apr 12, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for PostgreSQL TLS certificate verification modes (sslmode=verify-ca / sslmode=verify-full) and optional CA bundle configuration (sslrootcert) across DSN parsing and TOML configuration, to enable secure connections to managed Postgres services (e.g., AWS RDS).
Changes:
- Extend config types and TOML validation to allow
verify-ca/verify-full(PostgreSQL-only) plussslrootcertwith file existence checks and~/expansion. - Update PostgreSQL DSN parsing to recognize the new SSL modes and load CA bundle contents from
sslrootcertwhen provided. - Add test coverage for the new TOML validation + DSN parsing behavior, and update
dbhub.toml.examplewith usage guidance.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/config.ts | Extends sslmode union and adds sslrootcert to connection params. |
| src/connectors/postgres/index.ts | Implements verify-ca / verify-full handling and optional CA bundle loading from sslrootcert. |
| src/connectors/tests/dsn-parser.test.ts | Adds tests for PostgreSQL SSL modes and sslrootcert parsing/expansion/error behavior. |
| src/config/toml-loader.ts | Adds TOML validation + DSN building support for new SSL modes and sslrootcert. |
| src/config/tests/toml-loader.test.ts | Adds TOML validation tests for new SSL modes and sslrootcert, plus DSN build assertions. |
| dbhub.toml.example | Documents the new SSL modes and shows an AWS RDS verify-ca example. |
tianzhou
requested changes
Apr 1, 2026
Member
tianzhou
left a comment
There was a problem hiding this comment.
Thanks for the contribution. This is a good feature to be added. Please take a look at the review comments
Contributor
Author
|
I've taken into accounts the comments 😊 |
Contributor
Author
|
I've taken into accounts the comments 😊 |
tianzhou
approved these changes
Apr 12, 2026
Member
tianzhou
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution
tianzhou
added a commit
that referenced
this pull request
Apr 12, 2026
…tcert Document the new PostgreSQL-only sslmode=verify-ca and sslmode=verify-full options along with the sslrootcert parameter added in #294. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sslmode=verify-caandsslmode=verify-fullin the PostgreSQL DSN parser, with optionalsslrootcertparameter to specify a CA certificate bundlesslrootcertfield, with validation that restrictsverify-ca/verify-fullto PostgreSQL sources onlyverify-ca/verify-fullwithoutsslrootcertuses the system CA store (same as native libpq behavior)Closes #293
Motivation
When connecting to managed PostgreSQL services like AWS RDS,
sslmode=requireencrypts traffic but does not verify the server certificate (rejectUnauthorized: false). For production databases, certificate verification against a known CA bundle is needed to prevent MITM attacks. This aligns DBHub with PostgreSQL's standardsslmodevalues.Changes
src/connectors/postgres/index.tsverify-ca/verify-fullsslmode values; read CA cert fromsslrootcertpath with~/expansion and clear error on missing filesrc/types/config.tssslmodeunion type; addsslrootcert?: stringtoConnectionParamssrc/config/toml-loader.tsverify-ca/verify-fullto PostgreSQL; validatesslrootcertcoherence and file existence; includesslrootcertin built DSNssrc/connectors/__tests__/dsn-parser.test.ts~/expansion, nonexistent file error, ignored sslrootcert for disable/requiresrc/config/__tests__/toml-loader.test.tsdbhub.toml.exampleUsage