Log when integration manager origin is invalid
This commit is contained in:
parent
380639516b
commit
dc9b5fa996
1 changed files with 5 additions and 4 deletions
|
@ -549,13 +549,14 @@ const onMessage = function(event) {
|
|||
//
|
||||
// All strings start with the empty string, so for sanity return if the length
|
||||
// of the event origin is 0.
|
||||
//
|
||||
const url = SdkConfig.get().integrations_ui_url;
|
||||
if (event.origin.length === 0 || !url.startsWith(event.origin + '/')) {
|
||||
console.warn(`Message from IM with invalid origin ${event.origin} ignored`);
|
||||
return;
|
||||
}
|
||||
// TODO -- Scalar postMessage API should be namespaced with event.data.api field
|
||||
// Fix following "if" statement to respond only to specific API messages.
|
||||
const url = SdkConfig.get().integrations_ui_url;
|
||||
if (
|
||||
event.origin.length === 0 ||
|
||||
!url.startsWith(event.origin + '/') ||
|
||||
!event.data.action ||
|
||||
event.data.api // Ignore messages with specific API set
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue