mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
fix(auth): [PM-1779] replace wildcard with window.location.origin in postMessage
Improve security by using specific origin instead of wildcard in postMessage calls to prevent potential information leakage to third parties. PM-1779
This commit is contained in:
@@ -33,7 +33,7 @@ window.addEventListener("load", async () => {
|
|||||||
|
|
||||||
displayHandoffMessage(client);
|
displayHandoffMessage(client);
|
||||||
} else if (client === "browser") {
|
} else if (client === "browser") {
|
||||||
window.postMessage({ command: "duoResult", code: code, state: state }, "*");
|
window.postMessage({ command: "duoResult", code, state }, window.location.origin);
|
||||||
displayHandoffMessage(client);
|
displayHandoffMessage(client);
|
||||||
} else if (client === "mobile" || client === "desktop") {
|
} else if (client === "mobile" || client === "desktop") {
|
||||||
if (client === "desktop") {
|
if (client === "desktop") {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function initiateWebAppSso(code: string, state: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initiateBrowserSso(code: string, state: string, lastpass: boolean) {
|
function initiateBrowserSso(code: string, state: string, lastpass: boolean) {
|
||||||
window.postMessage({ command: "authResult", code: code, state: state, lastpass: lastpass }, "*");
|
window.postMessage({ command: "authResult", code, state, lastpass }, window.location.origin);
|
||||||
const handOffMessage = ("; " + document.cookie)
|
const handOffMessage = ("; " + document.cookie)
|
||||||
.split("; ssoHandOffMessage=")
|
.split("; ssoHandOffMessage=")
|
||||||
.pop()
|
.pop()
|
||||||
|
|||||||
Reference in New Issue
Block a user