mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Fix Open Redirect and XSS via NIP-46 Authentication URL
- Validated `pendingAuthUrl` protocol to be `http:` or `https:` in `js/ui/loginModalController.js`. - Logged warning if unsafe URL is encountered. Signed-off-by: Jules <[email protected]> Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
c539fef553
commit
2f78bc6632
1 file changed
+17
@@ -1561,6 +1561,23 @@ export default class LoginModalController {
|
||||
if (!pendingAuthUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isValid = false;
|
||||
try {
|
||||
const parsed = new URL(pendingAuthUrl);
|
||||
isValid = parsed.protocol === "http:" || parsed.protocol === "https:";
|
||||
} catch (error) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
devLogger.warn(
|
||||
"[LoginModalController] Blocked unsafe authentication URL:",
|
||||
pendingAuthUrl,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.window && typeof this.window.open === "function") {
|
||||
this.window.open(pendingAuthUrl, "_blank", "noopener,noreferrer");
|
||||
} else if (this.document && this.document.location) {
|
||||
|
||||
Reference in new issue
Block a user