git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: a3ef0b5) | patch
oauth: Move the builtin flow into a separate module
Thu, 1 May 2025 16:14:30 +0000 (09:14 -0700)
Thu, 1 May 2025 16:14:30 +0000 (09:14 -0700)
commit b0635bfda0535a7fc36cd11d10eecec4e2a96330
oauth: Move the builtin flow into a separate module

The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.

When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.

For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.

The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)

This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)

Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.

Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!

Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
25 files changed:
config/programs.m4 diff | blob | blame | history
configure diff | blob | blame | history
configure.ac diff | blob | blame | history
doc/src/sgml/installation.sgml diff | blob | blame | history
doc/src/sgml/libpq.sgml diff | blob | blame | history
meson.build diff | blob | blame | history
src/Makefile.global.in diff | blob | blame | history
src/interfaces/Makefile diff | blob | blame | history
src/interfaces/libpq-oauth/Makefile [new file with mode: 0644] blob
src/interfaces/libpq-oauth/README [new file with mode: 0644] blob
src/interfaces/libpq-oauth/exports.txt [new file with mode: 0644] blob
src/interfaces/libpq-oauth/meson.build [new file with mode: 0644] blob
src/interfaces/libpq-oauth/oauth-curl.c [moved from src/interfaces/libpq/fe-auth-oauth-curl.c with 94% similarity] diff | blob | blame | history
src/interfaces/libpq-oauth/oauth-curl.h [new file with mode: 0644] blob
src/interfaces/libpq-oauth/oauth-utils.c [new file with mode: 0644] blob
src/interfaces/libpq-oauth/oauth-utils.h [new file with mode: 0644] blob
src/interfaces/libpq/Makefile diff | blob | blame | history
src/interfaces/libpq/exports.txt diff | blob | blame | history
src/interfaces/libpq/fe-auth-oauth.c diff | blob | blame | history
src/interfaces/libpq/fe-auth-oauth.h diff | blob | blame | history
src/interfaces/libpq/meson.build diff | blob | blame | history
src/interfaces/libpq/nls.mk diff | blob | blame | history
src/makefiles/meson.build diff | blob | blame | history
src/test/modules/oauth_validator/meson.build diff | blob | blame | history
src/test/modules/oauth_validator/t/002_client.pl diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /