Skip to content

fix: parse PUSHER_USE_SSL env var as boolean string#6628

Open
sricursion wants to merge 1 commit into
keephq:mainfrom
sricursion:fix/6582-pusher-use-ssl-parsing
Open

fix: parse PUSHER_USE_SSL env var as boolean string#6628
sricursion wants to merge 1 commit into
keephq:mainfrom
sricursion:fix/6582-pusher-use-ssl-parsing

Conversation

@sricursion

@sricursion sricursion commented Jul 12, 2026

Copy link
Copy Markdown

Linked Issue

Fixes #6582

Description

get_pusher_client evaluates the env var with ssl=False if os.environ.get("PUSHER_USE_SSL", False) is False else True, so any string value — including "false" — enables SSL. docker-compose and Kubernetes can only pass env values as strings, so PUSHER_USE_SSL: false in a compose file arrives as the string "false" and turns SSL on.

The variable is now parsed with the same starlette config(..., cast=bool) idiom already used across the codebase (SCHEDULER, REDIS_SSL, KEEP_DEBUG_TASKS, ...), accepting true/false/1/0 case-insensitively. The parse happens before the existing try/except ValueError, so an invalid value is no longer misreported by the "PUSHER_APP_ID must be a numeric string" handler.

Backward compatibility / fail-secure: before this change, every set value enabled SSL. Falling back to False for unrecognized values (yes, on, typos, empty string) would silently downgrade existing SSL deployments to plaintext, so unrecognized values keep SSL enabled and log a warning. The only behavior change is for the explicitly-false spellings — the bug being fixed.

This was the only instance of this pattern in the repo (the issue suggested other cases might be affected — none found).

Test

Added tests/test_pusher_client.py with 11 cases: false/False/0 → SSL off, true/True/1 → SSL on, unset → off, yes/on/garbage/empty string → on (fail-secure).

Reproduced against the real pusher client: on main, PUSHER_USE_SSL=false produces a client with ssl=True; with this change all cases wire through correctly. Full pytest --non-integration suite passes with no regressions. ruff check passes.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Bug Something isn't working labels Jul 12, 2026
@CLAassistant

CLAassistant commented Jul 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

PUSHER_USE_SSL was compared with `is False`, so any string value —
including "false" set via docker-compose or k8s env — enabled SSL.
Parse it with the same starlette `config(..., cast=bool)` idiom used
across the codebase. Unrecognized values keep SSL enabled (fail-secure,
matching pre-fix behavior) and log a warning.

Fixes keephq#6582
@sricursion sricursion force-pushed the fix/6582-pusher-use-ssl-parsing branch from ed97008 to 5c882ae Compare July 12, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: PUSHER_USE_SSL is incorrectly parsed

2 participants