mirror of
https://github.com/logto-io/logto.git
synced 2025-03-24 22:41:28 -05:00
fix(ui): protect window.location xss (#1639)
protect window.location xss
This commit is contained in:
parent
69b1b85c80
commit
34b465c7d8
2 changed files with 3 additions and 3 deletions
|
@ -30,7 +30,7 @@ const useSocialLandingHandler = () => {
|
|||
storeCallbackLink(connectorId, nativeCallbackLink);
|
||||
}
|
||||
|
||||
window.location.replace(redirectUri);
|
||||
window.location.replace(new URL(redirectUri));
|
||||
},
|
||||
[search, setToast, t]
|
||||
);
|
||||
|
|
|
@ -13,7 +13,7 @@ describe(`SocialLanding Page`, () => {
|
|||
const replace = jest.fn();
|
||||
it('Should set session storage and redirect', async () => {
|
||||
const callbackLink = 'logto:logto.android.com';
|
||||
const redirectUri = 'www.github.com';
|
||||
const redirectUri = 'http://www.github.com';
|
||||
|
||||
/* eslint-disable @silverhand/fp/no-mutating-methods */
|
||||
Object.defineProperty(window, 'location', {
|
||||
|
@ -40,7 +40,7 @@ describe(`SocialLanding Page`, () => {
|
|||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(replace).toBeCalledWith(redirectUri);
|
||||
expect(replace).toBeCalledWith(new URL(redirectUri));
|
||||
});
|
||||
|
||||
expect(getCallbackLinkFromStorage('github')).toBe(callbackLink);
|
||||
|
|
Loading…
Add table
Reference in a new issue