Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add allow=\"local-network-access *\" attribute to iframe for Chrome 142 compatibility [#8132](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8132)",
"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function createHiddenIframe(): HTMLIFrameElement {
"sandbox",
"allow-scripts allow-same-origin allow-forms"
);
authFrame.setAttribute("allow", "local-network-access *");
document.body.appendChild(authFrame);

return authFrame;
Expand Down
12 changes: 12 additions & 0 deletions lib/msal-browser/test/interaction_handler/SilentHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ describe("SilentHandler.ts Unit Tests", () => {
);
expect(authFrame instanceof HTMLIFrameElement).toBe(true);
});

it("Sets the allow attribute for local network access on iframe", async () => {
const authFrame = await SilentHandler.initiateCodeRequest(
testNavUrl,
performanceClient,
browserRequestLogger,
RANDOM_TEST_GUID
);
expect(authFrame.getAttribute("allow")).toBe(
"local-network-access *"
);
});
});

describe("monitorIframeForHash", () => {
Expand Down