Skip to content

Commit

Permalink
added vulnerable api finding cvss metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
future-pirate-king committed Sep 27, 2024
1 parent 6c593a5 commit f8b562b
Show file tree
Hide file tree
Showing 20 changed files with 946 additions and 506 deletions.
8 changes: 5 additions & 3 deletions app/components/file-compare/analysis-details/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@
{{finding.title}}
</AkTypography>

<span class='scrollable-box'>
<pre class='pre-code'>{{finding.description}}</pre>
</span>
<div local-class='vulnerability-finding-container'>
<pre local-class='vulnerability-finding-description'>
{{finding.description}}
</pre>
</div>
{{/each}}
{{/if}}
</AkStack>
Expand Down
30 changes: 24 additions & 6 deletions app/components/file-compare/analysis-details/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
--file-compare-analysis-details-marked-passed-bg-color
);

:global(.scrollable-box),
:global(.scrollable-box) pre {
.vulnerability-finding-container {
background-color: var(
--file-compare-analysis-details-marked-passed-vuln-finding-bg-color
);
border: 1px solid var(--file-compare-analysis-details-border-color);
}
}

Expand All @@ -22,10 +22,6 @@
flex-direction: column;
gap: 0.75em;

code {
@extend .scrollable-box;
}

h1 {
font-size: 1.75rem;
margin: 0.4em 0 !important;
Expand Down Expand Up @@ -64,4 +60,26 @@
.analysis-content-value {
width: calc(100% - 185px);
}

.vulnerability-finding-container {
width: 100%;
max-width: 600px;
max-height: 300px;
overflow: auto;
text-overflow: clip;
margin: 1em 0;
background-color: var(
--file-compare-analysis-details-findings-code-background-color
);
border-radius: var(--file-compare-analysis-details-findings-border-radius);

.vulnerability-finding-description {
background-color: unset;
color: var(--file-compare-analysis-details-findings-color-primary);
white-space: pre-line;
width: max-content;
line-height: normal;
padding: 0.75em;
}
}
}
2 changes: 1 addition & 1 deletion app/components/file-compare/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.file-compare-tabs {
position: sticky;
margin-top: 1.4286em;
top: calc(200px - 0.5em);
top: calc(198px - 0.5em);
z-index: 10;
background: var(--file-compare-tabs-background-color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--file-compare-vulnerability-details-header-wrapper-background-color
);
position: sticky;
top: calc(200px - 0.5em);
top: calc(198px - 0.5em);
z-index: 1;

.file-compare-vulnerability-details-header {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

.vulnerability-finding-container {
width: 100%;
margin: 1em 0;
background-color: var(
--file-details-vulnerability-analysis-details-findings-code-box-code-background-color
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ export default class FileDetailsVulnerabilityAnalysisDetailsFindingsCodeBoxCompo
declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'FileDetails::VulnerabilityAnalysisDetails::Findings::CodeBox': typeof FileDetailsVulnerabilityAnalysisDetailsFindingsCodeBoxComponent;
'file-details/vulnerability-analysis-details/findings/code-box': typeof FileDetailsVulnerabilityAnalysisDetailsFindingsCodeBoxComponent;
}
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
<div
local-class='analysis-section {{if
@analysis.isOverriddenAsPassed
"analysis-overridded-passed"
@analysis.isOverriddenAsPassed
"analysis-overridded-passed"
}}'
class='mb-2'
data-test-analysisDetails-vulnerabilityContainer
>
<AkStack local-class='analysis-content-title'>
<AkTypography
data-test-analysisDetails-vulnerabilityTitle
@variant='subtitle1'
@gutterBottom={{true}}
>
{{#if
(and @analysis.isRiskPassedBySystem (gt @analysis.findings.length 0))
}}
{{t 'evidences'}}
{{else}}
{{t 'vulnerability'}}
{{/if}}
</AkTypography>
</AkStack>
<AkStack local-class='analysis-content-title'>
<AkTypography
data-test-analysisDetails-vulnerabilityTitle
@variant='subtitle1'
>
{{#if
(and @analysis.isRiskPassedBySystem (gt @analysis.findings.length 0))
}}
{{t 'evidences'}}
{{else}}
{{t 'vulnerability'}}
{{/if}}
</AkTypography>
</AkStack>

<div class='p-3'>
{{#each @customVulnerableFindings as |finding idx|}}
{{#if finding.title}}
<AkTypography
data-test-analysisDetails-vulFindingTitle='{{idx}}'
local-class='analysis-content-value'
>
{{finding.title}}
</AkTypography>
{{/if}}
<div local-class='analysis-content-container' class='p-3'>
{{#each @customVulnerableFindings as |finding idx|}}
{{#if finding.title}}
<AkTypography
data-test-analysisDetails-vulFindingTitle='{{idx}}'
local-class='analysis-content-value'
>
{{finding.title}}
</AkTypography>
{{/if}}

<div local-class='vulnerability-finding-container'>
<pre
data-test-analysisDetails-vulFindingDescription='{{idx}}'
local-class='vulnerability-finding-description'
>
{{finding.description}}
</pre>
</div>
{{/each}}
</div>
<div local-class='vulnerability-finding-container'>
<pre
data-test-analysisDetails-vulFindingDescription='{{idx}}'
local-class='vulnerability-finding-description'
>
{{finding.description}}
</pre>
</div>
{{/each}}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,47 +1,84 @@
.analysis-section {
width: 100%;
background-color: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-background-main);
border: 1px solid var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color);

&.analysis-overridded-passed {
background-color: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-marked-passed-background-color);

.analysis-static-content pre code,
.vulnerability-finding-container {
background-color: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-marked-passed-code-background-color);
border: 1px solid var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color);
}
}
width: 100%;
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-background-main
);

&.analysis-overridded-passed {
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-marked-passed-background-color
);

.analysis-content-title {
padding: 0.75em 1.5em;
border-bottom: 1px solid var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color);
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-marked-passed-background-color
);
}

h6 {
margin-bottom: 0 !important;
}
.analysis-static-content pre code,
.vulnerability-finding-container {
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-marked-passed-code-background-color
);
border: 1px solid
var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color
);
}
}

.analysis-content-title {
position: sticky;
top: calc(172px + 1.5em);
z-index: 1;
padding: 1em;
border: 1px solid
var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color
);
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-background-main
);

.analysis-content-value {
max-width: 460px;
h6 {
margin-bottom: 0 !important;
}
}

.vulnerability-finding-container {
max-width: 600px;
max-height: 300px;
overflow: auto;
text-overflow: clip;
margin: 1em 0;
background-color: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-code-background-color);
border-radius: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-radius);

.vulnerability-finding-description {
background-color: unset;
color: var(--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-color-primary);
white-space: pre-line;
width: max-content;
line-height: normal;
padding: 0.75em;
}
.analysis-content-container {
border-width: 0 1px 1px;
border-style: solid;
border-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-color
);
}

.analysis-content-value {
max-width: 460px;
}

.vulnerability-finding-container {
max-width: 600px;
max-height: 300px;
overflow: auto;
text-overflow: clip;
margin: 1em 0;
background-color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-code-background-color
);
border-radius: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-border-radius
);

.vulnerability-finding-description {
background-color: unset;
color: var(
--file-details-vulnerability-analysis-details-findings-custom-vulnerabilities-color-primary
);
white-space: pre-line;
width: max-content;
line-height: normal;
padding: 0.75em;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
</AkStack>

<FileDetails::VulnerabilityAnalysisDetails::Findings::VulnerableApi
local-class='analysis-content-container'
@currentVulnerability={{get pgc.currentPageResults 0}}
@analysis={{this.analysis}}
/>
Expand Down
Loading

0 comments on commit f8b562b

Please sign in to comment.