Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcveens committed Mar 14, 2024
1 parent aaab92d commit 5978edf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DrawIoEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const DrawIoEmbed = forwardRef<DrawIoEmbedRef, DrawIoEmbedProps>(
onTemplate(data);
}
}
});
}, baseUrl);
};

useImperativeHandle(
Expand Down
4 changes: 2 additions & 2 deletions src/utils/handleEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ type EventHandler = {
[key in EmbedEvents['event']]?: (data: Extract<EmbedEvents, { event: key }>) => void;
};

export function handleEvent(event: MessageEvent, handlers: EventHandler) {
if (!event.origin.includes('embed.diagrams.net') && !event.origin.includes(baseUrl)) {
export function handleEvent(event: MessageEvent, handlers: EventHandler, baseUrl?: string) {
if (!event.origin.includes('embed.diagrams.net') && (baseUrl && !event.origin.includes(baseUrl))) {

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
embed.diagrams.net
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
return;
}

Expand Down

0 comments on commit 5978edf

Please sign in to comment.