Write-only secrets cannot be queried (review B-R1)

A where or sort on a write-only field answered by the stored value: as an admin,
where[version.smtpPassword][like]=Zq on Site integrations' versions gave a count, so the
secret could be read back one character at a time. writeOnlySecret now gives the field a
read rule, secretReadAccess (exported), that denies when Payload checks a query's fields
(no document) and allows a document read (masked as before). The panel's edit and create
views pass the document, so the field stays visible and editable there.

Covered: the global, its versions, a collection with and without versions, REST and
GraphQL, like / equals / exists / or / sort / count; reads still masked; panel
permissions; a save still stores the new value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 21:10:45 +01:00
co-authored by Claude Opus 5.5
parent ecf03c8dc0
commit eb2ad27787
6 changed files with 234 additions and 3 deletions
+1
View File
@@ -421,6 +421,7 @@ export {
maskWriteOnlySecrets,
SECRET_CLEAR,
SECRET_MASK,
secretReadAccess,
SMTP_PASSWORD_BOUND_TO,
writeOnlySecret,
writeOnlySecrets,