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:
co-authored by
Claude Fable 5.2
parent
cff355a541
commit
8fa71238ce
@@ -270,7 +270,7 @@ describe('what must keep working', () => {
|
||||
}
|
||||
expect(closed).toEqual([])
|
||||
const integrations = (await (await api('/globals/site-integrations', sessions.verified)).json()) as { smtpPassword?: string }
|
||||
expect(integrations.smtpPassword).toBe('S3CRET')
|
||||
expect(integrations.smtpPassword).toBe('********') // set, never returned (write-only secrets)
|
||||
expect((await api('/globals/site-settings', sessions.verified, { body: JSON.stringify({ siteName: 'Verified' }), method: 'POST' })).status).toBe(200)
|
||||
expect((await api('/ipal/cookie-scan', sessions.verified)).status).toBe(200)
|
||||
// 400 = past the login and role gates, stopped by the missing recipient
|
||||
@@ -280,7 +280,7 @@ describe('what must keep working', () => {
|
||||
test('a fully verified admin reads Site integrations (GraphQL)', async () => {
|
||||
const out = await gql(sessions.verified, '{ SiteIntegration { smtpPassword } FormSubmissions { totalDocs } }')
|
||||
expect(out.errors).toBeUndefined()
|
||||
expect((out.data?.SiteIntegration as { smtpPassword: string }).smtpPassword).toBe('S3CRET')
|
||||
expect((out.data?.SiteIntegration as { smtpPassword: string }).smtpPassword).toBe('********')
|
||||
})
|
||||
|
||||
test('anonymous visitors still read the public globals and forms', async () => {
|
||||
|
||||
Reference in New Issue
Block a user