Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

filter custom connectSrc #551

Merged
merged 3 commits into from
Apr 2, 2020
Merged

filter custom connectSrc #551

merged 3 commits into from
Apr 2, 2020

Conversation

szymonlesisz
Copy link
Contributor

No description provided.

@szymonlesisz szymonlesisz requested a review from prusnak April 2, 2020 07:35
// `trezord` will block communication anyway
export const corsValidator = (url?: string) => {
if (typeof url !== 'string') return;
if (url.match(/^https:\/\/([a-zA-Z0-9-_])*.trezor.io\//)) return url;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be /^https:\/\/([A-Za-z0-9\-_]+\.)*trezor\.io\//

in the original regex, the following did not work:

  • https://trezor.io/ (please add to test below)
  • https://sub.dom.trezor.io/ (please add to test below)

and this worked:

  • https://testxtrezorxio/(please add to test below)

if (typeof url !== 'string') return;
if (url.match(/^https:\/\/([a-zA-Z0-9-_])*.trezor.io\//)) return url;
if (url.match(/^https?:\/\/localhost:[58][0-9]{3}\//)) return url;
if (url.match(/^https:\/\/([a-zA-Z0-9-_])*.sldev.cz\//)) return url;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be /^https:\/\/([A-Za-z0-9\-_]+\.)*sldev\.cz\//

same reason as above, please add to tests too

@prusnak prusnak merged commit 98738c5 into develop Apr 2, 2020
@prusnak prusnak deleted the fix/filter-custom-src branch April 2, 2020 08:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants