question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Urls should be safe by default

See original GitHub issue

Following https://github.com/algolia/instantsearch.js/issues/848#issuecomment-191795411 and a support request we had also recently, I believe we should fix our urls.

We will get more and more issues about unsafe urls in the future.

Problem :trollface:

we implemented urls so that they do not look too bad: ?query=&hits=24&idx=instant_search&p=0&nR[price][<=][0]=320&is_v=1

But this is not really standard because most parameters should be encoded so that our urls are compatible with every use case (copy pasting from/to email/app/slack, server side parsing, library parsing…)

Thus it would mean having urls like:

?query=&hits=24&idx=instant_search&p=0&nR%5Bprice%5D%5B%3C%3D%5D%5B0%5D=380&is_v=1

Not so clean and readable but would work everywhere.

Possible solutions 🐴

This even seem to be backward compatible. It would be a WTF moment for developers but safety first!

  • create a brand new stringifier for complex objects => url which would not be based on unsafe characters like [ ] > =

Here we should be careful about URL versions if we want to stay backward compatible (is_v= will help)

Help and feedback appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
vvocommented, Oct 6, 2017

We had to encode [] also because when copy pasting links those need to be encoded.

You can check which ones needs to be encoded in a URL by doing:

> encodeURIComponent('[]')
"%5B%5D"

For example copy pasting those links in slack or in emails resulted in failures given the email client or the slack client.

Happy to revisit/rediscuss this if some testing prove this is not necessary. (maybe open another issue if so)

1reaction
bobylitocommented, Jun 21, 2016

I do not get how this would solve the issue?

Let me explain further. Right now, we have a generic solution that completly maps whatever could be in the SearchParameters. Our problem comes from the fact we serialize deep structures automatically. This leads to : fR[format][0]=Wild in which we have [ and ]. What about we let the user make it’s own mapping, format=Wild,Standard for a the list of selected facets for the attribute format?

I don’t have an idea for an API. 😃

In the mean time, the PR look nice 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

A safer default for navigation: HTTPS - Chromium Blog
Chrome will now default to HTTPS for most typed navigations that don't specify a protocol 2. HTTPS is the more secure and most...
Read more >
Set up Safe Links policies in Microsoft Defender for Office 365
Although there's no default Safe Links policy, the Built-in protection preset security policy provides Safe Links protection to all recipients ( ...
Read more >
Indexing HTTPS pages by default | Google Search Central Blog
The sitemaps lists the HTTPS URL, or doesn't list the HTTP version of the URL; The server has a valid TLS certificate. Although...
Read more >
Configuring URL Protection User Awareness
Whether the URL is considered safe, or harmful. ... The default value is 5%, but can be set to anywhere between 1% and...
Read more >
How Can I Tell if a URL is Safe? - Webroot
Look for an https:// in the address of the web page you want to visit. HTTPS stands for HTTP Secure, and adds a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found