Skip to content

Fix runtime bounds error in hideTokens#237

Merged
kordianbruck merged 2 commits into
masterfrom
seer/fix/hide-tokens-bounds
Jun 7, 2026
Merged

Fix runtime bounds error in hideTokens#237
kordianbruck merged 2 commits into
masterfrom
seer/fix/hide-tokens-bounds

Conversation

@sentry

@sentry sentry Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a runtime.boundsError that occurred in the hideTokens function (internal/app.go) when masking URL query parameters.

Root Cause:
The hideTokens function unconditionally sliced pToken[:4], pStud[:4], and pPers[:4] to mask sensitive information. This led to a panic if any of these query parameters were shorter than 4 characters, as the slice operation would go out of bounds.

Solution:
The slicing operations have been updated to use [:min(4, len(x))] for pToken, pStud, and pPers. This ensures that the slice upper bound is always valid, preventing the runtime error when a parameter is shorter than 4 characters, while still masking the first 4 characters when available.

Fixes CALENDARPROXY-2

@kordianbruck kordianbruck marked this pull request as ready for review June 7, 2026 11:26
@kordianbruck kordianbruck merged commit 28a0012 into master Jun 7, 2026
3 checks passed
@kordianbruck kordianbruck deleted the seer/fix/hide-tokens-bounds branch June 7, 2026 11:27
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