Skip to content

fix(management): guard against IndexOutOfRangeException in HandleRemove for K8SNS/K8SCluster alias parsing#77

Open
spbsoluble wants to merge 8 commits intorelease-1.2from
hotfix/1.2.3
Open

fix(management): guard against IndexOutOfRangeException in HandleRemove for K8SNS/K8SCluster alias parsing#77
spbsoluble wants to merge 8 commits intorelease-1.2from
hotfix/1.2.3

Conversation

@spbsoluble
Copy link
Copy Markdown
Contributor

@spbsoluble spbsoluble commented Mar 27, 2026

Summary

  • Root cause: HandleRemove accessed splitAlias[^2] without a bounds check for both K8SNS and K8SCluster store types. A bare alias without the expected / delimiter produces a single-element array, causing Index was outside the bounds of the array.
  • Added Length < 2 guard for K8SNS before splitAlias[^2]/splitAlias[^1]
  • Added Length < 3 guard for K8SCluster before splitAlias[^2]/splitAlias[^1]/splitAlias[0]

Note: the equivalent bug in HandleCreateOrUpdate (namespace case) was already fixed in 1.2.2. This PR covers only the remaining HandleRemove gap.

Test plan

  • Management Remove from K8SNS store with a correctly formatted alias (secrets/opaque/secret-name) succeeds
  • Management Remove from K8SNS store with a bare alias returns a clear failure message instead of throwing
  • Management Remove from K8SCluster store with a bare alias returns a clear failure message instead of throwing

spbsoluble and others added 8 commits March 26, 2026 17:16
…ve for K8SNS/K8SCluster alias parsing

HandleRemove accessed splitAlias[^2] without a bounds check for both K8SNS and
K8SCluster store types. A bare alias without the expected '/' delimiter produced
a single-element array, causing 'Index was outside the bounds of the array'.

Added Length < 2 guard for K8SNS and Length < 3 guard for K8SCluster; returns
a clear FailJob with an actionable error message describing the expected alias format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant