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

feat(frontend): Upstream and Downstream hierarchy display on frontend #3208

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jess-lowe
Copy link
Contributor

@jess-lowe jess-lowe commented Mar 4, 2025

Added the logic to display the hierarchy of the upstream and downstream vuln entries.

Example of top, middle, and bottom levels of vulns:

image

image

image

@jess-lowe jess-lowe changed the title feature(frontend): Upstream and Downstream hierarchy display on frontend feat(frontend): Upstream and Downstream hierarchy display on frontend Mar 4, 2025
@@ -302,9 +303,25 @@ def bug_to_response(bug, detailed=True):
if detailed:
add_links(response)
add_source_info(bug, response)
add_stream_info(bug, response)
Copy link
Contributor

Choose a reason for hiding this comment

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

how long does this take, relative to the other add info functions?

for child in graph[vuln_id]:
if child != target_bug_id:
output_lines.append("<ul>")
print_subtree(child)
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this handle cycles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added a change that will prevent the cycle from displaying, and will log an error, but won't prevent the whole vuln from being displayed.

"""Add upstream hierarchy information to `response`."""
# Check whether there are upstreams
if bug.upstream_raw:
upstream_hierarchy_string = get_upstreams_of_vulnerability(bug.db_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can use response['upstream'], which already contains upstream information from the upstream_group. Passing response['upstream'] into the function can save a query.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, response['upstream'] doesn't exist. and bug only has bug.upstream_raw, which we can't rely on to be the full set of transitive upstreams to feed to the hierarchy string generator.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah bug itself doesn't contain the final upstream, but vulnerability does. The response here is converted from vulnerability. We did queries for upstream and aliases inside the to_vulnerability() function.

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.

4 participants