loopback icon indicating copy to clipboard operation
loopback copied to clipboard

It's still possible create relation Objects of User when logged User was deleted.

Open bluestaralone opened this issue 12 years ago • 5 comments

When i'm using Explorer to test ACLs i see this case: It's still possible create relation Objects of User when logged User was deleted. Case:

  • User has many Books (userId)
  • Books belong to User (userId)

Step like below:

  • Create User
  • Login User
  • Delete logged User (in case still logged - Token is set)
  • Create Book (in case still logged - Token is set) - It's still can do this why ?

I don't know why when deleting User, you don't delete AccessToken so when i create Book it can use userId of Token to create Book but User of userId is not available. ?

bluestaralone avatar Sep 24 '14 02:09 bluestaralone

Good catch. There are a few things that can be enforced:

  1. The token middleware should check if the token and it's user id are still valid.
  2. Ideally, when a user is deleted or password is changed, access tokens created for the user should be invalidated. We can store a hash of the user credential as a property of the token so that it can be used to verify if the user credential has been changed.

Sent from my iPhone 5

On Sep 23, 2014, at 7:58 PM, SangNT [email protected] wrote:

When i'm using Explorer to test ACLs i see this case: It's still possible create relation Objects of User when logged User was deleted. Case:

User has many Books (userId) Books belong to User (userId) Step like below:

Create User Login User Delete logged User (in case still logged - Token is set) Create Book (in case still logged - Token is set) - It's still can do this why ? I don't know why when deleting User, you don't delete AccessToken so when i create Book it can use userId of Token to create Book but User of userId is not available. ?

— Reply to this email directly or view it on GitHub.

raymondfeng avatar Sep 24 '14 03:09 raymondfeng

when password is changed, access tokens created for the user should be invalidated.

IMO this should be configurable. Invalidating existing access tokens on password change can be very annoying, as you have to re-login from all devices. E.g. Facebook used to have a checkbox "log me out from all devices" in the change-password-form, so that the user could decide.

bajtos avatar Sep 29 '14 11:09 bajtos

+1 to make it configurable.

raymondfeng avatar Sep 29 '14 15:09 raymondfeng

@loay please back-port the fix to 2.x, the issue is not "done" until then.

bajtos avatar Jul 25 '16 14:07 bajtos

  • [x] Fix security issue: https://github.com/strongloop/loopback/pull/2492
  • [x] backport: https://github.com/strongloop/loopback/pull/2540
  • [x] address issue concerning test case. https://github.com/strongloop/loopback/pull/2549
  • [x] backport after fixing test cases. https://github.com/strongloop/loopback/pull/2553

loay avatar Jul 25 '16 15:07 loay