Skip to content

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

Draft
SafetyMP wants to merge 2 commits into
mainfrom
alert-autofix-1
Draft

Potential fix for code scanning alert no. 1: Incomplete URL substring sanitization#25
SafetyMP wants to merge 2 commits into
mainfrom
alert-autofix-1

Conversation

@SafetyMP

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/SafetyMP/Autonomous-EHS-Management/security/code-scanning/1

Use parsed hostname matching with explicit allowlists and safe subdomain checks instead of includes.

Best fix in this file:

  • In detectNotificationChannel (around lines 26–40), replace host.includes(...) checks with:
    • hostname === allowed OR hostname.endsWith("." + allowed)
  • Use URL(...).hostname (not host) to avoid port-related ambiguity.
  • Keep behavior otherwise unchanged (invalid URL still returns "json").

No new imports are required. Add small local helper predicates inside the function for clarity and to avoid duplication.

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

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
autonomous-ehs-management Ready Ready Preview, Comment May 31, 2026 1:50pm

@SafetyMP

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented May 31, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and merged main into this branch in commit 95cdc01.

@SafetyMP

SafetyMP commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

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