Safeguard
Security Guides•

Where should pipeline secrets live? Five approaches compared

Config suffixes, UI-hidden env vars, typed blocks, config providers and log redaction each protect something different. Compared by what still leaks.

Safeguard Security Team
4 min read

No single mechanism hides a pipeline secret everywhere. Each tool's approach keeps the value out of one place, such as a config file, the UI or a stored connector config, and leaves other places open. Compare them by what each prevents, then add the controls they leave out.

The approaches side by side

MechanismKeeps the secret out ofStill exposed to
Airflow config _cmd and _secret suffixesPlain text airflow.cfgAnyone running code as the Airflow user; a stale plain variable can override it
Dagster EnvVarThe UI, since it resolves at run timeCode that prints it; the deployment environment
Prefect blocks with SecretStr fieldsUI display by default; stored with extra encryptionFlow code that loads the block
Kafka Connect ConfigProviderStored connector configs, logs and REST responsesThe worker process, and the secret store itself
Spark redaction regexUI and logs, for names or values that match the patternNames that do not match; code that logs values

Each row comes from that project's own documentation. They solve different problems, so they are not interchangeable, and none of them stops an authorized pipeline from using the secret as intended.

Four questions to ask of any mechanism

  1. Where is the value stored, and is it encrypted there? A config file, a database, a vault.
  2. Who can read it through the UI or API? Many tools show config by default.
  3. Does it appear in logs, event histories or exports? Check for yourself, as with the Spark test described in what spark.redaction.regex hides.
  4. Who can write code that loads it? That person can use it, whatever the UI shows.

The fourth question is the one that decides risk. Display controls limit casual exposure. The real boundary is code review and deployment rights.

A layered pattern

  • Store secrets in one managed store, not in each tool.
  • Use short lived credentials where the target system supports them.
  • Give each pipeline its own identity with only the access it needs, so a leak affects one pipeline.
  • Keep secrets out of code, config files and command lines.
  • Rotate on a schedule, and immediately when someone with access leaves.
  • Test what the UI and logs show, using a harmless dummy secret.

Checking an existing estate

Walk through each orchestrator and connector you run:

  1. List the secrets it holds and who created them.
  2. Check which mechanism protects each one, using the table above as a prompt.
  3. Check the UI, logs and API output for clear text values.
  4. Find secrets older than your rotation policy and rotate them.
  5. Remove shared credentials, replacing them with one per pipeline.

For detail on specific tools, see Airflow secrets backend lookup order, dbt secrets in environment variables and logs and ETL pipeline secrets: where credentials leak.

Safeguard is not a secrets store, and this post does not describe scanning for secrets. It does cover dependency scanning, SBOMs and policy gates for the code around your pipelines; try the free scan at gold.safeguard.sh/scan.

Quick check

Is hiding a secret in the UI enough?

No. It limits casual exposure only. Code that can load the secret can still use or print it, so control who can deploy pipeline code.

Why one credential per pipeline?

A leak or misuse then affects one pipeline, and you can rotate or revoke without breaking the others.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.