-
Notifications
You must be signed in to change notification settings - Fork 137
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
Compile issues due to sodium-native #404
Comments
This is indeed a problem that we also felt on our side (Ledger Live) on our path of migrating from Node 12 to Node 14. Is there any progress done on the matter? Is there a possible workaround to disable sodium-native globally? (it seems yarn only allow to globally disable optional, but you can't target a specific one) |
Please consider upgrading or changing sodium to something else. 🙏 |
This will be a long reply but I think worthwhile both for current and future context, particularly for myself as a newer maintainer. TL;DR: There are no suitable, secure alternatives to the library from my investigation. However, try the Prior workThere have been discussions and changesets before on the crypto dependencies:
Historically, it appears we went from: On
|
These are good comments @Shaptic. I would make note of a few things: sodium-nativeBy all indications these bindings for https://www.npmjs.com/package/sodium-native This wrapper is unaudited to my knowlege. I struggle with the idea of this being considered the most secure alternative available. libsodiumYou are putting a lot of weight on the audit of https://github.com/jedisct1/libsodium/blame/master/ChangeLog Using this necessitates accepting the maintenance/security risks of the tweetnaclIt seems that this lib is meeting all the needs and is currently in use. The only issue I'm aware of that stops it from being the only choice is performance. Its Cure53 audits, like the others, are nearly five years old and yet it is still acceptable. Keep in mind that despite the audits, security issues have still been found and fixed since. https://github.com/dchest/tweetnacl-js/releases I can tell you from personal experience that security audits are not a magic protective shield. If the Stellar org is making choices based on audits, then perhaps it should sponsor a re-audit of crypto-key-composerI'm not sure why this is characterized as an "unreliable dependency". If you don't want to use it that's fine. But I'm not sure that applying bias without having examined or tested it is called for. Its just a set of key utility functions to improve ergonomics. I think its only potentially needed if the choice to use modern Node APIs is made (for purely performance reasons and as a replacement for sodium wrappers). I found it useful, but maybe smarter minds will find a better way to handle the key impedance mismatch. https://github.com/truestamp/ed25519-bench/blob/master/compat.js#L40 IMHOIt seems to me that the most important question to address is regarding the performance requirements for this I would also suggest that incorporating two libs (primary and fallback) in itself adds to the security costs of that choice. A lot of weight is being put on stale security audits at the expense of complexity (risk). Although 'unaudited', there are orders of magnitude more eyes on what Node I hope this contributes to the conversation and drives discussion of some of the tradeoffs. ✌🏻 |
Thank you for taking the time to write such a thorough reply! I'll try to respond to all of your points in turn. Re:
|
Please update sodium-native to v3 |
@mahnunchik give it a go in the |
Deployments fail due to this issue, stellar SDK becomes very painful to use. Is there a way we can fix this on the main package? |
They've been sitting on this pain point for nearly two years @alejomendoza. See conversation above and here: |
This commit addresses the following issues: stellar#339 stellar#404 Changes: - removal of optional sodium-native native compiled module - promotion of existing version of tweetnacl-js to handle all sign/verify duties Removal of the optional dependency greatly simplifies the code in `src/signing.js` and removes all native compilation issues that have negatively impacted developers for at least two years when using modern versions of NodeJS. This commit does not choose to prefer a new method of signing, it simply delegates that task to the existing primary signature library (tweetnacl-js) in all cases. This also has the pleasant side-effect of greatly simplifying the signature code removing what had been described in the code comments as being "a little strange". The actual signature generate/sign/verify functions remain completely unchanged from prior code and have been refactored only to simplify the code. This also has the pleasant side effect of allowing any security audits of this code, or the associated tweetnacl-js library, to have far less surface area to examine. Cryptographic 'agility', as previously existed here to address theoretical performance issues, is considered a security anti-pattern. All existing gulp test suites pass when tested with Node version 14.18.2
I have created a pull request for review which removes the optional dependency on See : #495 I have also filed an issue to request a bump of See : #496 |
The library is an optional dependency; you can install this package without it: npm install --no-optional stellar-sdk
# or
yarn install --ignore-optional stellar-sdk |
If this will work as a solution (I have not yet tested in e.g. a Docker container with no toolchain installed) it needs to be documented at the top level readme's of both projects and not buried in this thread. I'll try to test further tomorrow. |
tested with docker container
Steallr-sdk started working |
js-stellar-base/package.json
Line 115 in c687cf9
Sodium-native's version is causing issues because the node-gyp version is old. That means it does not have support for VS 2019 causing compiler compiler errors because the enum value is not in node-gyp for python look ups. Can we bump the version?
From the code, it seems it is only used for singing. Do we need this complexity?
The text was updated successfully, but these errors were encountered: