fix: security hardening and bug fixes across all core modules - #9
Open
0xgetz wants to merge 6 commits into
Open
Conversation
- Added fork maintainer section for 0xgetz fork - Noted upstream source: octra-labs/webcli - Added contribution guidelines reference
|
did you remove all the api endpoints in main.cpp ? ? ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes 12 bugs and security issues found across the four core source files.
crypto_utils.hpp
1. Thread-safety race condition in
base64_decodeconstexprcompile-time lookup table. Zero runtime cost, fully thread-safe.2. Unchecked return values in
wallet_encryptEVP_EncryptUpdateandEVP_EncryptFinal_exreturn values were ignored. Silent data corruption on failure.std::runtime_erroron failure.3.
wallet_decryptoutput buffer not resized to actual lengthciphertext.size()but the actual decrypted length (returned by EVP) was never used — trailing garbage bytes were included.out_len1 + out_len2after decryption.4.
derive_hd_seedv1 copies master seed bytes instead of deriving child keystd::copyof the master seed directly — no actual HD derivation occurred.5.
validate_mnemonic— linear search + UB instd::tolowerstd::find(O(n)) on an unsorted wordlist;std::tolower(char)is UB for negative char values.std::binary_search(O(log n)); cast char tounsigned charbeforetolower.rpc_client.hpp
6. Default constructor leaves
host_emptyRpcClient()lefthost_as empty string — any RPC call without explicit host would fail silently.host_to"rpc.octra.io".7. Incomplete comment
// rpc compl// rpc completion callback.wallet.hpp
8.
wallet_path_for— missing address validation + path traversaloctprefix; any string including../could be used to write wallet files outside the intended directory.octprefix check and strict allowlist character validation (alphanumeric only) before constructing file path.main.cpp
9.
parse_amount_rawaccepts negative values-was not rejected — negative transfer amounts could be constructed.-.10. Port validation allows values > 65535
intwith only a> 0lower bound — values like99999were accepted.port > 65535.11. Stealth mode step counter inconsistency (
[3/7]→[6/7]vs[3/8]→[6/8])/7at some points and/8at others within the same flow./8.12.
file_hintpath traversal via unvalidated inputfile_hintwith no sanitization — allowed directory traversal and access to arbitrary files..,-,_only); any other character throws an error.Testing
All changes are backward-compatible. No new dependencies introduced. Compile-tested against the existing build system.