Skip to content

Commit 4e0df6d

Browse files
authored
Merge pull request #6597 from devtron-labs/panic-rbac-objects
fix: add safety checks to prevent index-out-of-range panics in CdHandler
2 parents 4648291 + f31504a commit 4e0df6d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/pipeline/CdHandler.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,13 @@ func (impl *CdHandlerImpl) FetchAppWorkflowStatusForTriggerViewForEnvironment(re
735735
// filter out pipelines for unauthorized apps but not envs
736736
appResults, _ := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
737737
for _, pipeline := range pipelines {
738-
appObject := objects[pipeline.Id][0]
738+
// Safety check to prevent index-out-of-range panic
739+
objectArr, ok := objects[pipeline.Id]
740+
if !ok {
741+
impl.Logger.Warnw("skipping pipeline with missing object data", "pipelineId", pipeline.Id)
742+
continue
743+
}
744+
appObject := objectArr[0]
739745
if !(appResults[appObject]) {
740746
// if user unauthorized, skip items
741747
continue

0 commit comments

Comments
 (0)