Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes client HTML5 Information Exposure #3978

Merged
merged 8 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions container/src/services/container.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class ContainerService {
*/
sendCustomMessageToIframe(iframeHandle: any, msg: any, msgName?: string) {
const messageName = msgName || 'custom';

if (iframeHandle.iframe.contentWindow) {
const iframeUrl = new URL(iframeHandle.iframe.src);
messageName === 'custom'
Expand All @@ -42,22 +43,25 @@ export class ContainerService {
*/
dispatch(msg: string, targetCnt: HTMLElement, data: any, callback?: Function, callbackName?: string): void {
const customEvent = new CustomEvent(msg, { detail: data });

if (callback && GenericHelperFunctions.isFunction(callback) && callbackName) {
(customEvent as any)[callbackName] = data => {
callback(data);
};
}

targetCnt.dispatchEvent(customEvent);
}

/**
* Retrieves the target container based on the event source.
*
*
* @param event The event object representing the source of the container.
@returns {Object| undefined} The target container object or undefined if not found.
* @returns {Object| undefined} The target container object or undefined if not found.
*/
getTargetContainer(event) {
let cnt;

globalThis.__luigi_container_manager.container.forEach(element => {
if (element.iframeHandle?.iframe && element.iframeHandle.iframe.contentWindow === event.source) {
cnt = element;
Expand Down Expand Up @@ -113,7 +117,7 @@ export class ContainerService {
},
authData: targetCnt.authData || {}
},
'*'
target.origin
);
break;
case LuigiInternalMessageID.NAVIGATION_REQUEST:
Expand Down Expand Up @@ -185,6 +189,7 @@ export class ContainerService {
};
window.addEventListener('message', globalThis.__luigi_container_manager.messageListener);
}

return globalThis.__luigi_container_manager;
}

Expand Down
Loading