1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

Improve URL parsing (#411)

* Check hostname is valid in getDomain

* fix linting

* Update noop implementation

* Fix tests

* Fix tests
This commit is contained in:
Thomas Rittson
2021-06-23 06:00:14 +10:00
committed by GitHub
parent 18bf616e2e
commit 9ee31ad2fb
3 changed files with 14 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ describe('Utils Service', () => {
expect(Utils.getDomain('https://localhost')).toBe('localhost');
expect(Utils.getDomain('https://192.168.1.1')).toBe('192.168.1.1');
});
it('should reject invalid hostnames', () => {
expect(Utils.getDomain('https://mywebsite.com$.mywebsite.com')).toBeNull();
expect(Utils.getDomain('https://mywebsite.com!.mywebsite.com')).toBeNull();
});
});
describe('getHostname', () => {