Skip to content

validate URL scheme before opening in url_opener (#21)#61

Open
dvoraj75 wants to merge 1 commit intodevelopfrom
feat/issue-21-validate-urls
Open

validate URL scheme before opening in url_opener (#21)#61
dvoraj75 wants to merge 1 commit intodevelopfrom
feat/issue-21-validate-urls

Conversation

@dvoraj75
Copy link
Copy Markdown
Owner

This pull request introduces a security improvement to the open_url function in forgewatch/url_opener.py by restricting which URL schemes can be opened. Only http and https URLs are now permitted, preventing the opening of potentially unsafe or arbitrary protocols.

Security enhancements:

  • Restricted the open_url function to only allow URLs with http and https schemes, rejecting others with a warning to prevent misuse via xdg-open or the XDG Desktop Portal. [1] [2]

@dvoraj75 dvoraj75 added enhancement New feature or request v1.5.1 Targeted for v1.5.1 release security Security hardening labels Mar 21, 2026
@dvoraj75 dvoraj75 changed the base branch from main to develop March 21, 2026 22:06
Restrict open_url() to http:// and https:// schemes only. Malformed
or unexpected URLs from the API (e.g. file://, javascript:, custom
schemes) are now rejected with a warning log instead of being passed
through to xdg-open or the XDG Desktop Portal.

Closes #21
@dvoraj75 dvoraj75 force-pushed the feat/issue-21-validate-urls branch from c7ec22a to 27df680 Compare March 21, 2026 22:07
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 21, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1922 1868 97% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
forgewatch/url_opener.py 96% 🟢
TOTAL 96% 🟢

updated for commit: 27df680 by action🐍

@dvoraj75 dvoraj75 linked an issue Mar 21, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request security Security hardening v1.5.1 Targeted for v1.5.1 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate URLs before opening in url_opener

1 participant