Skip to content

Commit 55c1961

Browse files
authored
release(v3.9.3): legacy fallback worker-env fix after persistent-token key rotation
- crypto(startup): stop exporting the legacy fallback key as a process-wide env value on compatibility-path installs - crypto(resolve): prefer the persisted key file over legacy_default source hints once a rotation has written metadata/persistent_tokens.key - admin(ui): eliminate post-rotation getConfig/siteConfig failures caused by workers still decrypting with the inherited legacy fallback
1 parent 539a630 commit 55c1961

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

CHANGELOG.md

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

3+
## Changes 03/15/2026 (v3.9.3)
4+
5+
`release(v3.9.3): legacy fallback worker-env fix after persistent-token key rotation`
6+
7+
**Commit message**
8+
9+
```text
10+
release(v3.9.3): legacy fallback worker-env fix after persistent-token key rotation
11+
12+
- crypto(startup): stop exporting the legacy fallback key as a process-wide env value on compatibility-path installs
13+
- crypto(resolve): prefer the persisted key file over legacy_default source hints once a rotation has written metadata/persistent_tokens.key
14+
- admin(ui): eliminate post-rotation getConfig/siteConfig failures caused by workers still decrypting with the inherited legacy fallback
15+
```
16+
17+
**Fixed**
18+
19+
- **Post-rotation request consistency**
20+
- Fixed a case where some Apache workers could keep using the legacy fallback persistent-token key immediately after an in-app rotation, causing transient `getConfig.php` / `siteConfig.php` `500` responses until a refresh or restart.
21+
- Compatibility-path installs no longer export the legacy fallback key as a worker-wide env value, and the key resolver now prefers the persisted key file once rotation has written `metadata/persistent_tokens.key`.
22+
23+
---
24+
325
## Changes 03/15/2026 (v3.9.2)
426

527
`release(v3.9.2): admin config decrypt retry after persistent-token key transitions`

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function fr_resolve_persistent_tokens_key(): array
223223

224224
$source = 'legacy_default';
225225
$key = $defaultKey;
226-
if ($envKey !== '') {
226+
if ($envKey !== '' && !($sourceHint === 'legacy_default' && $fileKey !== '')) {
227227
$key = $envKey;
228228
if (in_array($sourceHint, ['env', 'file', 'generated_file', 'legacy_default'], true)) {
229229
$source = $sourceHint;

start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ elif [ -s "${PERSISTENT_TOKENS_KEY_FILE}" ]; then
8888
export PERSISTENT_TOKENS_KEY_SOURCE="file"
8989
echo "[startup] Loaded persistent tokens key from metadata/persistent_tokens.key."
9090
elif has_existing_persistent_key_state; then
91-
export PERSISTENT_TOKENS_KEY="${LEGACY_PERSISTENT_TOKENS_KEY}"
91+
unset PERSISTENT_TOKENS_KEY || true
9292
export PERSISTENT_TOKENS_KEY_SOURCE="legacy_default"
9393
echo "WARNING: No explicit persistent tokens key is configured, but existing encrypted state was found. Continuing with the legacy built-in key for backward compatibility."
9494
else
@@ -106,7 +106,7 @@ else
106106
fi
107107
fi
108108

109-
if [ "${PERSISTENT_TOKENS_KEY}" = "default_please_change_this_key" ] || [ "${PERSISTENT_TOKENS_KEY}" = "please_change_this_@@" ]; then
109+
if [ "${PERSISTENT_TOKENS_KEY:-}" = "default_please_change_this_key" ] || [ "${PERSISTENT_TOKENS_KEY:-}" = "please_change_this_@@" ]; then
110110
echo "WARNING: PERSISTENT_TOKENS_KEY matches a published placeholder value. Replace it with a unique secret and plan a controlled rotation."
111111
fi
112112

0 commit comments

Comments
 (0)