Skip to content

Commit 4bf846d

Browse files
authored
fix: recursive error causing the security page to crash (#732)
Signed-off-by: Efren Lim <[email protected]>
1 parent 6f091f2 commit 4bf846d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

frontend/app/components/modules/project/views/security.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,15 @@ const groupedData = computed(() => (securityAssessmentData.value || []).reduce((
220220
if (!obj[check.category]) {
221221
obj[check.category] = [];
222222
}
223-
check.assessments = PROJECT_SECURITY_SERVICE.orderAssessmentsByRequirementId(
223+
const tmpAssessments = PROJECT_SECURITY_SERVICE.orderAssessmentsByRequirementId(
224224
PROJECT_SECURITY_SERVICE.mergeDuplicateAssessments(check.assessments)
225225
);
226-
obj[check.category]?.push(check);
226+
// Create a copy of the check object to avoid mutating the original
227+
const checkCopy = {
228+
...check,
229+
assessments: tmpAssessments
230+
};
231+
obj[check.category]?.push(checkCopy);
227232
return obj;
228233
}, {} as Record<string, SecurityData[]>))
229234
@@ -232,10 +237,15 @@ const groupChecksByRepository = (checks: SecurityData[]) => (checks || []).reduc
232237
if (!obj[check.repo]) {
233238
obj[check.repo] = [];
234239
}
235-
check.assessments = PROJECT_SECURITY_SERVICE.orderAssessmentsByRequirementId(
240+
const tmpAssessments = PROJECT_SECURITY_SERVICE.orderAssessmentsByRequirementId(
236241
PROJECT_SECURITY_SERVICE.mergeDuplicateAssessments(check.assessments)
237242
);
238-
obj[check.repo]?.push(check);
243+
// Create a copy of the check object to avoid mutating the original
244+
const checkCopy = {
245+
...check,
246+
assessments: tmpAssessments
247+
};
248+
obj[check.repo]?.push(checkCopy);
239249
return obj;
240250
}, {} as Record<string, SecurityData[]>)
241251

0 commit comments

Comments
 (0)