Skip to content
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

Generalize rescoring rule model #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

TuanAnh17N
Copy link
Collaborator

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:


@TuanAnh17N TuanAnh17N requested a review from a team as a code owner November 8, 2024 09:39
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/ok-to-test and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 8, 2024
rescore/model.py Outdated Show resolved Hide resolved
rescore/artefacts.py Outdated Show resolved Hide resolved
config.py Show resolved Hide resolved
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 8, 2024
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 8, 2024
@zkdev zkdev self-requested a review November 11, 2024 08:24
rescore/model.py Show resolved Hide resolved
rescore/model.py Outdated Show resolved Hide resolved
rescore/model.py Outdated Show resolved Hide resolved
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 11, 2024
@ocm-ci-robot-0 ocm-ci-robot-0 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 11, 2024
@ocm-ci-robot-0 ocm-ci-robot-0 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 11, 2024
Copy link
Collaborator

@ccwienk ccwienk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you elaborate on the highlevel organisation of rulesets you suggest?

before this change, there was a global (cve-)rulesets, which was a list of (cve-)rescoring-rules.

or. yaml-ishly speaking:

rulesets: # each entry implicitly being a set of cve-rescoring-rulesets
 - name: my-rescoring-rules
   rules: # list of rules

In that example, the topmost attribute (rulesets) might be described /w a typehint list[CVE_RescoringRuleset, ...] whereas each CVE_RescoringRuleset would have a list (stored in rules) of CVE_RescoringRule

--

After the ongoing generalisation, I think we should have something like:

rulesets:
- name: my-cve-ruleset
  type: cve-rescoring
  rules: # cve-rescoring-rules
- name: my-sast-ruleset
  type: sast-rescoring
  rules: # sast-rescoring-rules

Thus, it will make sense to have a (generic, ideally w/ type-params) base-class for rulesets, and rulesettype-specific rules, like so (pseudo-pseudo-code - I might have gotten type-parameters wrong syntactically):

class Rule:
  name: str # probably, each rule should have a name

class RuleSet[T: Rule]:
  rules: list[T]

class CveRescoringRule(Rule):
   pass #...

class SastRescoringRule(Rule):
  pass # ...

class CveRescoringRuleset(Ruleset[CveRescoringRule]):
  pass

app.py Outdated Show resolved Hide resolved
bdba/scanning.py Outdated Show resolved Hide resolved
rescore/model.py Outdated Show resolved Hide resolved
rescore/model.py Outdated Show resolved Hide resolved
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2024
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2024
rescore/model.py Show resolved Hide resolved
rescore/model.py Show resolved Hide resolved
rescore/model.py Show resolved Hide resolved
rescore/model.py Show resolved Hide resolved
config.py Show resolved Hide resolved
config.py Show resolved Hide resolved
config.py Show resolved Hide resolved
features/__init__.py Show resolved Hide resolved
features/__init__.py Show resolved Hide resolved
features/__init__.py Show resolved Hide resolved
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2024
@ocm-ci-robot-0 ocm-ci-robot-0 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants