Skip to main content

Module masked

Module masked 

Source
Expand description

A configuration as it may be shown or sent (decision 122, the user’s requirement of 2026-10-31): masked by the node itself before it leaves the process, so no secret is stored or sent in clear.

Secrets come only from environment variables, never the configuration file; the masking is the second line, for what a URL or a setting carries anyway. It works on the serialized configuration, every string of it, so a field added later is covered without being named:

  • A value under a key naming a secret is **** whole, whatever it is (text, a number, a list, an object). A name is compared without case and separators (api_key, apiKey and API-KEY alike); a path to a secret file (token_file, [tls] key holding a path) is shown: it is not the secret.
  • In any text, a password before @ is ****, the user, host, port and path kept (postgres://schedr:****@db:5432/schedr): with a scheme or // or none (u:p@db), several in one text, a password holding @, :, /, ' or parentheses.
  • In any text, a value after a name naming a secret and = or : is ****: a URL’s query (?password=…, the name percent-decoded: %70assword), a DSN (host=db password=…), a message (token: …).

Masking errs towards hiding: a port before @ may be hidden with a password, an email’s name after mailto: too. Never the other way.

Constants§

MASK
What a masked secret is shown as.

Functions§

mask
Masks every secret in value, in place.
mask_data
Masks the secrets in value, a task’s own data (its output), in place: every text as in a configuration, and a field whose name has a word naming a secret (password, api_key, clientSecret, access_token), by whole words, so partition_key or sort_key is shown: a task names its fields as it likes (decision 131).
mask_text
text with every secret in it masked: passwords before @, and values after a name naming a secret (see the module documentation). Its time grows with the text’s length, never faster.
mask_text_after
text masked as mask_text masks it, read after before, the text just before it, which is masked with it but not shown: a value begun in before (a quoted one going on over lines, a password whose name is there) is hidden in text too. A part of a log is masked so, the bytes before it as before.
masked
config serialized and masked (see the module documentation).
names_secret_in_words
Whether a word of name names a secret: its words split at anything but a letter or a digit, before an upper-case letter following a lower-case one or a digit (apiKey: api, key), and before the last of a run of upper-case letters followed by a lower-case one (HTTPPassword: http, password; AWSAccessKeyId: aws, access, key, id).