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

fix: Improper regex escaping results in certain links and forms not getting signed #2

Open
brettflorio opened this issue Feb 14, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@brettflorio
Copy link
Contributor

brettflorio commented Feb 14, 2022

A form like this won't be signed:

<form method="POST" action="https://example.foxycart.com/cart">
  <input name="name" value="tart">
  <input name="price" value="10">
  <input name="code" value="sub">
  <select name="sub_frequency">
    <option value="1m{p-10%}">Monthly</option>
    <option value="2m{p-1%}">Every other Month
    </option>
  </select>
  <input type="submit" value="Add Sub to cart">
</form>

Issue is incorrectly escaped regex in https://github.com/Foxy/foxy-cloudflare-addtocart-signing/blob/main/src/Signer.ts#L181

Similarly, https://github.com/Foxy/foxy-cloudflare-addtocart-signing/blob/main/src/Signer.ts#L125 has an unescaped ? that's causing problems with some add-to-cart links. (As well as a double-escaped slash for a backreference.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants