M1 (1): stored secrets are write-only

smtpPassword and turnstileSecretKey in the Site integrations global are returned
as '********' to every read that goes through access control (REST, GraphQL, the
panel's form state); the Local API with access control off still gets the value.
A save that sends nothing, an empty value or the mask keeps the stored one;
'[[clear]]' removes it. MaskedField says that a value is set and offers to
remove it. Off: secrets: { writeOnly: false }. writeOnlySecret(s) and the hooks
are exported for a project's own fields.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:12 +01:00
co-authored by Claude Fable 5.2
parent cff355a541
commit 8fa71238ce
11 changed files with 345 additions and 35 deletions
+10
View File
@@ -186,6 +186,16 @@ export type IpalOptions = {
* SEO — adds meta fields to chosen collections (via @payloadcms/plugin-seo)
* and enables locale-aware metadata helpers.
*/
/**
* Stored secrets. `smtpPassword` and `turnstileSecretKey` (Site integrations)
* are **write-only** by default: REST, GraphQL and the panel get `'********'`
* ("a value is set"), never the value; a save that sends nothing, an empty
* value or the mask keeps what is stored, `'[[clear]]'` removes it. Server
* code reads the real value through the Local API (access control off, the
* default). `{ writeOnly: false }` = the value is returned to whoever may
* read the global, as before 1.16.7. docs/security.md "Stored secrets".
*/
secrets?: { writeOnly?: false }
seo?: SeoOption
/** Additional fields injected into SiteSettings global */