Skip to content

(bug) Fix panic and missing partial-access fallback on /events endpoints#174

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:gin-crash
Jul 6, 2026
Merged

(bug) Fix panic and missing partial-access fallback on /events endpoints#174
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:gin-crash

Conversation

@gianlucam76

Copy link
Copy Markdown
Member
  • A ClusterRole missing the events permission crashed the server: getEvents/getEvent called c.AbortWithError(401, err) with err already guaranteed nil at that point, which panics inside gin's Context.Error().

  • Unlike other list endpoints (/capiclusters, etc.), /events had no fallback for users who can't list all EventTriggers. It hard-failed instead of degrading to the subset the user can individually get.

  • Two more instances of the same nil-err AbortWithError pattern: getProfile and a debug cluster/profile lookup handler. All fixed the same way.

  • getEventTriggers now takes canListAll/user and filters results down to only EventTriggers the caller can individually access via canGetEventTrigger, mirroring GetManagedCAPIClusters's existing pattern.

  • getEvent (single EventTrigger lookup) now falls back to canGetEventTrigger when the caller can't list all EventTriggers, matching the same fallback already used for ClusterProfile/Profile lookups.

- A ClusterRole missing the `events` permission crashed the server:
`getEvents`/`getEvent` called `c.AbortWithError(401, err)` with `err`
already guaranteed nil at that point, which panics inside gin's
`Context.Error()`.
- Unlike other list endpoints (`/capiclusters`, etc.), `/events` had
no fallback for users who can't list all EventTriggers. It hard-failed
instead of degrading to the subset the user can individually `get`.
- Two more instances of the same nil-`err` `AbortWithError` pattern:
`getProfile` and a debug cluster/profile lookup handler. All fixed the
same way.

- `getEventTriggers` now takes `canListAll`/`user` and filters results down
to only EventTriggers the caller can individually access via `canGetEventTrigger`,
mirroring `GetManagedCAPIClusters`'s existing pattern.
- `getEvent` (single EventTrigger lookup) now falls back to `canGetEventTrigger`
when the caller can't list all EventTriggers, matching the same fallback already
used for ClusterProfile/Profile lookups.
@gianlucam76
gianlucam76 merged commit 17d06ad into projectsveltos:main Jul 6, 2026
3 checks passed
@gianlucam76
gianlucam76 deleted the gin-crash branch July 6, 2026 16:26
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