AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 60 Bitcoin

sqldb/v2: enforce require ssl mode

Public commit record

What the developer wrote

Authored by yyforyongyu

90/100 · Strong
sqldb/v2: enforce require ssl mode

Apply the RequireSSL config knob when opening Postgres stores
so it cannot be silently ignored.

Before this change, sqldb/v2 exposed PostgresConfig.RequireSSL
but still opened cfg.Dsn verbatim, which meant RequireSSL=true
was a no-op. A caller could set RequireSSL=true together with a
DSN such as sslmode=disable and still establish a non-TLS
connection.

This is a v2-only API contract bug, not a v1 regression in DSN
handling: v1 never offered a separate RequireSSL flag and always
left TLS policy entirely up to the DSN. The fix rewrites the DSN
to use sslmode=require when needed, while preserving stricter
modes such as verify-ca and verify-full.

The bug was easy to miss because no test asserted that the boolean
flag changed the effective DSN or overrode an insecure sslmode.
Keep the focused DSN rewrite test because it proves the contract
without needing a live Postgres instance.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a bug in LND's new database library (sqldb/v2) where a 'require SSL' setting was silently ignored. A user could turn on RequireSSL=true, but if their database connection string also said sslmode=disable, the connection would still be made without encryption. The fix now rewrites the connection string to enforce TLS when RequireSSL is true, unless an even stricter TLS mode is already set. It also adds tests to prove the behavior.

Recommended action

Users of sqldb/v2 who set RequireSSL=true should upgrade to this commit or a release containing it, and verify that their Postgres connections are using TLS. Operators should audit connection strings that previously combined RequireSSL=true with sslmode=disable or other non-TLS modes. No action is needed for v1 users, which did not expose RequireSSL.

Security signals we found

01

TLS/SSL enforcement bypass due to ignored configuration flag

02

API contract bug where boolean security setting had no effect

03

Potential plaintext database connections despite explicit RequireSSL=true

04

Fix includes regression test for DSN rewriting behavior

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 8/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.