Skip to content

Potential fix for code scanning alert no. 1: Incomplete URL substring sanitization - #11

Merged
cyyeh merged 2 commits into
mainfrom
alert-autofix-1
Oct 30, 2026
Merged

cyyeh merged 2 commits into
mainfrom
alert-autofix-1

Conversation

@cyyeh

@cyyeh cyyeh commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/Agentic-System-Lab/agent-loop-visualizer/security/code-scanning/1

Use URL parsing and host validation instead of substring matching when selecting the GitHub-related markdown entry.

Best fix (without changing intended functionality): in tests/test_app.py around line 534, replace the list comprehension filter from:

  • "github.com" in m.value

to a predicate that parses m.value with urlsplit and checks the hostname/netloc is GitHub (exact github.com or a *.github.com subdomain). Since urlsplit is already imported in this file, no new import is needed. This keeps the test intent (“find the GitHub invite markdown”) while avoiding incomplete substring sanitization.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cyyeh
cyyeh requested a balanced review from Copilot October 30, 2026 06:57
@cyyeh
cyyeh marked this pull request as ready for review October 30, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The invitation test parses an entire paragraph as a URL, causing hostname validation to discard the invitation and raise a ValueError during unpacking.

1 open issue
What changed in this PR

This PR attempts to address a code-scanning alert by replacing substring matching with GitHub hostname validation in the unsupported-model UI test.

Changes:

  • Uses urlsplit to check for github.com or its subdomains when selecting the invitation Markdown.
File Description
tests/​test_app.py Replaces the invitation’s substring filter with URL hostname checks.

Review effort: Balanced

Comment thread tests/test_app.py Outdated
Extract Markdown link destinations before validating their GitHub hostnames. The invitation is a paragraph in both languages, so parsing the whole value as a URL discarded it and failed the page test.
@cyyeh
cyyeh merged commit ca3dc5b into main Oct 30, 2026
6 checks passed
@cyyeh
cyyeh deleted the alert-autofix-1 branch October 30, 2026 07:28
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