Skip to content

Commit 960bb6d

Browse files
committed
fix: handle null subCategory in security scanning
1 parent 220a667 commit 960bb6d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Shared/Components/Security/SecurityDetailsCards/SecurityCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const SecurityCard = ({ category, subCategory, severityCount = {}, handleCardCli
5555

5656
return (
5757
<div
58-
className={`w-100 bcn-0 p-20 flexbox-col dc__gap-16 br-8 dc__border security-card security-card${hasThreats ? '--threat' : '--secure'}`}
58+
className={`w-100 p-20 flexbox-col dc__gap-16 br-8 dc__border security-card security-card${hasThreats ? '--threat' : '--secure'}`}
5959
role="button"
6060
tabIndex={0}
6161
onClick={handleCardClick}

src/Shared/Components/Security/SecurityDetailsCards/SecurityDetailsCards.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ const SecurityDetailsCards = ({ scanResult, Sidebar }: SecurityDetailsCardsProps
8282
</div>
8383
<div className="dc__grid security-cards">
8484
{SECURITY_CONFIG[category].subCategories.map((subCategory: ScanSubCategories) => {
85+
// Explicit handling if subcategory is null
86+
if (!scanResult[category][subCategory]) {
87+
return null
88+
}
8589
const severityCount =
8690
subCategory === SUB_CATEGORIES.MISCONFIGURATIONS
8791
? scanResult[category][subCategory]?.misConfSummary?.status

0 commit comments

Comments
 (0)