mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-30 12:14:36 -05:00
Two ways a System=View account could read secrets through the Config API. The oracle: ConfigsController::index() passed the caller's named filter to buildFilter() and returned the matched rows. redactSecret() blanked a secret Value in the response but not in the WHERE clause, so a filter such as Name:ZM_AUTH_HASH_SECRET/Value LIKE:a% returned the row for a correct prefix and nothing otherwise - the row count leaked the secret a character at a time, and that secret signs auth tokens. index() now detects a filter on the Value column and drops the secret rows from the result, so their presence reveals nothing; a filter on any other column is unaffected. The flags: ZM_JANUS_SECRET, ZM_UPLOAD_PASS and ZM_MQTT_PASSWORD held secrets but were not marked Private, so the API returned them to System=View and skin.js.php wrote them into every page as JavaScript constants. Mark them private in ConfigData.pm.in (fresh installs) and add a Config UPDATE to the untagged 1.39.41 migration (existing installs). No web page reads the three; zmfilter, zmc and the Janus integration read them server side. Tested: tests/php/test_config_value_filter.php (11 cases) covers the Value detection, including Model.Value, case, and the DefaultValue non-match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.9 KiB
SQL
35 lines
1.9 KiB
SQL
--
|
|
-- This updates a 1.39.40 database to 1.39.41
|
|
--
|
|
|
|
--
|
|
-- Add a Controls entry for ZoneMinder::Control::Reolink_HTTP.
|
|
--
|
|
-- The module has shipped without a Controls row, so it could not be chosen
|
|
-- for a monitor unless one was added by hand. Same flags as db/controls.sql.
|
|
-- Skipped when a row with this protocol already exists (one added by hand).
|
|
--
|
|
INSERT INTO `Controls` (`Name`,`Protocol`,`CanReboot`,`CanZoom`,`CanZoomCon`,`HasZoomSpeed`,`MinZoomSpeed`,`MaxZoomSpeed`,`CanFocus`,`CanAutoFocus`,`CanFocusCon`,`HasPresets`,`NumPresets`,`HasHomePreset`,`CanSetPresets`,`CanMove`,`CanMoveDiag`,`CanMoveCon`,`CanPan`,`HasPanSpeed`,`MinPanSpeed`,`MaxPanSpeed`,`CanTilt`,`HasTiltSpeed`,`MinTiltSpeed`,`MaxTiltSpeed`)
|
|
SELECT 'Reolink HTTP API','Reolink_HTTP',1,1,1,1,1,64,1,1,1,1,64,1,1,1,1,1,1,1,1,64,1,1,1,64 FROM DUAL
|
|
WHERE NOT EXISTS (SELECT 1 FROM `Controls` WHERE `Protocol` = 'Reolink_HTTP');
|
|
|
|
--
|
|
-- ZM_OPT_USE_AUTH now defaults to on for new installs. An existing install
|
|
-- keeps the value it has: zmupdate.pl -f copies Value from the database and
|
|
-- only DefaultValue changes. Record the new default here too, so that an
|
|
-- upgrade that skips -f doesn't leave the row with Value = DefaultValue = 0:
|
|
-- the C++ config loader reads only rows whose Value differs from DefaultValue
|
|
-- and would take its compiled-in default (on) while the web UI read off.
|
|
--
|
|
UPDATE `Config` SET `DefaultValue` = '1' WHERE `Name` = 'ZM_OPT_USE_AUTH';
|
|
|
|
--
|
|
-- These three hold secrets (Janus admin key, upload account password, MQTT
|
|
-- broker password) but shipped with Private = 0, so the Config API returned
|
|
-- them to System=View accounts and the web UI wrote them into every page as
|
|
-- JavaScript constants. Mark them Private so they are withheld like
|
|
-- ZM_AUTH_HASH_SECRET. refs GHSA-8g63-hqg8-82cv
|
|
--
|
|
UPDATE `Config` SET `Private` = 1
|
|
WHERE `Name` IN ('ZM_JANUS_SECRET', 'ZM_UPLOAD_PASS', 'ZM_MQTT_PASSWORD');
|