fix(receive): validate tenant label#8806
Open
guidonguido wants to merge 1 commit intothanos-io:mainfrom
Open
Conversation
1043f2f to
f348ea8
Compare
saswatamcode
previously approved these changes
May 5, 2026
Member
saswatamcode
left a comment
There was a problem hiding this comment.
Thanks! Generally LGTM!
I wonder if we can skip e2e test for this here, and just check handler
| }) | ||
| } | ||
|
|
||
| func TestReceiveTenantValidation(t *testing.T) { |
Member
There was a problem hiding this comment.
Maybe instead of e2e test, we should just have a handler test? So we can check the error as well?
Signed-off-by: Guido Ricioppo <griciopp@redhat.com>
f348ea8 to
8da5922
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.
Changes
When
--receive.split-tenant-label-nameis configured, tenant IDs extracted from labels are now validated against IsTenantValid() as done for HTTP header and certificate-based tenants.pkg/receive/handler.go: validate tenant IDs extracted from labels, matching the existing validation applied to HTTP header tenants.test/e2e/receive_test.go: AddTestReceivePathTraversalwith subtests verifying both HTTP header andlabel-based path traversal attempts are rejected.
Verification
TestReceivePathTraversalconfirms labels like../mal-pathare now rejected