| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.9 | |
| 4 | + * @version 3.1.14 | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -1160,9 +1160,22 @@ | ||
| 1160 | 1160 | { |
| 1161 | 1161 | $key = $field['key']; |
| 1162 | 1162 | $settings_key = $field['settings_key']; |
| 1163 | 1163 | $value = isset($credentials[$key]) && is_scalar($credentials[$key]) ? trim((string) $credentials[$key]) : ''; |
| 1164 | - $settings[$settings_key] = self::getGlobalAPIKeyEncryption()->encrypt($value); | |
| 1164 | + | |
| 1165 | + $encrypted = self::getGlobalAPIKeyEncryption()->encrypt($value); | |
| 1166 | + | |
| 1167 | + /** | |
| 1168 | + * Fail closed. Storing the raw value under a name that implies encryption | |
| 1169 | + * would leave the credential in the database in cleartext with no signal | |
| 1170 | + * to anyone, so refuse the whole write instead. | |
| 1171 | + */ | |
| 1172 | + if ($encrypted === false) | |
| 1173 | + { | |
| 1174 | + return false; | |
| 1175 | + } | |
| 1176 | + | |
| 1177 | + $settings[$settings_key] = $encrypted; | |
| 1165 | 1178 | } |
| 1166 | 1179 | |
| 1167 | 1180 | return update_option('firebox_settings', $settings); |
| 1168 | 1181 | } |