chore: limit API to only listen on localhost (#1740)

This commit is contained in:
Aaron Kimbrell 2025-01-25 20:47:12 -06:00 committed by GitHub
parent 306d959a83
commit 566791e647
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -150,11 +150,12 @@ ChatWebAPI::~ChatWebAPI() {
bool ChatWebAPI::Startup() {
// Make listen address
std::string listen_ip = Game::config->GetValue("web_server_listen_ip");
if (listen_ip == "localhost") listen_ip = "127.0.0.1";
// std::string listen_ip = Game::config->GetValue("web_server_listen_ip");
// if (listen_ip == "localhost") listen_ip = "127.0.0.1";
const std::string& listen_port = Game::config->GetValue("web_server_listen_port");
const std::string& listen_address = "http://" + listen_ip + ":" + listen_port;
// const std::string& listen_address = "http://" + listen_ip + ":" + listen_port;
const std::string& listen_address = "http://localhost:" + listen_port;
LOG("Starting web server on %s", listen_address.c_str());
// Create HTTP listener

View File

@ -9,5 +9,6 @@ max_number_of_friends=50
web_server_enabled=0
web_server_listen_ip=127.0.0.1
# Unused for now
# web_server_listen_ip=127.0.0.1
web_server_listen_port=2005