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

Properly destroy a user after a credentials creation failure #1507

Merged
merged 2 commits into from
Nov 4, 2019

Conversation

scottinet
Copy link
Contributor

Description

Here is how a user is created in Kuzzle:

  1. Kuzzle asks strategy plugins to check credentials (validate functions). If a plugin rejects credentials, the user creation process is aborted
  2. Kuzzle creates a global user and attributes it a kuid
  3. Kuzzle asks strategy plugins to create credentials
  4. If a plugin fails to create credentials, Kuzzle deletes the already created credentials as well as the global user

There is a bug in step 4: the incorrect argument is passed to repositories.delete, and the rollbacks does not delete the global user document. This makes Kuzzle consider the user as "already created" and even with fixed credentials, it cannot be created anymore.

@codecov
Copy link

codecov bot commented Nov 1, 2019

Codecov Report

Merging #1507 into 2-dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##            2-dev    #1507   +/-   ##
=======================================
  Coverage   92.81%   92.81%           
=======================================
  Files          97       97           
  Lines        6627     6627           
=======================================
  Hits         6151     6151           
  Misses        476      476
Impacted Files Coverage Δ
lib/api/controllers/securityController.js 98.37% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d58e5d...9d50ad9. Read the comment docs.

@Aschen Aschen merged commit 1cce959 into 2-dev Nov 4, 2019
@Aschen Aschen deleted the 2/fix-user-creation-rollback branch November 4, 2019 05:13
@Aschen Aschen mentioned this pull request Nov 5, 2019
Aschen added a commit that referenced this pull request Nov 5, 2019
# [2.0.0-rc.2](https://github.com/kuzzleio/kuzzle/releases/tag/2.0.0-rc.2) (2019-11-05)


#### Breaking changes

- [ [#1500](#1500) ] Remove Dsl constructor from plugin context   ([Aschen](https://github.com/Aschen))
- [ [#1489](#1489) ] Drop support for socket.io   ([scottinet](https://github.com/scottinet))
- [ [#1491](#1491) ] Remove strategy constructors support   ([Aschen](https://github.com/Aschen))
- [ [#1476](#1476) ] Change Document controller m* routes returns & fix SDK functional tests   ([Aschen](https://github.com/Aschen))

#### Bug fixes

- [ [#1512](#1512) ] Fix subscribing with a dead connection   ([benoitvidis](https://github.com/benoitvidis))
- [ [#1507](#1507) ] Properly destroy a user after a credentials creation failure   ([scottinet](https://github.com/scottinet))
- [ [#1483](#1483) ] Fix socketio connections leak & deactivate this protocol by default   ([scottinet](https://github.com/scottinet))

#### New features

- [ [#1502](#1502) ] Add a new "document:exists" API route   ([scottinet](https://github.com/scottinet))
- [ [#1501](#1501) ] Add collection delete   ([Aschen](https://github.com/Aschen))
- [ [#1499](#1499) ] Expose an Elasticsearch client constructor in plugin context   ([Aschen](https://github.com/Aschen))
- [ [#1484](#1484) ] Upgrade script   ([scottinet](https://github.com/scottinet))

#### Enhancements

- [ [#1510](#1510) ] Mapping - enable dynamic templates   ([benoitvidis](https://github.com/benoitvidis))
- [ [#1495](#1495) ] Check for SDK compatibility against current Kuzzle version   ([Aschen](https://github.com/Aschen))
- [ [#1498](#1498) ] Add highlight to search results   ([Aschen](https://github.com/Aschen))
- [ [#1488](#1488) ] Add kuzzle version to the dumped informations   ([scottinet](https://github.com/scottinet))
- [ [#1481](#1481) ] Error codes normalization   ([scottinet](https://github.com/scottinet))
- [ [#1478](#1478) ] Error codes redux   ([scottinet](https://github.com/scottinet))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants