Skip to content

Potential fix for code scanning alert no. 2: Incomplete URL substring sanitization - #200

Draft
neatudarius wants to merge 1 commit into
mainfrom
alert-autofix-2
Draft

neatudarius wants to merge 1 commit into
mainfrom
alert-autofix-2

Conversation

@neatudarius

Copy link
Copy Markdown
Member

Potential fix for https://github.com/bemanproject/website/security/code-scanning/2

Use proper URL parsing and validate the hostname explicitly instead of substring matching.

Best fix in this file:

  • In scripts/run-staged-website.py, update youtube_embed to:
    • Parse URL via urllib.parse.urlparse.
    • Check hostname against exact allowed hosts (youtube.com, www.youtube.com, m.youtube.com, youtu.be).
    • For youtu.be, extract video ID from path.
    • For youtube.com variants, extract v from parsed query parameters (parse_qs) instead of string splitting.
    • Keep current behavior of returning original url when no valid video ID is found.
  • Add imports for parse_qs and urlparse from urllib.parse.

This preserves functionality while removing the unsafe substring host check.

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>
@netlify

netlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bemanproject ready!

Name Link
🔨 Latest commit 695a582
🔍 Latest deploy log https://app.netlify.com/projects/bemanproject/deploys/6addb741be2cd6add2cf3c68
😎 Deploy Preview https://deploy-preview-200--bemanproject.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
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.

1 participant