Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/request disappearing #1181

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bpoulaindev
Copy link
Contributor

Description

Solving issue #1076
Added override decodeURIComponentSafe function to prevent % character being escaped

image

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

@helloanoop
Copy link
Contributor

Thank you @bpoulaindev !

I have some comments

  • Can you remove the bun.lockb file. You can add it to .gitignore
  • Can we move the decodeURIComponentSafe to a new file utils.js and also add a unit test to it ?

@bpoulaindev
Copy link
Contributor Author

bpoulaindev commented Dec 11, 2023

Eventually why would we need to decode the URI for a password ? I can't see how we could have a function that can preserve an uri and a password at the same time without breaking it. Or we could decode it only when the value starts by "https" or "http"

@helloanoop
Copy link
Contributor

@bpoulaindev The decodeURIComponent was added in this commit ddddab8

It's related to #571

@bpoulaindev
Copy link
Contributor Author

I eventually opted for non-decoding passwords and keeping encodeURI for every other field

@@ -105,7 +105,7 @@ const mapPairListToKeyValPairs = (pairList = [], parseEnabled = true) => {
}
return _.map(pairList[0], (pair) => {
let name = _.keys(pair)[0];
let value = decodeURIComponent(pair[name]);
let value = name === 'password' ? pair[name] : decodeURIComponent(pair[name]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpoulaindev We need to solve this in a generic way and should not hardcode this to apply to any key-val pair that has the name password

The mapPairListToKeyValPairs is used to parse all key val pairs (headers, assertions, vars, query params)

Copy link
Contributor Author

@bpoulaindev bpoulaindev Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@helloanoop how could you have a generic function that work both on a password (which can be of any form), a random string and an encoded URL with params ?
Edit : we could encode everything in base 64 but i'm afraid it would hurt performance

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.

3 participants