Argon2 hashing algorithm for NodeJS server model

Sha512 is not a security flaw by itself. You could build an acceptable algorithm with it in Wappler. But do you know how to do that? How are you going to select the salt? Is it secure enough? How will you know?

SHA family of functions were never intended to be used as a means to storing password hashes. They were intended for “digests”. To sign things in other words.

You can use a SHA function as a building block for a secure algorithm(i.e. PBKDF2-HMAC)

But on it’s own your application will be less secure than other apps using a key derivation function.

NIST doesn’t recommend using SHA functions to store “secrets”. They recommend Key Derivation Functions which SHA family are not.

Memorized secrets SHALL be salted and hashed using a suitable one-way key derivation function. Key derivation functions take a password, a salt, and a cost factor as inputs then generate a password hash. Their purpose is to make each password guessing trial by an attacker who has obtained a password hash file expensive and therefore the cost of a guessing attack high or prohibitive. Examples of suitable key derivation functions include Password-based Key Derivation Function 2 (PBKDF2) [SP 800-132] and Balloon [BALLOON].

Argon2, scrypt, bcrypt and old but standardized PBKDF2 are still way better than using any SHA function.

1 Like

That is actually a pretty neat solution! Maybe @patrick should check it out and see if we can better use it like this indeed instead of going the async way.

1 Like

Instead of editing an existing formatter file you could create a new one, all files in the lib/formatters are being loaded dynamically and that would prevent your file from being overwritten.

An async method would be preferred here since the sync version would block your JavaScript thread and makes your server freeze up for a little moment while the function is executing. To allow async formatters I have to rewrite the expression parser to be async also, that will take some time but is something that I also prefer. (Will be for NodeJS exclusive since the other server models (except .net) do not support async execution)

3 Likes

Would you ‘guess’ that it might be a 2020 job?

Thanks for the tip @patrick.

Indeed. Async will always be preferred.

The app I am building isn’t planning on having too many users at the beginning. Around 1200 users at launch. And as the actual workload is created on hashing and not so much on verifying I am assuming there won’t be so much workload to end in a DoS.

1 Like

@JonL Your guess is correct. I don’t know how to build an acceptable algorithm. I looked at osme other threads like Better password encryption and honestly, I am confused.

I think my options are:

  1. Use SHA512 Hash for passwords right now and wait for Wappler to implement Argon2 for NodeJs
  2. Use SHA512 Hash for passwords + set up a random salt like so Centralise salt string references and wait for Argon2
  3. Try to replicate what you have done above @JonL - but you are advising to wait

Can you please advice me?

Thank you!

Sorry @karh I totally missed this post. Are you still blocked here?

@JonL Haha yeah, I’ve just gone with the first option… not live yet so advice is welcome!

I could create a module for argon but it would still need a small workaround as I can’t plug into Server Connect Security Provider. Hopefully one day Security Provider can be extended.

On the other side argon2 is trending in the forum lately and people are pushing for a native solution within Wappler.

So maybe it’s coming soon! @george?

Sha-512 is an OK temporary solution of course. But you should eventually migrate to a more secure option like argon2

1 Like

It’s one main reason I’ve not converted completely to Node yet

1 Like

And that’s the reason I haven’t published a module for this tbh. I don’t want to have to maintain something so critical and core like a security feature.

1 Like

This is actually a very good point. @george we have people on php because of this! :joy:

2 Likes

Thanks Jon, will work with this for now and keep my fingers crossed for a native solution in the near future :slight_smile:

1 Like

+1
Following advice from others I’ve kicked off a new application using NodeJS rather than my more comfortable PHP. Luckily this is just a prototype for now but native password hashing in NodeJS is most welcome. Please. :slight_smile:

2 Likes

tenor

1 Like

Please vote for it too!

1 Like

Argon2 is now available for NodeJS as well.

This topic was automatically closed after 47 hours. New replies are no longer allowed.