SWS-12500-custom-component/tests
SchiZzA a467c4b6e5
fix(security): authenticate health endpoint and stop webhook-id leak
The /station/health route is registered directly on the aiohttp router, so HA's
auth middleware only flags requests without blocking them - the endpoint was
reachable unauthenticated and returned the full health snapshot.

- health_status now requires HA authentication (bearer token or signed request)
  via KEY_AUTHENTICATED and returns 401 otherwise.
- Mask the Ecowitt webhook id (the endpoint's only credential) in last_ingress
  paths via _sanitize_path, so it never enters the snapshot exposed by the health
  endpoint or the diagnostics download.
- Redact ECOWITT_WEBHOOK_ID in diagnostics.
- Compare the Ecowitt webhook id in constant time (hmac.compare_digest), matching
  the WU/WSLink credential checks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 21:47:52 +02:00
..
conftest.py Add HCHO / VOC air-quality sensors (T9 module) 2026-05-11 23:55:36 +02:00
test_binary_battery.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_config_flow.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_const.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_data.py test: align suite with v2.0 runtime_data architecture 2026-07-25 21:47:51 +02:00
test_diagnostics.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_ecowitt_bridge.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_health.py fix(security): authenticate health endpoint and stop webhook-id leak 2026-07-25 21:47:52 +02:00
test_init.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_integration_lifecycle.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_pocasi_push.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_received_data.py test: align suite with v2.0 runtime_data architecture 2026-07-25 21:47:51 +02:00
test_received_ecowitt.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_routes.py Make routes method-aware and update related tests 2026-07-25 21:47:47 +02:00
test_routes_more.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_sensor_platform.py test: align suite with v2.0 runtime_data architecture 2026-07-25 21:47:51 +02:00
test_sensors_common.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_weather.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_wslink.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_staleness_legacy.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_strings.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_t9_air_quality.py test: align suite with v2.0 runtime_data architecture 2026-07-25 21:47:51 +02:00
test_translations_cs.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_translations_en.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils_conv.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_utils_more.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_weather_sensor_entity.py test: align suite with v2.0 runtime_data architecture 2026-07-25 21:47:51 +02:00
test_windy_func.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_windy_more.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_windy_push.py Make routes method-aware and update related tests 2026-07-25 21:47:47 +02:00