fix(eng-10262): added correct encoding of next query parameter#883
Open
ihorsokhanexoft wants to merge 1 commit intoCenterForOpenScience:feature/pbs-26-2from
Open
fix(eng-10262): added correct encoding of next query parameter#883ihorsokhanexoft wants to merge 1 commit intoCenterForOpenScience:feature/pbs-26-2from
ihorsokhanexoft wants to merge 1 commit intoCenterForOpenScience:feature/pbs-26-2from
Conversation
nsemets
reviewed
Feb 13, 2026
Comment on lines
+7
to
+16
| export const localUrlParam = (params: { service: string; next?: string }) => { | ||
| const { service, next } = params; | ||
|
|
||
| // encode "next" separately because it must be encoded twice | ||
| const encodedNext = next ? encodeURIComponent(next) : undefined; | ||
|
|
||
| const valueAfterService = encodedNext ? `${service}?next=${encodedNext}` : service; | ||
|
|
||
| return `service=${encodeURIComponent(valueAfterService)}`; | ||
| }; |
Collaborator
There was a problem hiding this comment.
Suggested change
| export const localUrlParam = (params: { service: string; next?: string }) => { | |
| const { service, next } = params; | |
| // encode "next" separately because it must be encoded twice | |
| const encodedNext = next ? encodeURIComponent(next) : undefined; | |
| const valueAfterService = encodedNext ? `${service}?next=${encodedNext}` : service; | |
| return `service=${encodeURIComponent(valueAfterService)}`; | |
| }; | |
| export const localUrlParam = (params: { service: string; next?: string }): string => { | |
| const { service, next } = params; | |
| if (!next) { | |
| return `service=${encodeURIComponent(service)}`; | |
| } | |
| const encodedNext = encodeURIComponent(next); | |
| const valueAfterService = `${service}?next=${encodedNext}`; | |
| return `service=${encodeURIComponent(valueAfterService)}`; | |
| }; |
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.
https://openscience.atlassian.net/browse/ENG-10262
Purpose
For LOCAL env only:
A new
nextquery parameter must be the first one to be encrypted and then encrypted one more time withservicequery parameter together.So everything after
localhost:8080/login?service=is encrypted and thenextquery param with its value is encrypted twice.Also in the middle of the url, we should use
?instead of&(%3F - encoded, between login and next words) so that thenextparameter belongs toservice, not the main requesthttp://192.168.168.167:8080/login?service=http%3A%2F%2Flocalhost%3A5000%2Flogin%3Fnext%3Dhttp%253A%252F%252Flocalhost%253A4200%252F
And CAS should handle login, not angular, so we replace 4200 port in
servicequery parameter by 5000