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.

DeclarationEditorSubmitting 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.
VoucherSchema.java
ConfigField.string("webhook-url").label("Webhook URL").optional().writeOnly()
        .pattern("https://.+", "Use an https:// URL.")),

Rules

  • Only string and text fields 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 (null and "" count as "no value").
  • When a submission omits a sensitive field (the normal case), the bridge merges the stored value from read() into proposed, so your apply always receives the complete values. Merged values are passed through as stored, whatever their type, without re-validation.
  • Return sensitive values from read() as String. YAML reads unquoted numbers and yes/no as numbers and booleans, so a numeric password, PIN or channel id arrives as an Integer or Long. SectionMapper.read converts it to text; without it, convert it with String.valueOf in read(). The bridge keeps such a value unchanged when the field is omitted and logs a warning, but a replacement from the editor is always a String.
  • 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 as null from read() and written back from null in apply. SectionMapper does 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).

Built from f6347d4 on

On this page