-
-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main inline with next #399
Conversation
* chore: add extra events (#397) * chore: save logging to file * chore: hide fields feature flags * feat: right click context * fix: hide scroll * fix: create first issue tbn * fix: portal nav fix * fix: portal layout ui * chore: code cleanuo * chore: favicon
|
||
const url = webhook.url; | ||
|
||
if (url.includes("discord.com")) { |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
discord.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to parse the URL and check its host against a whitelist of allowed hosts. This ensures that the URL is indeed pointing to a legitimate Discord domain and not a malicious one. We will use the url
module from Node.js to parse the URL and then check the host.
- Import the
url
module. - Parse the URL to extract the host.
- Check the host against a whitelist of allowed hosts.
-
Copy modified line R2 -
Copy modified lines R21-R22 -
Copy modified line R24
@@ -1,2 +1,3 @@ | ||
import axios from "axios"; | ||
import { URL } from "url"; | ||
|
||
@@ -19,4 +20,6 @@ | ||
const url = webhook.url; | ||
const parsedUrl = new URL(url); | ||
const allowedHosts = ["discord.com", "www.discord.com"]; | ||
|
||
if (url.includes("discord.com")) { | ||
if (allowedHosts.includes(parsedUrl.host)) { | ||
const discordMessage = { |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
No description provided.