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

Lack of duplicate ID checking in Sharable Editor results in overwrites #482

Open
billcao opened this issue Feb 16, 2015 · 0 comments
Open

Comments

@billcao
Copy link
Collaborator

billcao commented Feb 16, 2015

This is a client side issue caused by the use of Clotho.set to save objects without any checking if a duplicate ID already exists in the database.

Creating a new object via the Sharable Editor with an ID that already exists will clobber the previous object with that ID. To reproduce, simply create an object with an ID and then create another object with the same ID - the old one will be rewritten automatically.

This issue also occurs when creating an instance of a Schema, modifying some fields excluding the ID field, and saving.

The issue is caused by an invalid use of Clotho's set method, which should be used to set certain fields of an existing object, rather than used to create (and thus overwrite existing) objects.

The function scope.save which calls Clotho.set in clothoEditor.js should be modified to use a Clotho.create call, which should then trigger a prompt to the user if an object is going to be rewritten. Note that Clotho's create call has checking to see if the given ID already exists, and if it does, returns null as the ObjectId.

@billcao billcao changed the title Lack of duplicate ID checking in Sharable Editor resulting in overwrites Lack of duplicate ID checking in Sharable Editor results in overwrites Feb 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants