You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P3] Prefix-matched demo detection silently withholds the API key from /v1/demographics and /v1/demo/../... #23
Confirmed by execution on main (3feb505), PHP 8.5.8, 2026-09-13.
Client::request() decides whether to attach the API key with str_starts_with($path, '/v1/demo') (src/Client.php:241). Any path that merely begins with that string is treated as keyless demo traffic, so the Authorization header is dropped and the server answers 401 — and the SDK then tells the customer their key is invalid.
A customer with a perfectly good key calls raw()->get() on a path that happens to start with /v1/demo, gets a 401, and the SDK raises AuthenticationException reading "Invalid API key. Create or manage an API key at https://www.oilpriceapi.com/auth/signup...". That is a support ticket whose premise is wrong. No data harm and no credential harm — the failure is in the safe direction — but the diagnosis handed to the user is false.
Suggested fix
Match the demo endpoint exactly rather than by prefix — $path === '/v1/demo/prices', or a segment-boundary check ($path === '/v1/demo' || str_starts_with($path, '/v1/demo/')) plus a rejection of .. segments in normalizeApiPath(), which would also make /v1/demo/../prices/latest an error instead of a confusing 401.
Found during the post-merge PHP expert review of #17/#18/#19.
Activity
fix: match the demo endpoint on a segment boundary, not a raw prefix (#…
chore(release): 3.0.1 (#32)