webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

PAT validation error is assigned in context.user

Open Andrei199991 opened this issue 6 years ago • 2 comments

context.user is assigned an error response from Validate PAT lambda function if an invalid token is sent.

This is:

  • Bug

Expected Behavior

You should see context.null === null

Actual Behavior

You get context.null === "{ errors: {...}, statusCode: 500, headers: {...} }"

Steps to Reproduce the Problem

Send an invalid AT and you should encounter this issue.

Possible Solution

Update authenticatePat plugin, and make sure that when you invoke the ValidatePAT Lambda function, the returned response is not an error but actually user data.

Currently the code at packages/api-security/src/plugins/authentication/authenticatePat.ts:20 simply assigns whatever the response is. Check for errors here.

Andrei199991 avatar Jun 18 '20 16:06 Andrei199991

Since I'm currently in the middle of refactoring the security and Headless CMS backend code, I'll take a look at this.

adrians5j avatar Jul 13 '20 14:07 adrians5j

Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Slack Community or ping one of the reviewers. Thank you for your contributions!

adrians5j avatar Oct 10 '20 01:10 adrians5j