-
-
Notifications
You must be signed in to change notification settings - Fork 13
bom.vulnerabilities
model
#163
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
Conversation
Signed-off-by: Peter Wagner <[email protected]>
Thank you for this feature, @thepwagner Review will take a while, did a part of it already. Are you planning on implementing the JSON- and XML normalizer, too? |
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.
partial review.
please find critical remarks with an ❌ .
other remarks are discussion items.
Copyright (c) OWASP Foundation. All Rights Reserved. | ||
*/ | ||
|
||
export enum VulnerabilityAnalysisResponse { |
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.
rename to ImpactAnalysisResponsesType
as the XML schema defines?
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 switched to ImpactAnalysisResponse
as this was the most consistent with the JSON schema, even if the JSON schema doesn't give this enum a standalone definition.
Please advise if you'd prefer a different name.
Signed-off-by: Peter Wagner <[email protected]>
Signed-off-by: Peter Wagner <[email protected]>
Signed-off-by: Peter Wagner <[email protected]>
@jkowalleck thank you for the quick initial feedback!
I was not intending to implement the normalizers. |
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.
please find critical chaneg requests marked with ❌ '
everything else is a discussion item.
everything is just my opinionated view, lets discuss :)
Copyright (c) OWASP Foundation. All Rights Reserved. | ||
*/ | ||
|
||
export enum AffectedStatus { |
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.
👍 lets keep it as enum AffectedStatus
.
alternative enum ImpactAnalysisAffectedStatus
might get in conflict with enum ImpactAnalysisState
which already has a value NotAffected
.
compare (other: SortableSet<T>): number { | ||
const thisSorted = this.sorted() | ||
const otherSorted = other.sorted() | ||
const lenDiff = thisSorted.length - otherSorted.length |
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.
❌ why sort upfront?
Could you add an in-code comment to explain?
return lenDiff | ||
} | ||
|
||
for (let i = 0; i < thisSorted.length; i++) { |
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.
❌ better: for ( const i=0 ; i < thisSorted.length ; ++i ) {}
|
||
/** | ||
* Define the format for acceptable Common Weakness Enumeration (CWE) IDs. | ||
* Refer to {@link https://cwe.mitre.org/index.html} for official specification. |
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.
👍
@@ -27,11 +27,14 @@ module.exports = { | |||
*/ | |||
capitaliseFirstLetter: s => s.charAt(0).toUpperCase() + s.slice(1), | |||
/** | |||
* UpperCamelCase a string |
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 liked the old description better.
I understand the need for more description.
❌ better go with:
UpperCamelCase a string ("white space example", "snake_case_example" or "kebab-case-example" )
❌ when on it, lets replace not only _
but also -
(kebab-case)
} | ||
|
||
export class VulnerabilityCredits implements Comparable { | ||
organizations?: OrganizationalEntityRepository |
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.
❌ repositories must not be optiional, but they may be empty
|
||
export class VulnerabilityCredits implements Comparable { | ||
organizations?: OrganizationalEntityRepository | ||
individuals?: OrganizationalContactRepository |
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.
❌ repositories must not be optiional, but they may be empty
} | ||
|
||
compare (other: VulnerabilityRating): number { | ||
return (this.score ?? 0) - (other.score ?? 0) |
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.
this appears to be like an insufficient comparison.
if this is enough to properly compare, then please add a in-code comment that explains why.
} | ||
|
||
compare (other: VulnerabilityReference): number { | ||
return (this.id ?? '').localeCompare(other.id ?? '') |
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.
❌ unnecessary null-comparisson
import { Comparable, SortableSet } from '../helpers/sortableSet' | ||
|
||
interface OptionalProperties { | ||
url?: URL | string |
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.
❌ use type refenrences ala VulnerabilitySource['url']
The changes remaining on this PR are far removed from my initial use case: as you can tell I'm not a strong TypeScript developer, and all I wanted was the I appreciate the value that your normalization brings, but the added complexity means contributing to this library is outside of my ability. If anyone else wants to pick this up for the basis of the implementation, please do! @jkowalleck thank you for the reviews and sorry I couldn't see this through. |
thank you for all your work, @thepwagner could you open a pull request with your latest things and have it target the "feature/vulnerabilities" branch ? Then, in a later feature, the normalizers and serializers can be developed and be released separately. This way you (and others) will have the models for use soon, |
work continues in #419 |
Add Vulnerabilties to the Bom model, including enums as needed.
The implementation is styled after the existing
Component
implementation and tests.this is part of #164