fix: enforce TLS validation for DB connections [PM-22023]#1104
Draft
fix: enforce TLS validation for DB connections [PM-22023]#1104
Conversation
Initial change file for Least Authority audit finding Issue C — enforce strict TLS validation for PostgreSQL connections.
9775ef7 to
bab14fb
Compare
Remove PgSslMode::Disable path — plaintext DB connections are no longer permitted regardless of allow_non_ssl setting. The flag is deprecated with a startup warning. When ssl_root_cert is configured, connections use VerifyFull (cert + hostname validation). Without ssl_root_cert, connections fall back to Require (encrypted, no cert validation) with a warning. Add config validation for ssl_root_cert path and unit tests for SSL mode selection logic. Addresses: Least Authority Node DIFF Audit Issue C (High severity) JIRA: PM-22023
The previous commit removed PgSslMode::Disable entirely, but the node-dev-01 local environment sets ALLOW_NON_SSL=true to connect to a PostgreSQL without SSL. This caused the e2e Local Environment Tests to fail in CI. Restore the Disable path when allow_non_ssl=true with a deprecation warning. The security improvement (VerifyFull when ssl_root_cert is configured, Require as fallback) remains intact for production. Made-with: Cursor
Made-with: Cursor
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
Enforce TLS validation for PostgreSQL connections and eliminate the plaintext connection path, addressing Least Authority audit finding Issue C (PM-22023).
🎫 Ticket 📐 Engineering
Motivation
See engineering plan
Changes
node) — Extractedbuild_ssl_connect_optionsfor testable SSL mode selection; removedallow_non_sslparameter fromget_connection; updated all 10 call sites; added deprecation warning whenallow_non_ssl=trueis configurednode/cfg) — Added#[validate]path-exists check forssl_root_cert; updated doc comments markingallow_non_sslas deprecatedaudit-enforce-tls-validation-db.mdfor release notes📌 Submission Checklist
🔱 Fork Strategy
🗹 TODO before merging