Skip to content

Fix incomplete URL substring sanitization for Azure blob storage check (CodeQL #92) - #370

Draft
ed-woodfall with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alerts-92
Draft

Fix incomplete URL substring sanitization for Azure blob storage check (CodeQL #92)#370
ed-woodfall with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alerts-92

Conversation

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Plain substring matching on an unparsed URL can be trivially bypassed — e.g. https://attacker.com/evil?.blob.core.windows.net would pass the old check. Fixes the high-severity CodeQL alert py/incomplete-url-substring-sanitization.

Overview

Replaces the unsafe substring check for Azure blob storage URLs with proper urlparse-based hostname validation.

JIRA

N/A — security alert fix

Changes

  • Imports urllib.parse.urlparse in interactive_session.py
  • Replaces '.blob.core.windows.net' in link_path_str with urlparse(link_path_str).hostname.endswith('.blob.core.windows.net'), scoping the check to the actual hostname component only
# Before (bypassable)
if link_path_str.startswith('https://') and '.blob.core.windows.net' in link_path_str:

# After (safe)
_parsed_url = urlparse(link_path_str)
_is_azure_https = (
    _parsed_url.scheme == 'https'
    and (_parsed_url.hostname or '').endswith('.blob.core.windows.net')
)
if link_path_str.startswith('az://') or _is_azure_https:

Acceptance Criteria

Scenario 1 - Azure blob URL is correctly rejected A valid Azure blob URL such as `https://myaccount.blob.core.windows.net/container/file` raises `ValueError`.
Scenario 2 - Bypass attempt is rejected A crafted URL such as `https://attacker.com/path?.blob.core.windows.net` does **not** trigger the Azure check (hostname is `attacker.com`, not a `.blob.core.windows.net` host).

DEV

Proof this feature/patch works in this environment

AZURE

Proof this feature/patch works in this environment

Interactive Analysis

Proof this feature/patch works in this environment

Co-authored-by: ed-woodfall <22744772+ed-woodfall@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code scanning alert(s) flagged in this repository Fix incomplete URL substring sanitization for Azure blob storage check (CodeQL #92) Aug 13, 2026
Copilot AI requested a review from ed-woodfall August 13, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants