forked from kamba4/sunders
/stats/ is publicly reachable although statistics are disabled #37
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Statistics are switched off (
USE_STATISTICS = falseinweb/www/sunders/config.phpanddata_handler/utils/config.php), but the stats page is still served at/stats/and/<lang>/stats/(de,en,es,fr,it,ru). The setting only hides the link on the map page (index.php:131);stats/index.phpnever checks it.What happens
statisticstable indata_handler/data_init/sunders_6822255.sql. BecauseUSE_STATISTICSis false, the data handler never updates that table, so the numbers are a frozen snapshot that silently diverges from the map.statisticstable (database initialised without the dump, or the import failed): the page fails with an uncaughtmysqli_sql_exception: Table 'camera.statistics' doesn't existand returns HTTP 500. On images withoutphp.ini-production, PHP's defaultdisplay_errorssends the stack trace, including server file paths, to the visitor.GROUP BYqueries over the wholestatisticstable on every request, unauthenticated and uncached.Steps to reproduce
docker compose up.http://localhost:8080/stats/(or/en/stats/).Expected
When statistics are disabled,
/stats/should not run any queries. It should return a 404 or redirect to the map.Suggested fix
At the top of
stats/index.php, afterconfig.phpis included:If statistics should come back later, the
statisticstable also needs to be created byinit_db.phpand kept up to date by the data handler, and the page should handle database errors without a fatal error.Related
The
security-fixesbranch switches the web image tophp.ini-production, so stack traces no longer reach visitors. The endpoint itself is unchanged there.