Skip to content

Refuse separator-bearing env secret ids only in multi-team mode - #71136

Closed
potiuk wants to merge 1 commit into
apache:mainfrom
potiuk:gate-env-secret-team-refusal-on-multi-team
Closed

Refuse separator-bearing env secret ids only in multi-team mode#71136
potiuk wants to merge 1 commit into
apache:mainfrom
potiuk:gate-env-secret-team-refusal-on-multi-team

Conversation

@potiuk

@potiuk potiuk commented Aug 5, 2026

Copy link
Copy Markdown
Member

Another follow-up after @amoghrajesh's #71078, which fixed this same regression in the AWS, Key Vault, Google Secret Manager and Lockbox secrets backends. The core EnvironmentVariablesBackend carries it too, and was not covered there — cc @vatsrahul1001 @amoghrajesh.

The backend refuses any connection or variable id carrying the team namespace separator, because such an id cannot be attributed to a team unambiguously — a team name may itself contain the separator, so _a___b___c reads as team a with id b___c just as well as team a___b with id c.

That refusal fires unconditionally, including in deployments that never enabled multi-team mode. There, an ordinary connection or variable id that happens to contain ___ is silently reported as missing — no exception, and nothing distinguishes it from a secret that was never set.

No team scoped secret can be read while multi-team is off: the lookups are only ever handed a team_name in that mode. So the id has a single meaning there and nothing needs refusing. Same gate as #71078, applied at the same place in the logic.

What this changes for the tests

The existing team-scoping tests all assert the refusal, so they now run with multi-team enabled. Two of them (test_connection_env_var_do_not_access_team_specific and test_variable_env_var_do_not_access_team_specific) would otherwise fail, because AIRFLOW_CONN__TEAM___TEST_MYSQL legitimately resolves as an ordinary connection named _team___test_mysql once multi-team is off — that is the intended trade, and the same one #71078 makes on the provider side.

Test plan

  • New TestEnvironmentVariablesBackendWithoutMultiTeam — verified against unmodified code: it fails with assert None == 'team-agnostic-value', the reported symptom exactly
  • test_secrets.py, test_secrets_environment_variables.py, test_secrets_backends.py — 72 passed
  • Full airflow-core/tests/unit/always — 2008 passed; the one failure (example_mysql_to_gcs.py) is a missing mysqlclient on the host and reproduces on unmodified main
  • ruff / ruff format / static checks clean

No newsfragment: #70736 is milestoned 3.3.1 and unreleased, so the regression never reached users.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

The environment variables backend refuses any connection or variable id
carrying the team namespace separator, because such an id cannot be
attributed to a team unambiguously. That refusal fires unconditionally,
including in deployments that never enabled multi-team mode, where an
ordinary id that happens to contain `___` is silently reported as missing.

No team scoped secret can be read while multi-team is off -- the lookups
are only ever given a team name in that mode -- so the id has a single
meaning there and nothing needs refusing.

This is the core half of the same regression fixed for the AWS, Key Vault,
Google Secret Manager and Lockbox backends in apache#71078.
@potiuk
potiuk requested review from ashb and dstandish as code owners August 5, 2026 03:32
@potiuk
potiuk requested review from amoghrajesh, vatsrahul1001 and vincbeck and removed request for ashb and dstandish August 5, 2026 03:32
@potiuk potiuk added this to the Airflow 3.3.1 milestone Aug 5, 2026
@potiuk potiuk added the backport-to-v3-3-test Backport to v3-3-test label Aug 5, 2026
@potiuk

potiuk commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Closing in favour of #71079

@potiuk potiuk closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant