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
+1 -1
View File
@@ -76,7 +76,7 @@ test('beta.1: password only → refused; password and code → allowed (REST and
const full = [cookie, ...cookiesOf(verify)].join('; ')
const integrations = await get('/globals/site-integrations', { cookie: full })
expect(integrations.status).toBe(200)
expect(((await integrations.json()) as { smtpPassword: string }).smtpPassword).toBe('S3CRET')
expect(((await integrations.json()) as { smtpPassword: string }).smtpPassword).toBe('********') // set, never returned (write-only secrets)
expect((await get('/form-submissions', { cookie: full })).status).toBe(200)
})