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

Node.js example suggests JSON.stringify which will modify UTF-8 characters #63

Open
mrcljx opened this issue Mar 24, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mrcljx
Copy link

mrcljx commented Mar 24, 2023

Environment

Node.js 18

Steps to Reproduce

  1. Implemented integration following TS example.
    function getSignatureBody(req: Request): string {
     const stringifiedBody = JSON.stringify(req.body);
     // HACK: This is necessary since express.json() converts the empty request body to {}
     return stringifiedBody === '{}' ? '' : stringifiedBody;
    }
    
  2. User with special character in their name couldn't use "Create Issue" integration (401)
  3. Reason was a signature mismatch.
  4. Raw JSON payload ended in
    {/* ... */,"actor":{"type":"user","id":1,"name":"John Do\\u00e9"}}

Expected Result

Signature match.

Actual Result

Signature did not match.

Analysis

Calling JSON.stringify replaces \u00e9 with é.

@brianthi brianthi added the bug Something isn't working label Mar 24, 2023
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

No branches or pull requests

2 participants