mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[CSA-28] Use path normalization in API requests (#4580)
* Use path normalization in API requests * Remove CLI webpack config change that's unneeded * Add additional tests
This commit is contained in:
@@ -326,4 +326,24 @@ describe("Utils Service", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizePath", () => {
|
||||
it("removes a single traversal", () => {
|
||||
expect(Utils.normalizePath("../test")).toBe("test");
|
||||
});
|
||||
|
||||
it("removes deep traversals", () => {
|
||||
expect(Utils.normalizePath("../../test")).toBe("test");
|
||||
});
|
||||
|
||||
it("removes intermediate traversals", () => {
|
||||
expect(Utils.normalizePath("test/../test")).toBe("test");
|
||||
});
|
||||
|
||||
it("removes multiple encoded traversals", () => {
|
||||
expect(
|
||||
Utils.normalizePath("api/sends/access/..%2f..%2f..%2fapi%2fsends%2faccess%2fsendkey")
|
||||
).toBe("api/sends/access/sendkey");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user