mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-04 21:05:54 +08:00
Let tldts check for invalid characters within URI/hostname (#19415)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
eaf410f01f
commit
255a4ae4e5
@ -156,6 +156,11 @@ describe("Utils Service", () => {
|
||||
expect(Utils.getHostname('https://bit!:"_&ward.com')).toBeNull();
|
||||
});
|
||||
|
||||
it("should not treat '!' in query string as an invalid url", () => {
|
||||
expect(Utils.getHostname("http://localhost:8080?a=!")).toBe("localhost");
|
||||
expect(Utils.getHostname("https://bitwarden.com?q=!")).toBe("bitwarden.com");
|
||||
});
|
||||
|
||||
it("should fail for data urls", () => {
|
||||
expect(Utils.getHostname("data:image/jpeg;base64,AAA")).toBeNull();
|
||||
});
|
||||
|
||||
@ -434,12 +434,6 @@ export class Utils {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Does uriString contain invalid characters
|
||||
// TODO Needs to possibly be extended, although '!' is a reserved character
|
||||
if (uriString.indexOf("!") > 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const hostname = getHostname(uriString, { validHosts: this.validHosts });
|
||||
if (hostname != null) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user