Skip to content

feat(config)!: support secrets in config #625

Closed

Description

@uniqueg

Problem

Secrets for app custom sections (backend credentials, client secrets, S3 keys) can't be referenced from config without app code, FOCA's own env variables can't come from mounted secret files, and secret values can show up in reprs and validation errors.

Proposal

  1. ${VAR} interpolation, Compose spec semantics: ${VAR}, ${VAR:-default}, ${VAR:?message}, $$ for a literal $. Applies to YAML string scalars only (never keys), after YAML parsing and before overlay merging and pydantic validation, only to file content (not runtime values). An unset variable without default is an error naming the key.
  2. *_FILE variables for MONGO_URI, MONGO_PASSWORD, MONGO_USERNAME, CELERY_BROKER_URL, CELERY_RESULT_BACKEND (Docker official-image convention): read the file, strip the final newline; setting both X and X_FILE is an error.
  3. SecretStr for FOCA's own secret-bearing fields; recommend it for apps' custom models in the docs.
  4. Not included: general FOCA_<SECTION>__<KEY> env overrides.

Breaking (minor): a config string containing ${...} today changes meaning (escape as $${...}). Document it under "Breaking changes" in the release notes and in the migration guide. Code reading a secret field must call .get_secret_value().

Acceptance criteria

  • Tests for every syntax form, errors, $$, keys untouched, overlay order, *_FILE (set, both set, missing file), SecretStr reprs; 100% coverage.
  • Docs: configuration page section, migration guide entry.

Has to land by 1.0.0-rc1. Comes after the issues that add config fields to mark as SecretStr.

Activity

  1. added this to the v0.21.0 milestone on Nov 3, 2026
  2. added
    priority: high
    status: blocked
    type flag: breaking change
    type: security
    workload: days
    on Nov 3, 2026
  3. added
    status: in progress
    and removed
    status: blocked
    on Nov 4, 2026
  4. removed
    status: in progress
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: hightype flag: breaking changetype: securityworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions