Python: fix for Incomplete URL substring sanitization - #2274
Merged
Conversation
Eduard van Valkenburg (eavanvalkenburg)
requested a review
from Victor Dibia (victordibia)
November 17, 2025 13:51
Contributor
Member
Author
|
Copilot please have a look at the failures and fix them |
Contributor
|
Eduard van Valkenburg (@eavanvalkenburg) I've opened a new pull request, #2296, to work on those changes. Once the pull request is ready, I'll request review from you. |
…g sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…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>
Eduard van Valkenburg (eavanvalkenburg)
force-pushed
the
alert-autofix-29
branch
from
November 18, 2025 10:38
17b5f4c to
ec55d03
Compare
Eduard van Valkenburg (eavanvalkenburg)
marked this pull request as ready for review
November 18, 2025 11:01
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
November 18, 2025 11:02
View session
Copilot finished reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
November 18, 2025 11:04
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a security code scanning alert (#29) related to incomplete URL substring sanitization in the Azure deployment module. The fix enhances security by properly parsing and validating URLs before triggering deployment notifications.
Key Changes:
- Replaced naive substring matching (
"https://" in line_text and ".azurecontainerapps.io" in line_text) with robust URL parsing and hostname validation - Uses regex to extract URLs and
urlparseto validate that hostnames are exactly or subdomains ofazurecontainerapps.io
Reviewed Changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/devui/agent_framework_devui/_deployment.py | Implements secure URL validation using regex extraction, URL parsing, and hostname verification to prevent URL spoofing attacks |
| python/uv.lock | Version bump for agent-framework-ag-ui package from 1.0.0b251114 to 1.0.0b251117 |
Victor Dibia (victordibia)
approved these changes
Nov 18, 2025
Victor Dibia (victordibia)
requested review from
Dmytro Struk (dmytrostruk) and
Evan Mattson (moonbox3)
November 18, 2025 16:07
Evan Mattson (moonbox3)
approved these changes
Nov 18, 2025
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>
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.
Potential fix for https://github.com/microsoft/agent-framework/security/code-scanning/29
To address this issue, the safest approach is to parse any URL present in the text line and check that its host is exactly or a subdomain of
azurecontainerapps.iobefore sending the progress message.Specifically, edit the block spanning line 470:
urllib.parse.urlparseto parse it.azurecontainerapps.ioor a subdomain (*.azurecontainerapps.io), then trigger the message.urlparsefromurllib.parseand likelyrefor regex.No change of existing behavior except making detection robust.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.