This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
user_context header encode/decode processing #2735
Merged
Merged
Conversation
This file contains 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
PetarTodorovv
added
👋 request review
Review required
do-not-merge/hold
Indicates that a PR should not merge because someone has issued a /hold command.
labels
Nov 14, 2022
kyma-bot
added
size/M
Denotes a PR that changes 30-99 lines, ignoring generated files.
🦖 team-raptor
Team Raptor Label
labels
Nov 14, 2022
kyma-bot
added
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
and removed
size/M
Denotes a PR that changes 30-99 lines, ignoring generated files.
labels
Nov 15, 2022
nyordanoff
approved these changes
Nov 16, 2022
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nyordanoff The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
kyma-bot
added
the
approved
Indicates a PR has been approved by an approver from all required OWNERS files.
label
Nov 16, 2022
PetarTodorovv
removed
👋 request review
Review required
do-not-merge/hold
Indicates that a PR should not merge because someone has issued a /hold command.
labels
Nov 16, 2022
@@ -96,12 +107,30 @@ func (c *consumerContextProvider) Match(_ context.Context, data oathkeeper.ReqDa | |||
} | |||
|
|||
func (c *consumerContextProvider) getUserContextData(userContextHeader string) (*userContextData, error) { | |||
clientID := gjson.Get(userContextHeader, c.consumerClaimsKeysConfig.ClientIDKey) | |||
decodedUserContextHeader, err := url.QueryUnescape(userContextHeader) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a fair amount of code duplication.
The same can be achieved with
if decodedUserContextHeader, err := url.QueryUnescape(userContextHeader); err == nil {
userContextHeader = decodedUserContextHeader
}
And everything below stays the same.
Valid for the above method as well. Could be a one-liner.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
approved
Indicates a PR has been approved by an approver from all required OWNERS files.
lgtm
Looks good to me!
size/L
Denotes a PR that changes 100-499 lines, ignoring generated files.
🦖 team-raptor
Team Raptor Label
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.
Description
In the hydrator component and more specifically in the
consumre_context_provider
we could receive non-ascii characters in theuser_context
header. They will be escaped/encoded and we need to unescape/decode before using the data.Changes proposed in this pull request:
user_context
header before data processingPull Request status
chart/compass/values.yaml
is updated