express-restify-mongoose@0.5.6 vulnerabilities

Easily create a flexible REST interface for mongoose models

  • latest version

    9.0.5

  • latest non vulnerable version

  • first published

    12 years ago

  • latest version published

    5 months ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the express-restify-mongoose package. This does not include vulnerabilities belonging to this package’s dependencies.

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Private Data Disclosure

    express-restify-mongoose is a module to easily create a flexible REST interface for mongoose models.

    It supports marking certain fields as private, to keep from exposing them to users, but fails to remove those fields from certain output scenarios, resulting in potential private data exposure.

    For instance, if you have the following User model:

    const User = mongoose.model('User', new mongoose.Schema({
        name: String,
        password: String,
    }));
    

    To keep from exposing the password, you'll likely to want to call it out as a private field like so:

    restify.serve(router, User, {
        private: ['password'],
    })
    

    This will indeed result in the password field not showing when you request an item, for instance via GET /User or GET /User/some-id.

    However, when querying on that field, using GET /User?distinct=password, ALL passwords for ALL the users in the DB would be shown.

    How to fix Private Data Disclosure?

    Update to version 3.1.0 or newer on the 3.x branch, or to version 2.5.0 or newer on the 2.x branch.

    <2.5.0>=3.0.0 <3.1.0