Skip to content

Commit 293abf5

Browse files
eavanvalkenburggithub-advanced-security[bot]Copilotvictordibia
authored
Python: fix for Incomplete URL substring sanitization (#2274)
* Potential fix for code scanning alert no. 29: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Python: Fix URL parsing to handle trailing punctuation in deployment progress detection (#2296) * Initial plan * Fix URL parsing to handle trailing punctuation correctly Co-authored-by: eavanvalkenburg <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: eavanvalkenburg <[email protected]> * updated lock --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]> Co-authored-by: eavanvalkenburg <[email protected]> Co-authored-by: Victor Dibia <[email protected]>
1 parent e2d2299 commit 293abf5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

python/packages/devui/agent_framework_devui/_deployment.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from collections.abc import AsyncGenerator
1111
from datetime import datetime, timezone
1212
from pathlib import Path
13+
from urllib.parse import urlparse
1314

1415
from .models._discovery_models import Deployment, DeploymentConfig, DeploymentEvent
1516

@@ -467,11 +468,18 @@ async def _deploy_to_azure(
467468
await event_queue.put(
468469
DeploymentEvent(type="deploy.progress", message=f"Docker build: {line_text}")
469470
)
470-
elif "https://" in line_text and ".azurecontainerapps.io" in line_text:
471-
# Deployment URL detected
472-
await event_queue.put(
473-
DeploymentEvent(type="deploy.progress", message="Deployment URL generated!")
474-
)
471+
elif "https://" in line_text:
472+
# Try to extract all URLs and check if any is on azurecontainerapps.io
473+
urls = re.findall(r'https://[^\s<>"]+', line_text)
474+
for url in urls:
475+
# Strip common trailing punctuation to ensure clean URL parsing
476+
url_clean = url.rstrip(".,;:!?'\")}]")
477+
host = urlparse(url_clean).hostname
478+
if host and (host == "azurecontainerapps.io" or host.endswith(".azurecontainerapps.io")):
479+
await event_queue.put(
480+
DeploymentEvent(type="deploy.progress", message="Deployment URL generated!")
481+
)
482+
break
475483

476484
# Wait for process to complete
477485
return_code = await process.wait()

0 commit comments

Comments
 (0)