-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
as I was working on #680 multiple functions in pkg/prompt/prompt.go silently ignore API errors using the blank identifier (_). This can cause nil pointer panics when API calls fail.
Affected Functions (10 total)
| Line | Function | Issue |
|---|---|---|
| 51 | GetRegistryNameFromUser() | response, _ := api.ListRegistries() |
| 160 | GetReferenceFromUser() | response, _ := api.ListArtifact(...) |
| 170 | GetUserIdFromUser() | response, _ := api.ListUsers() |
| 180 | GetImmutableTagRule() | response, _ := api.ListImmutable(...) |
| 189 | GetTagFromUser() | response, _ := api.ListTags(...) |
| 208 | GetScannerIdFromUser() | response, _ := api.ListScanners() |
| 279 | GetInstanceFromUser() | response, _ := api.ListInstance() |
| 322 | GetRobotPermissionsFromUser() | response, _ := api.GetPermissions() |
| 336 | GetRobotIDFromUser() | response, _ := api.ListRobot(...) |
| 395 | GetMemberIDFromUser() | response, _ := api.ListMembers(...) |
Impact
If an API call fails, response is nil and accessing response.Payload causes a panic.
Proposed Fix
Follow the pattern used by GetProjectNameFromUser() and GetWebhookFromUser() which properly return errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels