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

MongoIds pass integer validation whether you are using mongo or not #1248

Open
kevinburkeshyp opened this Issue Dec 12, 2015 · 1 comment

Comments

3 participants
@kevinburkeshyp
Contributor

kevinburkeshyp commented Dec 12, 2015

Relevant code in core/validations.js

    // If type is integer and the value matches a mongoID let it validate
    if(hasOwnProperty(self.validations[validation], 'type') && self.validations[validation].type === 'integer') {
      if(utils.matchMongoId(value)) return cb();
    }

So it seems like if I am using Postgres but I pass something like "4cdfb11e1f3c000000007822" as an integer value, Waterline will pass it to the database without applying the normal validation.

@devinivy

This comment has been minimized.

Contributor

devinivy commented Dec 14, 2015

I agree that this is smelly. We need to rip out some mongo-specific references within waterline, including this. Adapters currently do have the ability to set their own primary key type.

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