Schema reference
Sensitive fields
Secrets that never leave the server, and write-only fields the editor can replace without seeing them.
Use them for webhooks, tokens, passwords and similar secrets.
| Declaration | Editor | Submitting a value |
|---|---|---|
.sensitive() | Shows "Set" or "Not set", never the value. | Refused with not_writable. |
.writeOnly() | Shows "Set" or "Not set" and offers Replace value. | Replaces the stored value. |
ConfigField.string("webhook-url").label("Webhook URL").optional().writeOnly()
.pattern("https://.+", "Use an https:// URL.")),Rules
- Only
stringandtextfields outside object lists can be sensitive. read()returns the real value; the bridge removes it before anything leaves the server and reports only whether a value exists (nulland""count as "no value").- When a submission omits a sensitive field (the normal case), the bridge merges the stored value from
read()intoproposed, so yourapplyalways receives the complete values. Merged values are passed through as stored, whatever their type, without re-validation. - Return sensitive values from
read()asString. YAML reads unquoted numbers andyes/noas numbers and booleans, so a numeric password, PIN or channel id arrives as anIntegerorLong.SectionMapper.readconverts it to text; without it, convert it withString.valueOfinread(). The bridge keeps such a value unchanged when the field is omitted and logs a warning, but a replacement from the editor is always aString. - Changes of sensitive fields are reported without before and after values. The bridge never logs values; do not log them in your plugin either.
- A secret that is "unset" in your file (the demo stores
webhook-url: "") should be returned asnullfromread()and written back fromnullinapply.SectionMapperdoes this for optional text fields.
In ApplyContext
ApplyContext.current() and proposed() include sensitive values. In changes(), a FieldChange of a sensitive
field has sensitive() set and before() and after() always null.
Keep secrets and configuration values out of the messages you return in ValidationResult issues,
ApplyResult.rejected(message) and ApplyResult.failed(message).