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
fix(security): gate test URL rewriters behind #[cfg(test)] (fixes#2056) (#2401)
The `rewrite_telegram_api_url_for_testing()`, `rewrite_http_url_for_testing()`,
and their supporting constants/helpers were gated behind
`#[cfg(any(test, debug_assertions))]`, which means they shipped in all debug
builds — including development/staging deployments. An attacker who could set
`IRONCLAW_TEST_TELEGRAM_API_BASE_URL` or `IRONCLAW_TEST_HTTP_REWRITE_MAP`
environment variables on such a deployment could redirect Telegram API traffic
(and other HTTP traffic) to an arbitrary host.
Changes:
- Narrow all test URL rewrite constants, functions, and helpers from
`#[cfg(any(test, debug_assertions))]` to `#[cfg(test)]`
- Add missing `#[cfg(test)]` to `TELEGRAM_TEST_API_BASE_ENV` (was ungated)
- Wrap the call site in `http_request()` with `#[cfg(test)]`/`#[cfg(not(test))]`
blocks so production builds use `logical_url` directly
- Remove the now-unnecessary `#[cfg(not(...))]` stub functions that returned None
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments