-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanitize externalReferences URLs and exclude invalid ones + Strict JSON Schema validation #1130
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ | |
"@npmcli/arborist": "7.5.2", | ||
"ajv": "^8.14.0", | ||
"ajv-formats": "^3.0.1", | ||
"ajv-formats-draft2019": "^1.6.1", | ||
"cheerio": "^1.0.0-rc.12", | ||
"edn-data": "1.1.1", | ||
"find-up": "7.0.0", | ||
|
@@ -90,7 +91,8 @@ | |
"tar": "^6.2.1", | ||
"uuid": "^9.0.1", | ||
"xml-js": "^1.6.11", | ||
"yargs": "^17.7.2" | ||
"yargs": "^17.7.2", | ||
"hosted-git-info": "^7.0.2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not introduce this package and change the url format in this PR. We can drop any non-compliant urls, maybe with a log in DEBUG_MODE. |
||
}, | ||
"optionalDependencies": { | ||
"@appthreat/atom": "2.0.12", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1119,6 +1119,37 @@ export function addEvidenceForDotnet(pkgList: any, slicesFile: any): any; | |
* @returns {Object} pkgFilesMap Object with package name and list of files | ||
*/ | ||
export function parseMakeDFile(dfile: string): any; | ||
/** | ||
* Function to validate an externalReference URL for conforming to the JSON schema or bomLink | ||
* https://github.com/CycloneDX/cyclonedx-core-java/blob/75575318b268dda9e2a290761d7db11b4f414255/src/main/resources/bom-1.5.schema.json#L1140 | ||
* https://datatracker.ietf.org/doc/html/rfc3987#section-2.2 | ||
* https://cyclonedx.org/capabilities/bomlink/ | ||
* | ||
* @param {String} url URL to validate | ||
* | ||
* @returns {Boolean} Flag indicating whether the supplied URL is valid or not | ||
* | ||
*/ | ||
export function isValidIriReference(url: string): boolean; | ||
/** | ||
* Function to convert a Git repository URL to its HTTP URL counterpart | ||
* Example: [email protected]:npm/hosted-git-info.git converts to https://github.com/npm/hosted-git-info.git | ||
* | ||
* @param {String} url URL to convert | ||
* | ||
* @returns {String} Converted URL, or original URL if conversion was not possible | ||
* | ||
*/ | ||
export function convertGitRepoUrlToHttpUrl(url: string): string; | ||
/** | ||
* Function that sanitizes an URL to try to make it conform to IRI RFC 3987. | ||
* | ||
* @param {String} url URL to sanitize | ||
* | ||
* @returns {String} Sanitized URL | ||
* | ||
*/ | ||
export function sanitizeUrlAsIri(url: string): string; | ||
export const dirNameStr: string; | ||
export const isWin: boolean; | ||
export const isMac: boolean; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am having better success with validate-iri package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for some validation library but didn't find this one 👍