Skip to content

Commit 2eff472

Browse files
Check for slash in route
1 parent 89617ed commit 2eff472

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/taskgraph/util/verify.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,17 @@ def verify_routes_notification_filters(
206206
)
207207
task_dict = task.task
208208
routes = task_dict.get("routes", [])
209+
print(f"DEBUG: Task {task.label} routes: {routes}")
209210

210211
for route in routes:
212+
print(f"DEBUG: Checking route: {route}")
211213
if route.startswith(route_prefix):
214+
# Check for invalid characters in the route
215+
if "/" in route:
216+
print(f"DEBUG: Found slash in route: {route}")
217+
raise Exception(
218+
f"{task.label} has invalid route with forward slash: {route}"
219+
)
212220
# Get the filter of the route
213221
route_filter = route.split(".")[-1]
214222
if route_filter not in valid_filters:

test/test_util_verify.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ def make_task_treeherder(label, symbol, platform="linux/opt"):
199199
DeprecationWarning,
200200
id="routes_notfication_filter: deprecated",
201201
),
202+
pytest.param(
203+
"verify_routes_notification_filters",
204+
make_graph(
205+
make_task(
206+
"invalid_slash",
207+
task_def={"routes": ["notify.email.default@email/address.on-completed"]},
208+
),
209+
),
210+
Exception,
211+
id="routes_notification_filter: invalid slash in route",
212+
),
202213
),
203214
)
204215
@pytest.mark.filterwarnings("error")

0 commit comments

Comments
 (0)