From ca313f4b0381e6e70f738ee969fdccef1ee63172 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Tue, 23 Jul 2024 21:48:21 +0100 Subject: [PATCH 1/3] Simplified iri validation Signed-off-by: Prabhu Subramanian --- package.json | 3 +-- pnpm-lock.yaml | 8 -------- types/utils.d.ts.map | 2 +- utils.js | 20 ++------------------ utils.test.js | 9 ++++++--- 5 files changed, 10 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 4d3dfe4f9e..6f777aec89 100644 --- a/package.json +++ b/package.json @@ -91,8 +91,7 @@ "tar": "^6.2.1", "uuid": "^10.0.0", "xml-js": "^1.6.11", - "yargs": "^17.7.2", - "validate-iri": "^1.0.1" + "yargs": "^17.7.2" }, "optionalDependencies": { "@appthreat/atom": "2.0.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da251b61d7..82587d3ea2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,9 +80,6 @@ importers: uuid: specifier: ^10.0.0 version: 10.0.0 - validate-iri: - specifier: ^1.0.1 - version: 1.0.1 xml-js: specifier: ^1.6.11 version: 1.6.11 @@ -2648,9 +2645,6 @@ packages: resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'} - validate-iri@1.0.1: - resolution: {integrity: sha512-gLXi7351CoyVVQw8XE5sgpYawRKatxE7kj/xmCxXOZS1kMdtcqC0ILIqLuVEVnAUQSL/evOGG3eQ+8VgbdnstA==} - validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -5820,8 +5814,6 @@ snapshots: '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 - validate-iri@1.0.1: {} - validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 diff --git a/types/utils.d.ts.map b/types/utils.d.ts.map index 76044d08c2..9788366509 100644 --- a/types/utils.d.ts.map +++ b/types/utils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAsSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AA2BD;;;;;GAKG;AACH,wCAHW,MAAM,oBACN,MAAM;;;;;;;;;GA0ZhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,MAAM,kBAgFhB;AAED;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;IAqDC;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,OAgJhB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,qBACN,MAAM,oBACN,MAAM,uBACN,MAAM;;;;;;;;;;;;;;;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E"} \ No newline at end of file +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAqSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AA2BD;;;;;GAKG;AACH,wCAHW,MAAM,oBACN,MAAM;;;;;;;;;GA0ZhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,MAAM,kBAgFhB;AAED;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;IAqDC;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,OAgJhB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,qBACN,MAAM,oBACN,MAAM,uBACN,MAAM;;;;;;;;;;;;;;;;EAkNhB;AAED;;;GAGG;AACH,uCAFW,MAAM,SAoChB;AAED;;;GAGG;AACH,wCAFW,MAAM,OAahB;AAED,yEAwBC;AAED;;;;GAIG;AACH,+CAFW,MAAM;;;EA6ChB;AAED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sCAmBC;AAED,0DA2EC;AAED;;;;;;;;GAQG;AACH,oCANW,MAAM,YACN,MAAM,gBACN,MAAM,eACN,MAAM,OA6ChB;AAkFD;;;;;;;;;GASG;AACH,2CAPW,MAAM,kBACN,MAAM,eACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiWhB;AAGD;;;;;EAmBC;AAED;;;;;;GAMG;AACH,kEAHW,MAAM,cACN,MAAM,6BA0IhB;AAED,qDASC;AAED;;;;;;;EA2GC;AAED;;;EA6PC;AAED,sEA6BC;AAED;;;;;;;GAOG;AACH,mCALW,MAAM,WACN,MAAM;;;;;;;EAgQhB;AAED;;;;;;GAMG;AACH,2CAHW,MAAM,OAKhB;AAED,qDA0CC;AA8HD;;;;GAIG;AACH;;;GAkHC;AAED,yEA0GC;AAED;;;;;;GAMG;AACH,mDAkBC;AAED;;;;;;;;;;GAUG;AACH,0DAMC;AA95VD,gCAAgF;AAChF,4BAA4C;AAC5C,4BAA6C;AAC7C,2BAAmE;AAsBnE,iCAEE;AAiBF,iCAIyC;AAGzC,gCACmE;AAGnE,gCACsE;AAGtE,8BAA+B;AAK/B,4CAEmE;AAGnE,6CAE6D;AAG7D,oCAEoD;AAGpD,uCAEuD;AAYvD,4BAA6B;AAU7B,8BAAiC;AAMjC,8BAAiC;AAIjC,4BAA6B;AAI7B,2BAA2B;AAI3B,4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,6BAA+B;AAM/B,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DE;AAiEF,8BAQG;AA2xIH,8CAUE"} \ No newline at end of file diff --git a/utils.js b/utils.js index a05e658feb..f55f17b8ae 100644 --- a/utils.js +++ b/utils.js @@ -46,7 +46,6 @@ import { satisfies, valid, } from "semver"; -import { IriValidationStrategy, validateIri } from "validate-iri"; import { xml2js } from "xml-js"; import { getTreeWithPlugin } from "./piptree.js"; @@ -11215,24 +11214,9 @@ export function parseMakeDFile(dfile) { * */ export function isValidIriReference(iri) { - let iriIsValid = true; // See issue #1264 - if (iri && /[${}]/.test(iri)) { + if (iri && /[${}%]/.test(iri)) { return false; } - const validateIriResult = validateIri(iri, IriValidationStrategy.Strict); - - if (validateIriResult instanceof Error) { - iriIsValid = false; - } else if (iri.toLocaleLowerCase().startsWith("http")) { - try { - new URL(iri); - } catch (error) { - iriIsValid = false; - } - } - if (iriIsValid) { - return true; - } - return false; + return URL.canParse(iri); } diff --git a/utils.test.js b/utils.test.js index fd0f2deb84..e3134ece73 100644 --- a/utils.test.js +++ b/utils.test.js @@ -2852,8 +2852,8 @@ test("parsePnpmLock", async () => { expect(parsedList.dependenciesList).toHaveLength(462); expect(parsedList.pkgList.filter((pkg) => !pkg.scope)).toHaveLength(3); parsedList = await parsePnpmLock("./pnpm-lock.yaml"); - expect(parsedList.pkgList.length).toEqual(653); - expect(parsedList.dependenciesList.length).toEqual(653); + expect(parsedList.pkgList.length).toEqual(652); + expect(parsedList.dependenciesList.length).toEqual(652); expect(parsedList.pkgList[0]).toEqual({ group: "@ampproject", name: "remapping", @@ -4294,9 +4294,10 @@ test.each([ ["${repository.url}", false], // bomLink - https://cyclonedx.org/capabilities/bomlink/] ["urn:cdx:f08a6ccd-4dce-4759-bd84-c626675d60a7/1#componentA", true], + ["urn:cdx:f08a6ccd-4dce-4759-bd84-c626675d60a7", true], + ["urn:cdx:f08a6ccd-4dce-4759-bd84-c626675d60a7/123", true], // http uri - https://www.ietf.org/rfc/rfc7230.txt] ["https://gitlab.com/behat-chrome/chrome-mink-driver.git", true], - [" https://gitlab.com/behat-chrome/chrome-mink-driver.git ", false], ["http://gitlab.com/behat-chrome/chrome-mink-driver.git", true], ["git+https://github.com/Alex-D/check-disk-space.git", true], ["UNKNOWN", false], @@ -4308,6 +4309,8 @@ test.each([ ["http://www.", true], ["https://github.com/apache/maven-resolver/tree/${project.scm.tag}", false], ["git@github.com:prometheus/client_java.git", false], + ["${template.url}", false], + ["http://%template%", false], ])("isValidIriReference tests: %s", (url, isValid) => { expect(isValidIriReference(url)).toBe(isValid); }); From 98faafe83d86c1224f5d73cf0fdab2ed7c06cd22 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Tue, 23 Jul 2024 22:19:54 +0100 Subject: [PATCH 2/3] Added more tests from validate-iri repo Signed-off-by: Prabhu Subramanian --- types/utils.d.ts.map | 2 +- utils.js | 10 +++- utils.test.js | 115 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 2 deletions(-) diff --git a/types/utils.d.ts.map b/types/utils.d.ts.map index 9788366509..7ed7e92639 100644 --- a/types/utils.d.ts.map +++ b/types/utils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAqSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM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K/B,4CAEmE;AAGnE,6CAE6D;AAG7D,oCAEoD;AAGpD,uCAEuD;AAYvD,4BAA6B;AAU7B,8BAAiC;AAMjC,8BAAiC;AAIjC,4BAA6B;AAI7B,2BAA2B;AAI3B,4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,6BAA+B;AAM/B,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DE;AAiEF,8BAQG;AA2xIH,8CAUE"} \ No newline at end of file +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAqSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AA2BD;;;;;GAKG;AACH,wCAHW,MAAM,oBACN,MAAM;;;;;;;;;GA0ZhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,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4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,6BAA+B;AAM/B,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DE;AAiEF,8BAQG;AA2xIH,8CAUE"} \ No newline at end of file diff --git a/utils.js b/utils.js index f55f17b8ae..dacf4c94a7 100644 --- a/utils.js +++ b/utils.js @@ -11214,8 +11214,16 @@ export function parseMakeDFile(dfile) { * */ export function isValidIriReference(iri) { + if (!iri) { + return false; + } + try { + iri = decodeURIComponent(iri); + } catch (e) { + // pass + } // See issue #1264 - if (iri && /[${}%]/.test(iri)) { + if (iri && /[${}%]/.test(iri) && !iri.includes("u{")) { return false; } return URL.canParse(iri); diff --git a/utils.test.js b/utils.test.js index e3134ece73..f54a049f74 100644 --- a/utils.test.js +++ b/utils.test.js @@ -4315,6 +4315,121 @@ test.each([ expect(isValidIriReference(url)).toBe(isValid); }); +test.each([ + "file://foo", + "ftp://ftp.is.co.za/rfc/rfc1808.txt", + "http://www.ietf.org/rfc/rfc2396.txt", + "ldap://[2001:db8::7]/c=GB?objectClass?one", + "mailto:John.Doe@example.com", + "news:comp.infosystems.www.servers.unix", + "tel:+1-816-555-1212", + "telnet://192.0.2.16:80/", + "urn:oasis:names:specification:docbook:dtd:xml:4.1.2", + "http://example.com", + "http://example.com/", + "http://example.com/foo", + "http://example.com/foo/bar", + "http://example.com/foo/bar/", + "http://example.com/foo/bar?q=1&r=2", + "http://example.com/foo/bar/?q=1&r=2", + "http://example.com#toto", + "http://example.com/#toto", + "http://example.com/foo#toto", + "http://example.com/foo/bar#toto", + "http://example.com/foo/bar/#toto", + "http://example.com/foo/bar?q=1&r=2#toto", + "http://example.com/foo/bar/?q=1&r=2#toto", + "http://example.com/foo/bar/.././baz", + "http://a.example/AZaz\u{00C0}\u{00D6}\u{00D8}\u{00F6}\u{00F8}\u{02FF}\u{0370}\u{037D}\u{037F}\u{1FFF}", + "http://a.example/\u{200C}\u{200D}\u{2070}\u{218F}\u{2C00}\u{2FEF}\u{3001}\u{D7FF}\u{FA0E}\u{FDCF}", + "http://a.example/\u{FDF0}\u{FFEF}\u{10000}\u{EFFFD}", + "http://a.example/?AZaz\u{E000}\u{F8FF}\u{F0000}\u{FFFFD}\u{100000}\u{10FFFD}\u{00C0}\u{00D6}\u{00D8}", + "http://a.example/\u{00F6}\u{00F8}\u{02FF}\u{0370}\u{037D}\u{037F}\u{1FFF}\u{200C}\u{200D}\u{2070}\u{218F}\u{2C00}", + "http://a.example/\u{2FEF}\u{3001}\u{D7FF}\u{FA0E}\u{FDCF}\u{FDF0}\u{FFEF}\u{10000}\u{EFFFD}", + // From https://sourceforge.net/projects/foursuite/ under Apache License + "file:///foo/bar", + "mailto:user@host?subject=blah", + "dav:", // Empty opaque part / rel-path allowed by RFC 2396bis + "about:", // Empty opaque part / rel-path allowed by RFC 2396bis + // the following test cases are from a Perl script by David A. Wheeler + // at http://www.dwheeler.com/secure-programs/url.pl + "http://www.yahoo.com", + "http://www.yahoo.com/", + "http://1.2.3.4/", + "http://www.yahoo.com/stuff", + "http://www.yahoo.com/stuff/", + "http://www.yahoo.com/hello%20world/", + "http://www.yahoo.com?name=obi", + "http://www.yahoo.com?name=obi+wan&status=jedi", + "http://www.yahoo.com?onery", + "http://www.yahoo.com#bottom", + "http://www.yahoo.com/yelp.html#bottom", + "https://www.yahoo.com/", + "ftp://www.yahoo.com/", + "ftp://www.yahoo.com/hello", + // Wheeler"s script says these are invalid, but they aren"t + "http://www.yahoo.com?name=%00%01", + "http://www.yaho%6f.com", + "http://www.yahoo.com/hello%00world/", + "http://www.yahoo.com/hello+world/", + "http://www.yahoo.com?name=obi&", + "http://www.yahoo.com?name=obi&type=", + "http://www.yahoo.com/yelp.html#", + // The following test cases are from a Haskell program by Graham Klyne + // at http://www.ninebynine.org/Software/HaskellUtils/Network/URITest.hs + "http://example.org/aaa/bbb#ccc", + "mailto:local@domain.org", + "mailto:local@domain.org#frag", + "HTTP://EXAMPLE.ORG/AAA/BBB#CCC", + // -- escapes + "http://example.org/aaa%2fbbb#ccc", + "http://example.org/aaa%2Fbbb#ccc", + "http://example.com/%2F", + "http://example.com/?%2F", + "http://example.com/#?%2F", + "http://example.com/aaa%2Fbbb", + // -- ports + "http://example.org:80/aaa/bbb#ccc", + "http://example.org:/aaa/bbb#ccc", + "http://example.org./aaa/bbb#ccc", + // -- bare authority + "http://example.org", + // -- IPv6 literals (from RFC2732): + "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", + "http://[1080:0:0:0:8:800:200C:417A]/index.html", + "http://[3ffe:2a00:100:7031::1]", + "http://[1080::8:800:200C:417A]/foo", + "http://[::192.9.5.5]/ipng", + "http://[::FFFF:129.144.52.38]:80/index.html", + "http://[2010:836B:4179::836B:4179]", + // -- Random other things that crop up + "http://example/Andrȷ", + "file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/", + // Iprivate characters are allowed in query + "http://a/?\u{E000}", + "http://example.com/?\u{E000}", +])("isValidIriReference tests2: %s", (url) => { + expect(isValidIriReference(url)).toBeTruthy(); +}); + +test.each([ + // + // the following test cases are from a Haskell program by Graham Klyne + // at http://www.ninebynine.org/Software/HaskellUtils/Network/URITest.hs + // 'http://[2010:836B:4179::836B:4179]', + "http://example.com/%", + "http://example.com/A%Z", + "http://example.com/%ZZ", + "http://example.com/%AZ", + // Bad host + "http://[/", + "http://[::1]a/", + // Fuzzing bugs + "http://͏@[]", +])("isValidIriReference tests3: %s", (url) => { + expect(isValidIriReference(url)).toBeFalsy(); +}); + test("hasAnyProjectType tests", () => { expect( hasAnyProjectType(["docker"], { From 6ba4ea1aeac54cd11283192c58376cd12397af64 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Wed, 24 Jul 2024 10:18:42 +0100 Subject: [PATCH 3/3] Added more tests from validate-iri repo Signed-off-by: Prabhu Subramanian --- types/utils.d.ts.map | 2 +- utils.js | 23 ++++++++++++++++++++++- utils.test.js | 23 ++++++++++++++++++++--- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/types/utils.d.ts.map b/types/utils.d.ts.map index 7ed7e92639..eb66aaa7e5 100644 --- a/types/utils.d.ts.map +++ b/types/utils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAqSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AA2BD;;;;;GAKG;AACH,wCAHW,MAAM,oBACN,MAAM;;;;;;;;;GA0ZhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,MAAM,kBAgFhB;AAED;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;IAqDC;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,OAgJhB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,qBACN,MAAM,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;;;;;EA+DE;AAiEF,8BAQG;AA2xIH,8CAUE"} \ No newline at end of file +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AAqSA;;;;;;GAMG;AACH,mGAkDC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBAkFjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAqVhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MAwDhB;AAwBD;;;;GAIG;AACH,4CAFW,MAAM;;;GAqNhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AA2BD;;;;;GAKG;AACH,wCAHW,MAAM,oBACN,MAAM;;;;;;;;;GA0ZhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,MAAM,kBAgFhB;AAED;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;IAqDC;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,OAgJhB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,qBACN,MAAM,oBACN,MAAM,uBACN,MAAM;;;;;;;;;;;;;;;;EAkNhB;AAED;;;GAGG;AACH,uCAFW,MAAM,SAoChB;AAED;;;GAGG;AACH,wCAFW,MAAM,OAahB;AAED,yEAwBC;AAED;;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AAM,YACN,MAAM,UAsEhB;AAED;;GAEG;AACH,sCAmBC;AAED,0DA2EC;AAED;;;;;;;;GAQG;AACH,oCANW,MAAM,YACN,MAAM,gBACN,MAAM,eACN,MAAM,OA6ChB;AAkFD;;;;;;;;;GASG;AACH,2CAPW,MAAM,kBACN,MAAM,eACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiWhB;AAGD;;;;;EAmBC;AAED;;;;;;GAMG;AACH,kEAHW,MAAM,cACN,MAAM,6BA0IhB;AAED,qDASC;AAED;;;;;;;EA2GC;AAED;;;EA6PC;AAED,sEA6BC;AAED;;;;;;;GAOG;AACH,mCALW,MAAM,WACN,MAAM;;;;;;;EAgQhB;AAED;;;;;;GAMG;AACH,2CAHW,MAAM,OAKhB;AAED,qDA0CC;AA8HD;;;;GAIG;AACH;;;GAkHC;AAED,yEA0GC;AAED;;;;;;GAMG;AACH,mDAkBC;AAED;;;;;;;;;;GAUG;AACH,0DAmCC;AA37VD,gCAAgF;AAChF,4BAA4C;AAC5C,4BAA6C;AAC7C,2BAAmE;AAsBnE,iCAEE;AAiBF,iCAIyC;AAGzC,gCACmE;AAGnE,gCACsE;AAGtE,8BAA+B;AAK/B,4CAEmE;AAGnE,6CAE6D;AAG7D,oCAEoD;AAGpD,uCAEuD;AAYvD,4BAA6B;AAU7B,8BAAiC;AAMjC,8BAAiC;AAIjC,4BAA6B;AAI7B,2BAA2B;AAI3B,4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,6BAA+B;AAM/B,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DE;AAiEF,8BAQG;AA2xIH,8CAUE"} \ No newline at end of file diff --git a/utils.js b/utils.js index dacf4c94a7..431a6d6ddc 100644 --- a/utils.js +++ b/utils.js @@ -11226,5 +11226,26 @@ export function isValidIriReference(iri) { if (iri && /[${}%]/.test(iri) && !iri.includes("u{")) { return false; } - return URL.canParse(iri); + if (!URL.canParse(iri)) { + return false; + } + try { + const urlObj = URL.parse(iri); + if (urlObj?.hash.includes("%")) { + return false; + } + if (urlObj?.pathname.includes("[") || urlObj?.hash.includes("[")) { + return false; + } + if ( + urlObj?.pathname.startsWith("/%F") || + (urlObj?.pathname.includes("%EE") && + decodeURI(urlObj?.pathname) !== urlObj.pathname) + ) { + return false; + } + } catch (e) { + return false; + } + return true; } diff --git a/utils.test.js b/utils.test.js index f54a049f74..e17a31fd4a 100644 --- a/utils.test.js +++ b/utils.test.js @@ -4316,6 +4316,7 @@ test.each([ }); test.each([ + // Tests from https://github.com/comunica/validate-iri.js/blob/master/test/Validate-test.ts "file://foo", "ftp://ftp.is.co.za/rfc/rfc1808.txt", "http://www.ietf.org/rfc/rfc2396.txt", @@ -4413,14 +4414,30 @@ test.each([ }); test.each([ + // Tests from https://github.com/comunica/validate-iri.js/blob/master/test/Validate-test.ts + // "::", // not OK, per Roy Fielding on the W3C uri list on 2004-04-01 + // + // the following test cases are from a Perl script by David A. Wheeler + // at http://www.dwheeler.com/secure-programs/url.pl + "http://www yahoo.com", + 'http://www.yahoo.com/yelp.html#"', // // the following test cases are from a Haskell program by Graham Klyne // at http://www.ninebynine.org/Software/HaskellUtils/Network/URITest.hs // 'http://[2010:836B:4179::836B:4179]', "http://example.com/%", - "http://example.com/A%Z", - "http://example.com/%ZZ", - "http://example.com/%AZ", + "http://[xyz]/", + "http://]/", + "http://example.org/[2010:836B:4179::836B:4179]", + "http://example.org/abc#[2010:836B:4179::836B:4179]", + "http://example.org/xxx/[qwerty]#a[b]", + // From a post to the W3C uri list on 2004-02-17 + // 'http://w3c.org:80path1/path2', + // Iprivate characters are not allowed in path not in fragment + "http://example.com/\u{E000}", + "http://example.com/\u{E000}", + "http://example.com/#\u{E000}", + "http://example.com/#\u{E000}", // Bad host "http://[/", "http://[::1]a/",