mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added origin check to admin auth frame message listener
refs https://github.com/TryGhost/Team/issues/1694 - Only listen to messages that are coming from the auth iframe - Related PR for the other side: https://github.com/TryGhost/Ghost/pull/15135
This commit is contained in:
parent
14a9fab688
commit
587e5b887e
1 changed files with 6 additions and 2 deletions
|
@ -185,10 +185,14 @@ export default class App extends React.Component {
|
|||
const frame = document.querySelector('iframe[data-frame="admin-auth"]');
|
||||
let uid = 1;
|
||||
let handlers = {};
|
||||
const adminOrigin = new URL(this.props.adminUrl).origin;
|
||||
|
||||
window.addEventListener('message', function (event) {
|
||||
if (event.origin !== '*') {
|
||||
// return;
|
||||
if (event.origin !== adminOrigin) {
|
||||
// Other message that is not intended for us
|
||||
return;
|
||||
}
|
||||
|
||||
let data = null;
|
||||
try {
|
||||
data = JSON.parse(event.data);
|
||||
|
|
Loading…
Add table
Reference in a new issue