[GH-ISSUE #162] Audit: Fix nil pointer dereference risk in shared.go #43

Closed
opened 2026-02-26 21:32:58 +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/162

Description

cmd/shared.go:174-178 has a potential nil pointer dereference:

cfg, err := config.Load()
if err != nil {
    return ""
}
return strings.TrimSpace(cfg.AppID)

If config.Load() returns nil, nil (when config file doesn't exist), the subsequent access to cfg.AppID will panic.

Impact

  • Runtime panic when config file doesn't exist
  • User-facing crash instead of graceful handling

Location

cmd/shared.go:174-178

Fix

Add explicit nil check for cfg:

cfg, err := config.Load()
if err != nil {
    return ""
}
if cfg == nil {
    return ""
}
return strings.TrimSpace(cfg.AppID)

Severity

High

Originally created by @rudrankriyam on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/162 ## Description `cmd/shared.go:174-178` has a potential nil pointer dereference: ```go cfg, err := config.Load() if err != nil { return "" } return strings.TrimSpace(cfg.AppID) ``` If `config.Load()` returns `nil, nil` (when config file doesn't exist), the subsequent access to `cfg.AppID` will panic. ## Impact - Runtime panic when config file doesn't exist - User-facing crash instead of graceful handling ## Location `cmd/shared.go:174-178` ## Fix Add explicit nil check for `cfg`: ```go cfg, err := config.Load() if err != nil { return "" } if cfg == nil { return "" } return strings.TrimSpace(cfg.AppID) ``` ## Severity High
kerem closed this issue 2026-02-26 21:32:58 +03:00
Author
Owner

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

Closed via #170.

<!-- gh-comment-id:3797232752 --> @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#43
No description provided.