Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: update url whitelist (#5356)
* enhancement: move open url in browser into own function * enhancement: add confirmation popup * chore: add localization to external url popup * fix: fix condition for blacklist * fix: fix url validation * chore: remove blacklist from electron + locale fixase * fix: update strings Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org>
- Loading branch information
1 parent
d497912
commit be3cff4
Showing
15 changed files
with
83 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/desktop/views/dashboard/settings/views/help/HelpSection.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/shared/lib/core/app/constants/external-allowed-links.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const externalAllowedLinks = [ | ||
// IOTA Foundation | ||
'blog.iota.org', | ||
'chrysalis.iota.org', | ||
'chrysalis.docs.iota.org', | ||
'discord.iota.org', | ||
'firefly.iota.org', | ||
'iota.org', | ||
'privacy@iota.org', | ||
'wiki.iota.org', | ||
'explorer.iota.org', | ||
|
||
// Assembly / Shimmer | ||
'assembly.sc', | ||
'shimmer.network', | ||
'explorer.shimmer.network', | ||
|
||
// GitHub | ||
'github.com/iotaledger/firefly/issues', | ||
'github.com/iotaledger/firefly/issues/new/choose', | ||
|
||
// Other | ||
'support.ledger.com', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './app-updater-poll-interval.constant' | ||
export * from './default-app-settings.constant' | ||
export * from './external-allowed-links.constant' | ||
export * from './privacy-policy-version.constant' | ||
export * from './terms-of-service-version.constant' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { closePopup, openPopup } from '@auxiliary/popup' | ||
import { localize } from '@core/i18n' | ||
import { Platform } from '../classes/platform.class' | ||
import { externalAllowedLinks } from '../constants' | ||
|
||
export function openUrlInBrowser(targetUrl: string): void { | ||
const url = new URL(targetUrl) | ||
const domain = url.hostname.replace('www.', '').replace('mailto:', '') | ||
|
||
const isAllowed = externalAllowedLinks.includes(domain) || externalAllowedLinks.includes(domain + url.pathname) | ||
|
||
if (isAllowed) { | ||
Platform.openUrl(targetUrl) | ||
} else { | ||
openPopup({ | ||
type: 'confirmation', | ||
props: { | ||
title: localize('popups.externalUrl.title'), | ||
description: localize('popups.externalUrl.body', { values: { url: targetUrl } }), | ||
hint: localize('popups.externalUrl.hint'), | ||
warning: true, | ||
confirmText: localize('popups.externalUrl.action'), | ||
onConfirm: () => { | ||
Platform.openUrl(targetUrl) | ||
closePopup() | ||
}, | ||
}, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters