Skip to content

Commit 929fe4b

Browse files
Potential fix for code scanning alert no. 2: Incomplete URL substring sanitization (#356)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent ebadfd1 commit 929fe4b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cypress/e2e/links-and-images.cy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as urlLib from 'url';
2+
13
describe("links-and-images", () => {
24
it("should return 200 for all links and images", () => {
35
const testedPages = new Set<string>();
@@ -63,7 +65,10 @@ describe("links-and-images", () => {
6365
}
6466

6567
cy.log('>>>> Adding "' + url + '" to pages to test');
66-
if (url.includes("davidhu.io/") && !testedPages.has(url)) {
68+
const parsedUrl = urlLib.parse(url);
69+
const host = parsedUrl.host || "";
70+
const allowedHosts = ["davidhu.io"];
71+
if (allowedHosts.includes(host) && !testedPages.has(url)) {
6772
pagesToTest.push(url);
6873
}
6974
});

0 commit comments

Comments
 (0)