# secrets Secret storage and masking. Generated by `make records` from the decisions whose `topic` (or `also`) is this one; edit the decisions, not this page. ## Current ### Masking - **Mask task logs and outputs when shown** (D131): The webserver masks log text and output texts, names and fields named by secret words when shown. Log parts use whole lines and 64 KiB of preceding masking context; UI and CLI use 1 MiB parts, with oversized lines visibly cut and their remainder skipped. Ordinary downstream tasks receive stored outputs, already masked for secret values by the agent under D167; `RunOf` readers receive API- masked outputs. - **Secret values are masked in outputs before storage** (D167): The agent masks secret values in attempt outputs and error summaries before they leave the worker. Downstream tasks receive `****`; masking writes a warning naming the secret and replacement count. - **Vault non-string values are read and masked as JSON text** (D171): Vault KV v2 values that are not strings are read as JSON text. The resulting text is masked as a secret. ### Using secrets - **Failed on-demand secret reads can set the attempt error kind** (D168): A failed on-demand secret read fails the CLI call or raises in Python and is remembered. If the attempt fails without its own error kind, the secret’s kind fills it; success remains success. - **Secrets are typed as their values** (D176): Indexing a secret path gives a dict; indexing a key gives a string. `secrets.value('path#key', default=...)` gives a string; task context has matching methods. Indexing a `path#key` is refused when the file loads. - **schedr.text marks a t-string as a string for Python tasks** (D177): `schedr.text(t'...')` marks a t-string passed where a Python task takes a string. It is typed as `str`. - **secrets= accepts strings and placeholders** (D178): `secrets=` accepts plain path or path-and- key strings. It also accepts whole-secret and key placeholders. ### Storage and keys - **schedr secrets new-key generates a secret key** (D169): `schedr secrets new-key` prints a new `SCHEDR_SECRET_KEY`. The key is 32 random bytes encoded as base64; rotation is not built now. - **Secret export writes one JSON file per secret** (D170): `schedr secrets export --to DIR` writes each secret to `DIR/.json` with mode 0600. It refuses a nonempty directory and prints no secret values to the terminal. - **Multiple secret storages require an explicit default** (D172): Startup refuses several storages without `[secret_storage] default`. A single storage is the default; standalone uses `db` when none is configured. - **Teams requiring isolation run separate deployments** (D173): A task can use its worker's Vault login and access its role's allowed paths. Teams kept apart use separate deployments; a federated UI can show them together. ### From other topics - Run parameters are masked when shown (D134, `task-context`; built M4.5a) - Trigger-time parameter values are masked (D142, `task-context`; built M4.5a) - Secret-named parameter fields use empty password inputs (D150, `ui-cli`; built M4.5c) - SQL and Mongo credentials may be separate or URL encoded (D188, `connections`; built M4.7b1) - Command connection secrets go to files and prefixed variables (D190, `connections`; built M4.7b2) - Attempt timeouts include secret and connection reads (D213, `task-processes`; built (B160 fixed)) - A cleanup receives its task's declared connections (D218, `cleanup`; built M4.8a) - Handles are masked before the journal and master (D222, `cleanup`; built M4.8a) - Resource cleanup inherits setup secrets and connections (D226, `cleanup`; built M4.8c1) - Inline server timings use the hidden configuration (D240, `configuration`; built M4.8u) ## Replaced None. ## Where in code - `crates/schedr-agent/src/agent.rs` (D167, D168, D190) - `crates/schedr-agent/src/agent/tests.rs` (D168) - `crates/schedr-agent/src/connection_env.rs::credentials` (D188) - `crates/schedr-agent/src/connection_env.rs::view` (D190) - `crates/schedr-agent/src/connection_env.rs::write` (D190) - `crates/schedr-agent/src/handles.rs::add` (D222) - `crates/schedr-agent/src/launch.rs::deadline` (D213) - `crates/schedr-agent/src/mask.rs::MaskSet` (D167, D188) - `crates/schedr-agent/src/mask.rs::mask_json` (D167) - `crates/schedr-agent/src/mask/tests.rs` (D188) - `crates/schedr-agent/src/render/tests.rs` (D188) - `crates/schedr-agent/src/secrets.rs` (D176, D190) - `crates/schedr-agent/src/secrets.rs::failed_kind` (D168) - `crates/schedr-agent/src/vault.rs::text` (D171) - `crates/schedr-api/src/logs.rs::masked_lines` (D131) - `crates/schedr-api/src/routes.rs::mask_data` (D134) - `crates/schedr-api/src/routes.rs::shown` (D131) - `crates/schedr-api/src/views.rs` (D131) - `crates/schedr-api/src/views.rs::mask_data` (D142) - `crates/schedr-api/src/views/form.rs::holds_secret` (D150) - `crates/schedr-config/src/config.rs::connection_job_cancel_grace` (D240) - `crates/schedr-config/src/config.rs::stop_poll` (D240) - `crates/schedr-config/src/config.rs::vault_renew_check` (D240) - `crates/schedr-config/src/loader.rs::check_secret_storage` (D172) - `crates/schedr-config/src/masked.rs::mask_data` (D131, D142) - `crates/schedr-master/src/params.rs` (D134) - `crates/schedr-model/src/commands.rs` (D176) - `crates/schedr-model/src/params.rs::shown` (D134) - `crates/schedr-model/src/secret.rs` (D176) - `crates/schedr-ui/src/params_form.rs` (D134, D150) - `crates/schedr/src/secret_storage.rs` (D172) - `crates/schedr/src/secrets.rs::NewKey` (D169) - `crates/schedr/src/secrets.rs::export` (D170) - `python/schedr/_secrets.py::Secrets` (D176) - `python/schedr/_secrets.py::declared` (D178) - `python/schedr/_templates.py::text` (D177) - `python/schedr/connection_types.py::_credentials` (D188) - `python/schedr/context.py::secret_value` (D176) - `python/schedr/resources.py` (D226) ## Open None. Details and edge cases, with the reasons; read them before changing this: - archive/PROJECT.md: Secret storage, Web UI and CLI