Documentation
Docs43. Secure Coding Requirements

43. Secure Coding Requirements

Every pull request and commit to the kortana-node C++ repository must strictly satisfy an unyielding set of secure coding rules codified in the core production engineering specification.

43.1 Multi-Party Code Review

No code may be merged into the core consensus, execution, cryptographic, or storage subsystems without mandatory multi-party code review and explicit approval from at least two senior maintainers. Pull requests touching consensus-critical algorithms (such as the HotStuff pacemaker, BLS signature aggregation, or state trie hashing) must include formal invariant proofs and regression test fixtures.

43.2 Bounds Checking & Sanitization

All deserializers, network packet decoders, JSON-RPC parsers, and RLP unpackers must enforce strict pre-allocation bounds checking. Allocating memory buffers based on unverified header length fields is strictly prohibited. Every array index and buffer slice is validated against known container boundaries prior to access.

43.3 Memory Safety & RAII

The entire codebase is written in modern C++23, strictly adhering to Resource Acquisition Is Initialization (RAII) patterns. Raw pointer arithmetic, manual malloc/free, and unprotected new/delete are completely forbidden. All heap resources are managed via std::unique_ptr and std::shared_ptr. Database iterators, socket handles, and file descriptors automatically release their underlying resources upon leaving scope.

43.4 Dependency Vendor Isolation

To eliminate software supply-chain vulnerabilities, malicious package injection, and unexpected upstream breaking changes, all external third-party libraries (including evmone, rocksdb, blst, libsodium, and simdjson) are pinned to specific audited commit hashes and vendored directly within the 3rdparty/ source tree.

43.5 Error Propagation Rules

In accordance with specification guidelines, all fallible internal C++ functions return an explicit Result<T, ErrorCode> wrapped with the [[nodiscard]] compiler attribute. This guarantees that errors cannot be dropped, ignored, or swallowed at compile time. Unhandled errors cause immediate compilation failures.