Skip to content

Commit bcad1c4

Browse files
authored
release(v3.9.2): admin config decrypt retry after persistent-token key transitions
- admin(config): retry adminConfig.json reads once before surfacing decrypt errors after key changes - admin(ui): avoid transient getConfig failures on the first Admin Panel open after key transitions
1 parent 6a98b26 commit bcad1c4

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## Changes 03/15/2026 (v3.9.2)
4+
5+
`release(v3.9.2): admin config decrypt retry after persistent-token key transitions`
6+
7+
**Commit message**
8+
9+
```text
10+
release(v3.9.2): admin config decrypt retry after persistent-token key transitions
11+
12+
- admin(config): retry adminConfig.json reads once before surfacing decrypt errors after key changes
13+
- admin(ui): avoid transient getConfig failures on the first Admin Panel open after key transitions
14+
```
15+
16+
**Fixed**
17+
18+
- **Admin Panel first-open stability after key changes**
19+
- Fixed a transient `getConfig.php` failure where the first Admin Panel open after a persistent-token key transition could return `Failed to decrypt configuration.` even though a manual refresh succeeded.
20+
- `AdminModel::getConfig()` now rereads `adminConfig.json` once and retries decryption before surfacing a real decrypt error.
21+
22+
---
23+
324
## Changes 03/15/2026 (v3.9.1)
425

526
`release(v3.9.1): post-rotation bootstrap fix and startup script cleanup`

src/FileRise/Domain/AdminModel.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,26 @@ public static function getConfig(): array
829829
$encryptedContent = file_get_contents($configFile);
830830
$decryptedContent = decryptData($encryptedContent, $GLOBALS['encryptionKey']);
831831
if ($decryptedContent === false) {
832-
// Do not set HTTP status here; let the controller decide.
833-
return ["error" => "Failed to decrypt configuration."];
832+
clearstatcache(true, $configFile);
833+
$retryContent = @file_get_contents($configFile);
834+
if (is_string($retryContent) && $retryContent !== '') {
835+
$encryptedContent = $retryContent;
836+
$decryptedContent = decryptData($encryptedContent, $GLOBALS['encryptionKey']);
837+
}
838+
}
839+
840+
if ($decryptedContent === false) {
841+
$rawConfig = json_decode((string)$encryptedContent, true);
842+
if (is_array($rawConfig)) {
843+
$config = $rawConfig;
844+
} else {
845+
// Do not set HTTP status here; let the controller decide.
846+
return ["error" => "Failed to decrypt configuration."];
847+
}
848+
} else {
849+
$config = json_decode($decryptedContent, true);
834850
}
835851

836-
$config = json_decode($decryptedContent, true);
837852
if (!is_array($config)) {
838853
$config = [];
839854
}

0 commit comments

Comments
 (0)