diff --git a/gcp/website/frontend3/src/styles.scss b/gcp/website/frontend3/src/styles.scss index f5d8e380c84..5700123eb86 100644 --- a/gcp/website/frontend3/src/styles.scss +++ b/gcp/website/frontend3/src/styles.scss @@ -855,6 +855,7 @@ dl.vulnerability-details, .vulnerability-packages-container { margin-top: 50px; + padding-bottom: 50px; .title { margin-left: 20px; @@ -950,6 +951,153 @@ dl.vulnerability-details, pointer-events: none; } + &.force-collapse { + h2.package-header { + width: 100%; + background: #393939; + color: #fff; + padding: 16px; + margin-bottom: 2px; + border-radius: 0; + font-weight: normal; + transition: background-color 0.2s ease-in-out; + cursor: pointer; + + &::before { + content: ''; + width: 12px; + height: 12px; + margin-right: 8px; + background-image: url(/static/img/filled-triangle.svg); + background-position: center; + background-repeat: no-repeat; + transition: transform 0.2s ease-in-out; + transform: rotate(0deg); + filter: invert(100%); + } + + &[expanded]::before { + transform: rotate(90deg); + } + + &:hover { + background: #4F4F4F; + } + + &[expanded] { + background: #fff; + color: $osv-accent-color; + font-weight: bold; + + &::before { + filter: invert(24%) sepia(89%) saturate(2293%) hue-rotate(345deg) brightness(81%) contrast(107%); + } + + &:hover { + background: #f0f0f0; + } + } + } + +.ecosystem-content-panel { + position: relative; + padding: 8px 0 16px 16px; + + // The vertical "tree" line + &::before { + content: ''; + position: absolute; + left: 8px; + top: 0; + bottom: 0; + width: 1px; + background: #555; + } + } + + .package-accordion { + position: relative; + margin-bottom: 8px; + + // The horizontal "connector" line + &::before { + content: ''; + position: absolute; + left: -8px; + width: 8px; + top: 20px; + height: 1px; + background: #555; + } + } + + .package-accordion h3.package-name-title { + font-family: $osv-heading-font-family; + font-size: 1.1rem; + color: #f1f1f1; + padding: 12px 16px; + cursor: pointer; + background: #333333; + border: 1px solid #444; + border-radius: 0; + + &::before { + content: ''; + width: 12px; + height: 12px; + margin-right: 8px; + background-image: url(/static/img/filled-triangle.svg); + background-position: center; + background-repeat: no-repeat; + filter: invert(100%); + transition: transform 0.2s ease-in-out; + display: inline-block; + vertical-align: middle; + transform: rotate(0deg); + } + + &[expanded] { + border-bottom: 1px dashed #fff; + + &::before { + transform: rotate(90deg); + } + } + } + + .package-accordion .package-details-card { + background: #333333; + border: 1px solid #444; + border-top: none; + border-radius: 0; + + .vulnerability-package-subsection { + padding: 14px 0; + border-bottom: 1px dashed #555; + + &.affected-ranges-subsection { + padding-bottom: 4px; + } + + h3 { + font-size: 16.55px; + } + + dl { + font-size: 15px; + } + + &:last-child { + border-bottom: none; + } + } + + .mdc-layout-grid { + padding: 8px 16px 16px; + } + } + } + &[affordance="collapse"] h2.package-header { .vuln-ecosystem { display: inline; @@ -1863,4 +2011,4 @@ div.highlight { .search-suggestions::-webkit-scrollbar-thumb:hover { background-color: $osv-grey-800; -} \ No newline at end of file +} diff --git a/gcp/website/frontend3/src/templates/vulnerability.html b/gcp/website/frontend3/src/templates/vulnerability.html index a5b102f5665..0f9793586f6 100644 --- a/gcp/website/frontend3/src/templates/vulnerability.html +++ b/gcp/website/frontend3/src/templates/vulnerability.html @@ -173,7 +173,143 @@

-

Affected packages

+

Affected packages

+ + {% if vulnerability.affected|should_collapse %} + {% set ecosystems = vulnerability.affected | group_by_ecosystem %} + + {% for ecosystem_name, packages in ecosystems.items() -%} +

+ {{ ecosystem_name }} +

+
+ {% for affected in packages -%} + +

+ {% if 'package' in affected %}{{ affected.package.name }}{% else %}{{ vulnerability.repo | strip_scheme }}{% endif %} +

+
+
+ {%- if 'package' in affected -%} +
+

Package

+
+
+
Name
+
{{ affected.package.name }}
+ {%- if ecosystem_name | has_link_to_deps_dev -%} +
View open source insights on deps.dev
+ {%- endif -%} + {%- if 'purl' in affected.package -%} +
Purl
+
{{ affected.package.purl }}
+ {%- endif -%} +
+
+
+ {%- endif -%} + {%- if 'severity' in affected -%} +
+

Severity

+
+
    + {% for item in affected.severity -%} +
  • + {% if item | is_cvss %} + {{ item | display_severity_rating }} + {{ item.type }} - {{ item.score }} + + CVSS Calculator + {% else %} + {{ item.type }} - {{ item.score }} + {% endif %} +
  • + {% endfor -%} +
+
+
+ {%- endif -%} +
+

Affected ranges

+
+ {% for range in affected.ranges -%} +
+
Type
+
{{ range.type -}}
+ {%- if range.repo -%} +
Repo
+
{{ range.repo }}
+ {%- endif -%} +
Events
+
+
+ {% for event in range.events -%} +
{{ event | event_type -}}
+
+ {% set link = event | event_link -%} + {% if link -%} + {{ event | event_value -}} + {% elif event | event_type == 'Introduced' and event | event_value == '0' -%} +
{{ event | event_value -}} + {% if range.type == 'GIT' %} + Unknown introduced commit / All previous commits are affected + {% else -%} + Unknown introduced version / All previous versions are affected + {% endif -%} +
+ {% else -%} + {{ event | event_value -}} + {% endif -%} +
+ {% endfor -%} +
+
+ {%- if range.database_specific -%} +
Database specific
+
{{ range.database_specific | display_json }}
+ {%- endif -%} +
+ {% endfor -%} +
+
+ {% if affected.versions -%} +
+

Affected versions

+
+ {% for group, versions in (affected.versions|group_versions(affected.package.ecosystem)).items() -%} + +

{{ group }}

+
+ {% for version in versions -%} +
{{ version }}
+ {% endfor -%} +
+
+ {% endfor -%} +
+
+ {% endif -%} + {% if affected.ecosystem_specific -%} +
+

Ecosystem specific

+
{{ affected.ecosystem_specific | display_json }}
+
+ {% endif -%} + {% if affected.database_specific -%} +
+

Database specific

+
{{ affected.database_specific | display_json }}
+
+ {% endif -%} +
+
+
+ {% endfor -%} +
+ {% endfor -%} +
+ + {% else %} {% for affected in vulnerability.affected -%} @@ -347,7 +483,8 @@

{% endfor -%} - + {% endif %} +