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
@@ -249,6 +249,8 @@ test('API: a staff password without the 2FA code opens nothing; with the code it
|
||||
for (const path of guarded) {expect((await api.get(path)).status(), `${path} with the code`).toBe(200)}
|
||||
const after = await (await api.post('/api/graphql', { data: { query } })).json()
|
||||
expect(after.errors).toBeUndefined()
|
||||
expect(after.data.SiteIntegration.smtpPassword).toBe('e2e-sink')
|
||||
// the secret is stored (create-test-admin.ts) and never returned, also to a fully signed-in admin
|
||||
expect(after.data.SiteIntegration.smtpPassword).toBe('********')
|
||||
expect(JSON.stringify(after)).not.toContain('e2e-sink')
|
||||
await api.dispose()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user