Fix DAG named "DAGs" colliding with the global DAGs permission resource#69106
Draft
potiuk wants to merge 1 commit into
Draft
Fix DAG named "DAGs" colliding with the global DAGs permission resource#69106potiuk wants to merge 1 commit into
potiuk wants to merge 1 commit into
Conversation
resource_name() returned the dag_id unchanged when it equalled a reserved resource name. Because a real dag_id can be "DAGs" (it passes the dag_id validator), a DAG named "DAGs" resolved to the global DAGs resource instead of its own per-DAG "DAG:DAGs" resource, so permissions for that DAG were applied to the wrong resource. Drop the reserved-name short-circuit so a dag_id is always prefixed. The already-prefixed branch (e.g. "DAG:foo") still short-circuits, which is safe because the "DAG:" / "DAG Run:" prefixes contain a colon that the dag_id validator (KEY_REGEX = ^[\w.-]+$) forbids. Mirrored in the airflow-core copy. Generated-by: Claude Opus 4.8 following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
Member
Author
|
@vincbeck — one judgement call to flag here: I removed the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
resource_name()returned thedag_idunchanged when it equalled a reserved resource name. Because a realdag_idcan beDAGs(it passes thedag_idvalidator), a DAG namedDAGsresolved to the globalDAGspermission resource instead of its own per-DAGDAG:DAGsresource, so that DAG's permissions were applied to the wrong resource.This drops the reserved-name short-circuit so a
dag_idis always prefixed (DAG:<dag_id>). The already-prefixed branch (DAG:foo,DAG Run:foo) still short-circuits — safe because those prefixes contain a colon, which thedag_idvalidator (KEY_REGEX = ^[\w.-]+$) forbids, so no realdag_idcan reach it. The same fix is mirrored in the duplicatedairflow-corecopy.Tests
resource_name("DAGs", RESOURCE_DAG)now returnsDAG:DAGs(FAB + core copies); ordinary and already-prefixed names unchangedproviders/fabtest_security.pysuite passes;ruffcleanWas generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.8 following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions