You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
revert: remove CP toast notification on decrypt failure
The toast delivery proved unreliable across all tested paths:
- AddToasts/Axios interceptor path fails on page refresh because
Listing.vue's AbortController cancels the first request after the
server has already consumed the dedup cache key, so the second
(actually-read) response carries no _toasts.
- session()->flash() path shows only on the subsequent page load and
produced confusing UX.
Remove all associated code and tests:
- Drop Toast, Cache, Statamic imports and NOTIFY_TTL constant from
FieldEncryptor; decrypt() now just logs a warning and returns the
raw value on failure.
- Remove the $context parameter from decrypt() and update both
repository callers.
- Remove the decrypt_failure_toast lang string.
- Remove two now-stale FieldEncryptorTest cases (they tested absence
of Toast calls, which passed trivially after the code was gone).
- Update OVERVIEW.md and PLAN.md to reflect the simplified behaviour.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/OVERVIEW.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ tests/
60
60
- Checks the current user's permission (`view decrypted sensitive fields`).
61
61
-**Authorized**: strips `enc:v1:` prefix and decrypts the value.
62
62
-**Unauthorized**: replaces the value with the mask string (default `••••••`).
63
-
4. If decryption fails (e.g. key rotation), returns raw ciphertext, logs a warning, and dispatches a CP error toast to the current user (HTTP context only; deduplicated to once per form per hour via `Cache::add`).
63
+
4. If decryption fails (e.g. key rotation), returns raw ciphertextand logs a warning.
Copy file name to clipboardExpand all lines: docs/PLAN.md
+1-11Lines changed: 1 addition & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,8 +180,7 @@ Edition is detected via the **Statamic Editions API**: `Addon::edition()` reads
180
180
5. isEncrypted detects prefix
181
181
6. mask returns configured value
182
182
7. decrypt returns non-encrypted as-is
183
-
8. Failed decrypt does not dispatch toast in console context
184
-
9. Failed decrypt without context does not dispatch toast in console context
183
+
8. Failed decrypt returns raw value and logs warning (no side-effects)
185
184
186
185
### Feature (SensitiveFieldsTest, 12 tests)
187
186
1. Sensitive field stored encrypted
@@ -244,12 +243,3 @@ Larger teams need per-form control (e.g. HR form vs. contact form handled by dif
244
243
- Both `DecryptingSubmissionRepository` and `DecryptingSubmissionQueryBuilder` check global then per-form permission via `isAuthorizedForForm(string $formHandle)`.
245
244
246
245
---
247
-
248
-
### [FREE/PRO] CP notification on decrypt failure — Implemented
249
-
250
-
Decryption failures are now surfaced in the CP as an error toast in addition to the existing `Log::warning`.
251
-
252
-
-`FieldEncryptor::decrypt()` accepts an optional `string $context` parameter (form handle) for deduplication.
253
-
- In HTTP context, `Cache::add('sffields.decrypt_failure_notified.{context}', true, 3600)` is used as an atomic set-if-not-exists guard — at most one toast per form per hour.
254
-
-`Toast::error()` is skipped entirely when `app()->runningInConsole()` is true (commands, queue workers).
255
-
-`DecryptingSubmissionRepository` passes the form handle as `$context` when calling `decrypt()`.
'permission_form_description' => 'Allow viewing decrypted values of sensitive fields in this form only',
14
14
15
-
'decrypt_failure_toast' => 'One or more sensitive field values could not be decrypted. Your APP_KEY may have changed. Use sensitive-fields:rekey (Pro) to recover.',
16
-
17
15
'settings_enabled_display' => 'Enabled',
18
16
'settings_enabled_instructions' => 'Enable or disable field encryption.',
0 commit comments