-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Should Drogon have built-in cryptographic functions? #671
Comments
Happy New Year! |
No, OpenSSL is not enough. It does not support proper password hashes like argon2 and pbkdf2. At best I can make something "good enough" like I can try Crypto++. But it's hard to get right. And that feels wrong for security functions. |
Botan2 looks great, It looks like it can replace the openssl. I plan to create Drogon2 project that uses c++20 and boost.asio, The burden of compatibility with the old system can be thrown away in this version. We could discuss the Drogon2 together in another issue. |
Can't wait for Drogon2! Would that be a new library or based on drogon? I too have a lot want to improve but can't because of backwards compatibility. <insert a paragraph on how long I've tried to add http2> Anyway, I rather push nothing than a half-backed solution. Maybe postpone this until drogon2? |
As a workaround, maybe creating a plugin project like this can help u. what do you think? |
Great, any rough timeline on Drogon2 project? |
Not yet, I'm very busy recently. actually I've create the Drogon2 project and implemented most functions of Trantor by boost.asio. |
What about JWT ? I can make it as contributor for You guys and I need that. |
@roq3 Great and thanks so much! I look forward to your contribution. |
Big or not, but i started using drogon a few days ago and i missing JWT for my project (API REST), so u know... There is a lot of good libs on github, like: https://github.com/adhocore/php-jwt JWT for PHP. JWT for Drogon could be pretty much like this, same methods, same structure, etc, what u think? |
I think we should make a JWTPlugin and a JWTFilter for this. |
should be good |
im working on some private project based on drogon. I need hash functions for security: eg. store passwords in database, etc. I think we need add this feature, cuz for now i need add some cpp/hpp files my own to drogon app to use sha256. Easy way: http://www.zedwood.com/article/cpp-sha256-function if we think about plugin for hashing with about 200 lines maybe this should be implemented in drogon framework. If there could be more lines and features maybe plugin will be better? |
@roq3 I've discussed with @an-tao and concluded that we shouldn't add additional dependencies to Drogon's core library. As the embedded users may not have the resource. And writing an supplementary then include/link it in your project will be the proper approach. This is the password hashing and verification code I use in my private projects. Which additionally depends on Hashing passwords with SHA256 is a bad idea. Use something like Argon2 or PBKDF2. |
I also think security related functionality should be kept outside of upstream. We already have enough open ends, features to implement, bugs to fix, and there are not enough volunteers in my opinion to deliver everything in a timely manner. By adding hashing functionality, even if this is “just” 200 LOCs, we will add maintenance burden to the currently active developers, and in the worst case open a can full of security holes. |
thx, i will try this. SHA256 with salt for password hashing should be ok, but i will change to what U suggest. |
Closing the issue as we decided to not add dependencies. Fell free to reopen. |
Don't add dependencies into the core if u don't wish. But in my opinion, it's good to force the drogon users to use dependency manager (Conan & Vcpkg) for their colourful web application development. This is 2021 and every language is going well with dependency manager. C++ is only one left a little behind. We need to move our dev culture forward. |
Any recommendations on how I can issue tokens that are safe? Thanks. |
@rajhlinux JWT is more versatile, yes. I've been considering adding support it in the drogon-assist library. But I'm working on other major improvements right now. UUIDv4 is good enough for most applications. Personally I use secure random + base64. std::vector<uint8_t> vec(16);
utils::secureRandomBytes(vec.data(), vec.size());
auto token = utils::base64Encode(vec.data(), vec.size()); Or use the secure random string in assist. auto token = drassist::secureRandomString(32); |
Happy new year!
#646 suggested to add security guidelines. I think that's a great idea. Especially if we could make Drogon secure by default. As of now. Drogon currently doesn't come with "security features" per se. Contrast to PHP have a built-in password_hash.
I've password hashing/verification and secure number/string generation upstream-able in my webapp. But I'm not sure if it should be upstreamed. They pull in extra dependencies that the core framework don't need and is trivial to write. And languages like Go and Rust asks user to pull in their own library.
I guess the question is:
What are your thoughts?
Thanks.
The text was updated successfully, but these errors were encountered: