Skip to content

Resolve team scoped spelling of per-key secrets-backend-kwarg options as sensitive - #71160

Open
abhishekmauryaKsolves wants to merge 2 commits into
apache:mainfrom
abhishekmauryaKsolves:fix-71037-team-scoped-secrets-sensitivity
Open

Resolve team scoped spelling of per-key secrets-backend-kwarg options as sensitive#71160
abhishekmauryaKsolves wants to merge 2 commits into
apache:mainfrom
abhishekmauryaKsolves:fix-71037-team-scoped-secrets-sensitivity

Conversation

@abhishekmauryaKsolves

Copy link
Copy Markdown
Contributor

closes #71037

What

_is_per_key_sensitive_option and _mask_per_key_sensitive_options in
airflow-core/src/airflow/api_fastapi/core_api/services/public/config.py
matched literal section names (secrets, workers) only. A team scoped
spelling of the same option -- the [<team>=secrets] config-file section,
or the AIRFLOW__<TEAM>___SECRETS__BACKEND_KWARG__* environment variable,
both of which are reported under a section named after the team -- was
never recognised as sensitive.

Not exploitable today, since _get_custom_secret_backend is not team-aware
yet. But the gap becomes live the moment secrets backends gain team scoping,
and at that point it fails open: a team's backend credentials would be
returned in full by GET /config.

How

Both functions now resolve the section to its base section via
base_section_name -- the same helper AirflowConfigParser.is_sensitive_option
already uses for registered sensitive options (introduced in #70755) --
before deciding whether the option is sensitive.

  • _is_per_key_sensitive_option: looks up the prefix under
    base_section_name(section) instead of section.
  • _mask_per_key_sensitive_options: now iterates every section actually
    present in conf_dict (rather than only the literal secrets / workers
    keys) and resolves each one to its base section before matching. This
    also covers the team scoped env var case, since conf.as_dict already
    reports it under the team-derived section.

Testing

Added TestTeamScopedPerKeyBackendKwargMasking in
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py,
covering:

  • GET /config redacts a team scoped per-key option under both the
    secrets and workers team scoped sections, while a non-sensitive
    option in the same response stays untouched.
  • GET /config/section/{section}/option/{option} redacts a team scoped
    per-key option the same way it redacts the non-team-scoped one.

Full test_config.py suite run clean: 3377 passed, 0 failed.

… as sensitive

_is_per_key_sensitive_option and _mask_per_key_sensitive_options matched
literal section names ('secrets', 'workers') only, so a team scoped
spelling of the same option -- the [<team>=secrets] config-file section,
or the AIRFLOW__<TEAM>___SECRETS__BACKEND_KWARG__* env var, both of which
are reported under a section named after the team -- was never recognised
as sensitive.

Resolve the section to its base section via base_section_name (the same
helper AirflowConfigParser.is_sensitive_option uses for registered options,
introduced in apache#70755) before deciding sensitivity, in both
_is_per_key_sensitive_option and _mask_per_key_sensitive_options.

closes apache#71037
@abhishekmauryaKsolves
abhishekmauryaKsolves force-pushed the fix-71037-team-scoped-secrets-sensitivity branch from 94f820e to 00fc794 Compare August 5, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-key secrets-backend config options are not recognised as sensitive under a team-scoped spelling

1 participant