Skip to content

Remove v1 code - #2469

Open
TG1999 wants to merge 8 commits into
mainfrom
remove_v1_code
Open

TG1999 wants to merge 8 commits into
mainfrom
remove_v1_code

Conversation

@TG1999

@TG1999 TG1999 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

This PR removes vulnerability model and related importers/improvers completely from VCIO codebase.

TG1999 and others added 7 commits October 12, 2026 13:58
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
@TG1999

TG1999 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

#2469 PR is in progress here

@keshav-space keshav-space left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @TG1999, see few nits below.

Comment on lines +62 to +64
# Skip test double pipelines defined under vulnerabilities.tests
if ".tests." in obj.__module__ or obj.__module__.startswith("vulnerabilities.tests"):
continue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not needed we only import modules inside vulnerabilities.pipelines

Suggested change
# Skip test double pipelines defined under vulnerabilities.tests
if ".tests." in obj.__module__ or obj.__module__.startswith("vulnerabilities.tests"):
continue


<link rel="stylesheet" href="{% static 'css/bulma.css' %}" />
<link rel="stylesheet" href="{% static 'css/custom.css' %}" />
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v=tabs3" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@TG1999 Why do we need this change?

Comment on lines +26 to +39
<script>
function goToTab(tabName) {
var tabs = document.getElementById('tabs');
if (!tabs) return false;
var targetLink = tabs.querySelector('[data-tab="' + tabName + '"]');
var targetContent = document.querySelector('#tab-content > .tab-div[data-content="' + tabName + '"]');
if (!targetLink || !targetContent) return false;
tabs.querySelectorAll('li.is-active').forEach(function (el) { el.classList.remove('is-active'); });
document.querySelectorAll('#tab-content > .tab-div.is-active').forEach(function (el) { el.classList.remove('is-active'); });
targetLink.classList.add('is-active');
targetContent.classList.add('is-active');
return false;
}
</script>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to move script to the middle? It should be at the bottom of template, inside {% block scripts %}. Moreover we should not duplicate this script, we should instead reuse <script src="{% static 'js/main.js' %}"></script>

Comment on lines +193 to +277
def compute_vulnerability_risk_factors(references, severities, exploits):
"""
Risk may be expressed as a number ranging from 0 to 10.
Risk is calculated from weighted severity and exploitability values.
It is the maximum value of (the weighted severity multiplied by its exploitability) or 10

Risk = min(weighted severity * exploitability, 10)
"""
weighted_severity = get_weighted_severity(severities)
exploitability = get_exploitability_level(exploits, references, severities)
return weighted_severity, exploitability


def get_weighted_severity(severities):
"""
Weighted Severity is the maximum value obtained when each Severity is multiplied
by its associated Weight/10.
Example of Weighted Severity: max(7*(10/10), 8*(3/10), 6*(8/10)) = 7
"""
if not severities:
return 0

score_map = {
"low": 3,
"moderate": 6.9,
"medium": 6.9,
"high": 8.9,
"important": 8.9,
"critical": 10.0,
"urgent": 10.0,
}

score_list = []
for severity in severities:
if not severity.url:
continue
parsed_url = urlparse(severity.url)
severity_source = parsed_url.netloc.replace("www.", "", 1)
weight = WEIGHT_CONFIG.get(severity_source, DEFAULT_WEIGHT)
max_weight = float(weight) / 10
vul_score = severity.value
if not vul_score:
continue
try:
vul_score = float(vul_score)
vul_score_value = vul_score * max_weight
except ValueError:
vul_score = vul_score.lower()
vul_score_value = score_map.get(vul_score, 0) * max_weight

score_list.append(vul_score_value)

max_score = max(score_list) if score_list else 0
return round(max_score, 1)


def get_exploitability_level(exploits, references, severities):
"""
Exploitability refers to the potential or
probability of a software package vulnerability being exploited by
malicious actors to compromise systems, applications, or networks.
It is determined automatically by discovery of exploits.
"""
# no exploit known ( default .5)
exploit_level = 0.5

if exploits:
# Automatable Exploit with PoC script published OR known exploits (KEV) in the wild OR known ransomware
exploit_level = 2

elif severities:
# high EPSS.
for severity in severities:
if severity.scoring_system == EPSS.identifier and float(severity.value) > 0.8:
exploit_level = 2
break

elif references:
# PoC/Exploit script published
for reference in references:
if reference.reference_type == AdvisoryReference.EXPLOIT:
exploit_level = 1
break

return exploit_level

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These pipeline-specific utilities should be in vulnerabilities/pipes/risk_score.py.

Comment on lines +89 to +91
from vulnerabilities.pipelines.v2_improvers.compute_package_risk import (
compute_vulnerability_risk_factors,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

compute_vulnerability_risk_factors should reside in this module.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants