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

Query injection possible in urlRedirects handler #2485

Open
chrisvltn opened this issue Aug 30, 2024 · 0 comments
Open

Query injection possible in urlRedirects handler #2485

chrisvltn opened this issue Aug 30, 2024 · 0 comments
Labels
Bug Something isn't working SEV-3

Comments

@chrisvltn
Copy link

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2024.7.2

What version of Remix are you using?

2.10.1

Steps to Reproduce

  1. Go to a Hydrogen website with URL redirects setup (many stores in the Showcase will have this issue)
  2. Go to /a*

Expected Behavior

You see 404 page if no route nor redirect for a* is setup

Actual Behavior

You are redirected to the first redirection that starts with a


This happens because we concatenate the URL path to the query here:

variables: {query: 'path:' + redirectFrom.replace(/\/+$/, '')},

This allows the user to manipulate the Shopify query syntax to query for any other redirect.

A solution for this is to use the Phrase query and wrap the path in double quotes (")

-       variables: {query: 'path:' + redirectFrom.replace(/\/+$/, '')},
+       variables: {query: 'path:"' + redirectFrom.replace(/\/+$/, '') + '"'},
@scottdixon scottdixon added Bug Something isn't working SEV-3 labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working SEV-3
Projects
None yet
Development

No branches or pull requests

2 participants