Repository navigation
br-util-postgres 0.1.0
·
7 commits
to main
since this release
0.1.0
Changed
- First release of
br-util-postgresas its own library, taggedbr-util-postgres/v0.1.0. The code is the one shipped by the workspace releasev1.4.0plus the DSN host fix below, whichv1.4.0does not contain; the versioning also changes: the single workspace version and the singlevX.Y.Ztag are gone, and this crate now carries its own version line. - Dependency pin:
{ git = "https://github.com/BotResources/br-rust-common", package = "br-util-postgres", tag = "br-util-postgres/v0.1.0", version = "0.1.0" }. Moving fromtag = "v1.4.0", change both the tag and the version: the number goes down because the line restarts at0.1. - Sibling pin: this crate depends on
br-util-bootpinned by tagbr-util-boot/v0.1.0, so the two crates agree on oneDATABASE_URLname constant and one resolvedbr-util-boot. They share no type. Move this crate andbr-util-bootfromv1.4.0to their per-crate pins together. br-util-postgres—validate_database_tlsis stricter about what it
accepts.v1.4.0does not contain these rules. These DSNs were accepted
before and now returnPostgresError::Configbefore any trust decision: a
DSN with no scheme (localhost,localhost/db), a foreign scheme
(mysql://,pg://), a DSN with no explicit host (postgres:///db?sslmode=require),
whose host the driver would take fromPGHOSTADDR,PGHOSTor a socket
directory (such a DSN must now name its host), and any DSN that sqlx cannot
parse, whatever its host: a DSN with an invalidsslmodevalue
(?sslmode=bogus) or an invalid port, whichv1.4.0accepted when the host
was loopback, is now refused before the loopback shortcut. A loopback DSN is
accepted only when sqlx can parse it, and a host listed inTRUSTED_NETWORK_HOSTSis no exception: a trusted host with an invalidsslmodeis now aConfigerror. A non-ASCII trusted host no longer matches, because the URL parser percent-encodes the host. IPv6 hosts compare in canonical
lower-case form ([0:0:0:0:0:0:0:1]is::1). An upper-case scheme
(POSTGRES://) is now accepted.
Fixed
br-util-postgres—validate_database_tlsno longer reads the host from
outside the URL authority (fail-open parsing). The host was taken after the
first@of the whole DSN, so a DSN with@localhostonly in its query,
path or fragment (for examplepostgres://evil.example.com/db?x=a@localhost)
was judgedlocalhost: treated as loopback and accepted without TLS, while
the driver connected toevil.example.com. The host is now read from the
authority only (credentials end at the last@of the authority; a@in the
path, query or fragment, or percent-encoded in the user information, never
changes it), with the same URL parser the driver uses.init_pooland
init_migration_poolinherit the fix. The public signatures are unchanged.