Giter Club home page Giter Club logo

Comments (9)

balor avatar balor commented on August 22, 2024 2

All right, decided I'll go with the first option, use createCipheriv exclusively and bump major version to 1.0.0 as this will be breaking changes.

Concretely, if You're using encryption, after upgrade to 1.0.0 old session data will become unreadable. Positive side of this approach is cleaner code and security consistency on designated session data.

from connect-memcached.

balor avatar balor commented on August 22, 2024 2

I'll try to finish everything till the end of this week.

from connect-memcached.

balor avatar balor commented on August 22, 2024 1

@chrisiona please do so, it'll definitely motivate me for a new minor release :)

from connect-memcached.

chrisiona avatar chrisiona commented on August 22, 2024

I am also noticing this with Node v8.9.4

Taken from nodejs/node 16746

It's in the warning: use crypto.createCipheriv(), not crypto.createCipher().

I take it we'll need to patch here:

var cipher = this.crypto.createCipher(algo, key), ct = [];

@balor LMK if you'd like a PR

from connect-memcached.

chrisiona avatar chrisiona commented on August 22, 2024

@balor I'll see what I can do.

from connect-memcached.

mjamado avatar mjamado commented on August 22, 2024

Any news about this?

from connect-memcached.

balor avatar balor commented on August 22, 2024

Ok, found a little time to work on it.

You get the warning because the default algorithm for crypto is aes-256-ctr which is in a counter mode (-ctr) and use of these kind of algorithms together with createCipher function renders security inefficiency, as the same initialization vector is used every time. To be honest this case shouldn't be possible but somehow node crypto module allowed it and now they're trying to fix broken (cryptographically) code by prompting the warning.

It seems that the reasonable fix is to replace createCipher with createCipheriv and generate random iv each time, but that will render current session data incompatible.

Second option is to do a trick similar to this one, which tries to differentiate corrupted sessions and use old function on them exclusively. I'm not a big fan of such solutions to be honest.

Finally, if you really want to fix the security problem, you want not only to use new function for but completely replace the session store with properly encoded data.

What do you think? Feedback needed :)

from connect-memcached.

mjamado avatar mjamado commented on August 22, 2024

Thanks, @balor! Do you have an estimate as to when it'll land in NPM?

from connect-memcached.

balor avatar balor commented on August 22, 2024

As promised, v1.0.0 with changes addressing this issue has been released. Be sure to read the changelog.

from connect-memcached.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.