Skip to content

Commit 73cee14

Browse files
turegjorupclaude
andcommitted
feat(oidc): bound provider HTTP calls with an explicit timeout
The bundle never set a Guzzle timeout, so calls to the IdP (discovery, JWKS, and especially the un-cached token exchange on the login callback) inherited Guzzle's default of 0 — wait indefinitely. A hung or slow IdP could therefore tie up a php-fpm worker until the FPM request terminator kicked in. itk-dev/openid-connect-bundle 4.2+ exposes http_client_options.timeout (forwarded through league/oauth2-client to Guzzle), but it is opt-in with no default. Set it on both providers via a new OIDC_HTTP_TIMEOUT env var (default 5s), documented in .env and docs/configuration/openid-connect.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 6dbfc2f commit 73cee14

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ RELATIONS_CHECKSUM_ENABLED=true
146146

147147
###> itk-dev/openid-connect-bundle ###
148148
# See docs/feed/openid-connect.md for variable explanations.
149+
# Total HTTP request timeout (seconds) for calls to the OIDC providers
150+
# (discovery, JWKS, token exchange). Bounds a hung/slow IdP so it cannot
151+
# tie up a php-fpm worker indefinitely. Applies to both providers.
152+
OIDC_HTTP_TIMEOUT=5
153+
149154
# internal provider (admin login)
150155
# URL to OIDC provider's metadata/discovery endpoint.
151156
INTERNAL_OIDC_METADATA_URL=INTERNAL_OIDC_METADATA_URL

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file.
99
`OpenIdConnectExceptionInterface` marker, since concrete exceptions no longer extend the deprecated
1010
`ItkOpenIdConnectException`. Added regression tests covering the exception-mapping branches and the
1111
authenticator's claim-to-tenant-role provisioning and de-provisioning logic.
12+
- Bounded OIDC provider HTTP calls (discovery, JWKS, token exchange) with an explicit
13+
`http_client_options.timeout` on both providers, configurable via the new `OIDC_HTTP_TIMEOUT` env var
14+
(default 5s). Previously no timeout was set anywhere in the chain, so Guzzle waited indefinitely and a
15+
hung/slow IdP could tie up a php-fpm worker.
1216
- Removed the deprecated feed types `SparkleIOFeedType`, `EventDatabaseApiFeedType` and `KobaFeedType`.
1317
Made the unknown-feed-type handling consistent: **reads degrade, writes are rejected.** Feed sources
1418
(and feeds) that reference a removed type keep loading — item and collection reads return them with no

config/packages/itkdev_openid_connect.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ itkdev_openid_connect:
1212
client_secret: '%env(string:INTERNAL_OIDC_CLIENT_SECRET)%'
1313
redirect_uri: '%env(string:INTERNAL_OIDC_REDIRECT_URI)%'
1414
leeway: '%env(int:INTERNAL_OIDC_LEEWAY)%'
15+
http_client_options:
16+
timeout: '%env(float:OIDC_HTTP_TIMEOUT)%' # Bound IdP HTTP calls so a hung provider can't tie up a worker.
1517
external:
1618
options:
1719
metadata_url: '%env(string:EXTERNAL_OIDC_METADATA_URL)%'
1820
client_id: '%env(string:EXTERNAL_OIDC_CLIENT_ID)%'
1921
client_secret: '%env(string:EXTERNAL_OIDC_CLIENT_SECRET)%'
2022
redirect_uri: '%env(string:EXTERNAL_OIDC_REDIRECT_URI)%'
2123
leeway: '%env(int:EXTERNAL_OIDC_LEEWAY)%'
24+
http_client_options:
25+
timeout: '%env(float:OIDC_HTTP_TIMEOUT)%' # Bound IdP HTTP calls so a hung provider can't tie up a worker.

docs/configuration/openid-connect.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
```dotenv
44
###> itk-dev/openid-connect-bundle ###
5+
# Total HTTP request timeout (seconds) for calls to the OIDC providers.
6+
OIDC_HTTP_TIMEOUT=5
7+
58
# internal provider
69
INTERNAL_OIDC_METADATA_URL=INTERNAL_OIDC_METADATA_URL
710
INTERNAL_OIDC_CLIENT_ID=INTERNAL_OIDC_CLIENT_ID

0 commit comments

Comments
 (0)