Skip to content

Python: Fix URL parsing to handle trailing punctuation in deployment progress detection - #2296

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
alert-autofix-29from
copilot/sub-pr-2274
Nov 18, 2025
Merged

Python: Fix URL parsing to handle trailing punctuation in deployment progress detection#2296
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
alert-autofix-29from
copilot/sub-pr-2274

Conversation

Copilot AI commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

The URL extraction logic in the Azure Container Apps deployment manager was failing to correctly identify azurecontainerapps.io URLs when they appeared with trailing punctuation (e.g., in sentences ending with periods or followed by commas).

Changes

  • Improved regex pattern: Changed from r'https://[^\s]+' to r'https://[^\s<>"]+' to exclude angle brackets and quotes that would never be part of a URL
  • Added punctuation stripping: Strip common trailing punctuation (.,;:!?\'")}]) before hostname extraction via urlparse()

Example

# Before: These would fail to match
"Deployed to https://myapp.azurecontainerapps.io."  # hostname: "myapp.azurecontainerapps.io."
"Visit https://myapp.azurecontainerapps.io, thanks" # hostname: "myapp.azurecontainerapps.io,"

# After: Correctly extracts clean hostnames
url_clean = url.rstrip('.,;:!?\'")}]')  
host = urlparse(url_clean).hostname  # "myapp.azurecontainerapps.io"

This ensures deployment progress messages trigger correctly regardless of surrounding punctuation context.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incomplete URL substring sanitization in code scanning Fix URL parsing to handle trailing punctuation in deployment progress detection Nov 18, 2025
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the python Usage: [Issues, PRs], Target: Python label Nov 18, 2025
@github-actions github-actions Bot changed the title Fix URL parsing to handle trailing punctuation in deployment progress detection Python: Fix URL parsing to handle trailing punctuation in deployment progress detection Nov 18, 2025
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) marked this pull request as ready for review November 18, 2025 10:35
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) merged commit 17b5f4c into alert-autofix-29 Nov 18, 2025
3 checks passed
Eduard van Valkenburg (eavanvalkenburg) added a commit that referenced this pull request Nov 18, 2025
…progress detection (#2296)

* Initial plan

* Fix URL parsing to handle trailing punctuation correctly

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
github-merge-queue Bot pushed a commit that referenced this pull request Nov 18, 2025
* 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 <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* updated lock

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
@crickman
Chris (crickman) deleted the copilot/sub-pr-2274 branch November 19, 2025 16:39
Aris Nguyen (arisng) pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* 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 (microsoft#2296)

* Initial plan

* Fix URL parsing to handle trailing punctuation correctly

Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>

* updated lock

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants