Skip to content

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

@brettflorio

Description

@brettflorio

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.)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions