[GH-ISSUE #165] Audit: Add nil check to IsUnauthorized helper #46

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/165

Description

internal/asc/client_http.go:444-446 can panic if err is nil:

func IsUnauthorized(err error) bool {
    return strings.Contains(err.Error(), "UNAUTHORIZED")
}

Impact

  • Runtime panic on nil error

Location

internal/asc/client_http.go:444-446

Fix

Add nil check:

func IsUnauthorized(err error) bool {
    if err == nil {
        return false
    }
    return strings.Contains(err.Error(), "UNAUTHORIZED")
}

Severity

Medium

Originally created by @rudrankriyam on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/165 ## Description `internal/asc/client_http.go:444-446` can panic if `err` is nil: ```go func IsUnauthorized(err error) bool { return strings.Contains(err.Error(), "UNAUTHORIZED") } ``` ## Impact - Runtime panic on nil error ## Location `internal/asc/client_http.go:444-446` ## Fix Add nil check: ```go func IsUnauthorized(err error) bool { if err == nil { return false } return strings.Contains(err.Error(), "UNAUTHORIZED") } ``` ## Severity Medium
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:3797232943 --> @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#46
No description provided.