fix(events): omit GitLab webhook tokens from errors - #6851
Open
chenrui333 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to removing sensitive token data from error strings and includes regression tests that verify the non-leak behavior.
Pull request overview
This PR updates the GitLab webhook request validator to avoid leaking webhook token values in authentication error messages, preventing accidental disclosure via logs and HTTP responses.
Changes:
- Removed the supplied
X-Gitlab-Tokenvalue from the “did not match expected secret” error message. - Updated the invalid-secret regression test to assert that neither the configured secret nor the client-supplied token appears in the error text (and that rejection happens before body parsing).
File summaries
| File | Description |
|---|---|
server/controllers/events/gitlab_request_parser_validator.go |
Sanitizes the secret-mismatch error message to omit webhook token values. |
server/controllers/events/gitlab_request_parser_validator_test.go |
Strengthens tests to ensure token values are not present in errors and auth fails before parsing. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Go Go / code-coverage/goThe overall line coverage in commit 86919fb in the Show a line coverage summary of the most covered files.
Updated |
chenrui333
force-pushed
the
fix/gitlab-webhook-token-errors
branch
from
September 7, 2026 09:16
18e1453 to
c4726e8
Compare
Keep the authentication failure diagnostic without including the supplied token, which is forwarded to logs and the HTTP response. Cover missing, mismatched, and suffixed tokens before malformed payload parsing. Assisted-by: OpenAI Signed-off-by: Rui Chen <rui@chenrui.dev>
chenrui333
force-pushed
the
fix/gitlab-webhook-token-errors
branch
from
September 7, 2026 23:48
c4726e8 to
86919fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Omit the supplied GitLab webhook token from authentication errors.
Why
These errors are written to logs and returned in HTTP responses.
Testing
Rejection regression fails before the fix; validator and events-controller package tests pass.