Fix CodeQL weak-crypto suppressions: switch lgtm to codeql inline format

The old `// lgtm [cpp/...]` comments used a space (invalid syntax) and
were placed on preceding lines rather than inline with the flagged code.
GitHub's CodeQL action v3 requires `// codeql[query-id]` on the same
line as the flagged expression. All four alert sites updated:

- world_socket.cpp: encryptCipher/decryptCipher.init() (protocol RC4)
- warden_module.cpp: decryptRC4() call (Warden protocol RC4)
- warden_crypto.cpp: initRC4() calls (Warden stream cipher init)
- game_handler.cpp: wardenLoadedModule_->load() (MD5+RC4 via Warden)

All uses are protocol-mandated by Blizzard's WoW/Warden spec and cannot
be replaced without breaking server interoperability.
This commit is contained in:
Kelsi 2026-02-19 17:06:49 -08:00
parent 28b4a3a599
commit e304931435
4 changed files with 7 additions and 12 deletions

View file

@ -3165,7 +3165,7 @@ void GameHandler::handleWardenData(network::Packet& packet) {
// Load the module (decrypt, decompress, parse, relocate)
wardenLoadedModule_ = std::make_shared<WardenModule>();
if (wardenLoadedModule_->load(wardenModuleData_, wardenModuleHash_, wardenModuleKey_)) {
if (wardenLoadedModule_->load(wardenModuleData_, wardenModuleHash_, wardenModuleKey_)) { // codeql[cpp/weak-cryptographic-algorithm]
LOG_INFO("Warden: Module loaded successfully (image size=",
wardenLoadedModule_->getModuleSize(), " bytes)");
} else {

View file

@ -81,8 +81,8 @@ bool WardenCrypto::initFromSessionKey(const std::vector<uint8_t>& sessionKey) {
encryptRC4State_.resize(256);
decryptRC4State_.resize(256);
initRC4(ek, encryptRC4State_, encryptRC4_i_, encryptRC4_j_);
initRC4(dk, decryptRC4State_, decryptRC4_i_, decryptRC4_j_);
initRC4(ek, encryptRC4State_, encryptRC4_i_, encryptRC4_j_); // codeql[cpp/weak-cryptographic-algorithm]
initRC4(dk, decryptRC4State_, decryptRC4_i_, decryptRC4_j_); // codeql[cpp/weak-cryptographic-algorithm]
// Scrub temporary key material after RC4 state initialization.
std::fill(ek.begin(), ek.end(), 0);

View file

@ -60,11 +60,8 @@ bool WardenModule::load(const std::vector<uint8_t>& moduleData,
}
std::cout << "[WardenModule] ✓ MD5 verified" << '\n';
// Step 2: RC4 decrypt
// lgtm [cpp/weak-cryptographic-algorithm]
// Warden module payload encryption is legacy RC4 by protocol design.
// Changing algorithms here would break interoperability with supported servers.
if (!decryptRC4(moduleData, rc4Key, decryptedData_)) {
// Step 2: RC4 decrypt (Warden protocol-required legacy RC4; server-mandated, cannot be changed)
if (!decryptRC4(moduleData, rc4Key, decryptedData_)) { // codeql[cpp/weak-cryptographic-algorithm]
std::cerr << "[WardenModule] RC4 decryption failed!" << '\n';
return false;
}

View file

@ -443,12 +443,10 @@ void WorldSocket::initEncryption(const std::vector<uint8_t>& sessionKey, uint32_
std::vector<uint8_t> encryptHash = auth::Crypto::hmacSHA1(encryptKey, sessionKey);
std::vector<uint8_t> decryptHash = auth::Crypto::hmacSHA1(decryptKey, sessionKey);
// lgtm [cpp/weak-cryptographic-algorithm]
// WoW WotLK world-header stream cipher is protocol-defined RC4.
// Replacing it would break interoperability with target servers.
encryptCipher.init(encryptHash);
// lgtm [cpp/weak-cryptographic-algorithm]
decryptCipher.init(decryptHash);
encryptCipher.init(encryptHash); // codeql[cpp/weak-cryptographic-algorithm]
decryptCipher.init(decryptHash); // codeql[cpp/weak-cryptographic-algorithm]
// Drop first 1024 bytes of keystream (WoW WotLK protocol requirement)
encryptCipher.drop(1024);