[GH-ISSUE #164] Audit: Safe type assertions in client_pagination.go #47

Closed
opened 2026-02-26 21:32:59 +03:00 by kerem · 1 comment
Owner

Originally created by @rudrankriyam on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/164

Description

internal/asc/client_pagination.go:99-141 has unsafe type assertions that will panic at runtime if result is not of the expected type:

case *FeedbackResponse:
    result.(*FeedbackResponse).Data = append(result.(*FeedbackResponse).Data, p.Data...)

This is a risk if a new response type is added but the pagination switch statement isn't updated.

Impact

  • Runtime panic if pagination encounters unexpected type
  • Silent bug risk when adding new response types

Location

internal/asc/client_pagination.go:99-141

Fix

Use safe type assertion with comma-ok idiom:

if typedResult, ok := result.(*FeedbackResponse); ok {
    typedResult.Data = append(typedResult.Data, p.Data...)
}

Or add a default case that returns an error.

Severity

Critical

Originally created by @rudrankriyam on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/164 ## Description `internal/asc/client_pagination.go:99-141` has unsafe type assertions that will panic at runtime if `result` is not of the expected type: ```go case *FeedbackResponse: result.(*FeedbackResponse).Data = append(result.(*FeedbackResponse).Data, p.Data...) ``` This is a risk if a new response type is added but the pagination switch statement isn't updated. ## Impact - Runtime panic if pagination encounters unexpected type - Silent bug risk when adding new response types ## Location `internal/asc/client_pagination.go:99-141` ## Fix Use safe type assertion with comma-ok idiom: ```go if typedResult, ok := result.(*FeedbackResponse); ok { typedResult.Data = append(typedResult.Data, p.Data...) } ``` Or add a default case that returns an error. ## Severity Critical
kerem closed this issue 2026-02-26 21:32:59 +03:00
Author
Owner

@rudrankriyam commented on GitHub (Jan 25, 2026):

Closed via #170.

<!-- gh-comment-id:3797232876 --> @rudrankriyam commented on GitHub (Jan 25, 2026): Closed via #170.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#47
No description provided.