API keys in the address: Admin API Keys flags each key sent in a call's address in the last 30 days with a note counting them, and Admin Settings Security gains Take API keys in the address - off, a key in the address is turned away with a 401 telling the caller to use the X-API-Key header and logged against the key; database 3.7.0 adds api_keys.api_key_address_at and settings.config_api_key_in_address, on where a key still in date was there at the update and off otherwise and on new installs; 26.11.9 changelog entries

This commit is contained in:
johnnyq
2026-11-16 18:17:49 -05:00
parent 270cc91f60
commit 8784c50abe
9 changed files with 133 additions and 9 deletions

View File

@@ -3,7 +3,8 @@
/*
* Admin > Settings > Security - the sign-in page (its message, and a login
* key agents need in its address), how long two-step sign-in remembers a
* device, when admins hear of failed sign-ins, and shared links. Saved by
* device, when admins hear of failed sign-ins, whether the API takes a key in
* the address, and shared links. Saved by
* edit_security_settings (admin/post/settings_security.php).
*/
@@ -11,6 +12,7 @@ require_once "includes/inc_all_admin.php";
// Read here rather than with every page's settings, so a page still opens before the update that adds it
$config_login_alert_failures = signInAlertLimit();
$config_api_key_in_address = apiKeyInAddressAccepted() ? 1 : 0;
$login_url = rtrim('https://' . preg_replace('#^https?://#', '', (string) $config_base_url), '/') . '/login.php?key=';
$login_key_shown = (string) settingsValue('config_login_key_secret', $config_login_key_secret);
@@ -47,6 +49,10 @@ echo settingsPageStart('security');
'help' => 'Each admin gets a notification and an email.']) ?>
<?= settingsSectionEnd() ?>
<?= settingsSectionStart('api', 'API keys', 'Older scripts send their key in the address - and your web server\'s access log keeps every address it\'s sent, key and all. A key in the X-API-Key header isn\'t logged.') ?>
<?= settingsSwitch('config_api_key_in_address', $config_api_key_in_address, ['help' => 'Off, a key in the address is turned away. <a href="api_keys.php">API Keys</a> flags each key that still comes that way - move them to the header first.']) ?>
<?= settingsSectionEnd() ?>
<?= settingsSectionStart('shares', 'Shared links', 'When an agent shares a login, note, document or file with someone outside ITFlow.') ?>
<?= settingsSelect('config_share_max_hours', intval($config_share_max_hours), shareMaxOptions(), ['icon' => 'fa-hourglass-half',
'help' => 'The longest an agent can pick - a link stops working then, or sooner.']) ?>