Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion airflow-ctl/src/airflowctl/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import json
import logging
import os
import re
import sys
from collections.abc import Callable
from functools import wraps
Expand Down Expand Up @@ -160,7 +161,13 @@ def __init__(
):
self.api_url = api_url
self.api_token = api_token
self.api_environment = os.getenv("AIRFLOW_CLI_ENVIRONMENT") or api_environment
raw_env = os.getenv("AIRFLOW_CLI_ENVIRONMENT") or api_environment
if not re.match(r'^[a-zA-Z0-9_.-]+$', raw_env):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too strict. What about existing valid api_environment values like 'team:prod', or 'prod v2'?Previously this accepted any string, but now it is limited to , so these would fail. Since this comes from CLI/env, this could break real usages.

Seems like it would be better to loosen restriction to only block / and ..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move your comment to the original PR? #63691

raise ValueError(
f"Invalid environment name: '{raw_env}'. "
"Only alphanumeric characters, dashes, and underscores are allowed."
)
self.api_environment = raw_env
self.client_kind = client_kind

@property
Expand Down
Loading