-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
v2.1.6 #843
v2.1.6 #843
Conversation
this.hostname = query.get('host') as string | ||
const redirectUrl = `http://${this.hostname}:8585/auth` | ||
const authUrl = `https://api.honeywell.com/oauth2/authorize?response_type=code&appSelect=1&redirect_uri=${encodeURI(redirectUrl)}&client_id=${query.get('key')}` | ||
res.end(`<script>window.location.replace('${authUrl}');</script>`) |
Check failure
Code scanning / CodeQL
Reflected cross-site scripting High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the reflected cross-site scripting vulnerability, we need to ensure that any user-controlled data included in the HTML response is properly sanitized. The best way to achieve this is by using a library designed for escaping HTML content, such as escape-html
.
- Import the
escape-html
library to handle HTML escaping. - Use the
escape-html
function to sanitize theauthUrl
before embedding it in the HTML response.
-
Copy modified line R6 -
Copy modified lines R38-R39
@@ -5,2 +5,3 @@ | ||
import util from 'node:util' | ||
import escapeHtml from 'escape-html' | ||
|
||
@@ -36,4 +37,4 @@ | ||
const redirectUrl = `http://${this.hostname}:8585/auth` | ||
const authUrl = `https://api.honeywell.com/oauth2/authorize?response_type=code&appSelect=1&redirect_uri=${encodeURI(redirectUrl)}&client_id=${query.get('key')}` | ||
res.end(`<script>window.location.replace('${authUrl}');</script>`) | ||
const authUrl = `https://api.honeywell.com/oauth2/authorize?response_type=code&appSelect=1&redirect_uri=${encodeURI(redirectUrl)}&client_id=${escapeHtml(query.get('key'))}` | ||
res.end(`<script>window.location.replace('${escapeHtml(authUrl)}');</script>`) | ||
break |
-
Copy modified lines R75-R76
@@ -74,3 +74,4 @@ | ||
"rxjs": "^7.8.1", | ||
"undici": "^6.20.1" | ||
"undici": "^6.20.1", | ||
"escape-html": "^1.0.3" | ||
}, |
Package | Version | Security advisories |
escape-html (npm) | 1.0.3 | None |
2.1.6 (2024-10-24)
What's Changes
Full Changelog: v2.1.5...v2.1.6