Skip to content

Make sure id properties cannot be changed - #508

Merged
raymondfeng merged 2 commits into
masterfrom
feature/fix-update-attrs
Mar 16, 2015
Merged

raymondfeng merged 2 commits into
masterfrom
feature/fix-update-attrs

Conversation

@raymondfeng

Copy link
Copy Markdown
Contributor

/to @ritch or @bajtos
/cc @fabien

This PR prevents id values to be changed during prototype.attributes.

@bajtos

bajtos commented Mar 16, 2015

Copy link
Copy Markdown
Member

LGTM.

@bajtos

bajtos commented Mar 16, 2015

Copy link
Copy Markdown
Member

I am wondering if this is a breaking change?

@raymondfeng
raymondfeng force-pushed the feature/fix-update-attrs branch from 8033e83 to f91399a Compare March 16, 2015 16:26
@raymondfeng

Copy link
Copy Markdown
Contributor Author

This is to cover a hole that could violates the data integrity. If an existing app use this feature by accident, we should break it to get the security issue exposed sooner than later.

raymondfeng added a commit that referenced this pull request Mar 16, 2015
Make sure id properties cannot be changed
@raymondfeng
raymondfeng merged commit eb9a8f5 into master Mar 16, 2015
@raymondfeng
raymondfeng deleted the feature/fix-update-attrs branch March 16, 2015 16:53
@nicholasareed

Copy link
Copy Markdown

@raymondfeng this breaks for mongodb users (or for any databases who have an ObjectId for the id). Perhaps a warning should popup (instead of an Error) and

delete data[idName];

or modify the if statement to be

if (data[idName] !== undefined && data[idName] !== inst[idName] && data[idName].toString() !== inst[idName].toString()) {

@raymondfeng

Copy link
Copy Markdown
Contributor Author

This should have been fixed by #522.

@nicholasareed

Copy link
Copy Markdown

Appears that it was, sorry I missed the connection! Where can I find the process for how it gets moved to npm? The install there is the broken version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants