Skip to content

Commit a610dc7

Browse files
authored
Merge pull request #4 from companionintelligence/copilot/fix-security-issues
Fix critical HTTP server security vulnerabilities
2 parents 4f3a569 + c5b2e11 commit a610dc7

File tree

4 files changed

+249
-66
lines changed

4 files changed

+249
-66
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ Thumbs.db
4141
# Docker
4242
docker-compose.override.yml
4343
.pip-cache/
44+
45+
# Build artifacts
46+
build/

_codeql_detected_source_root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

src/config.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <string>
44
#include <cstdlib> // for getenv()
5+
#include <iostream> // for std::cerr
56

67
// Global configuration
78
const int PORT = 8080;
@@ -59,10 +60,18 @@ inline std::string get_pg_db() {
5960

6061
inline std::string get_pg_user() {
6162
const char* u = getenv("POSTGRES_USER");
62-
return u ? u : "jic";
63+
if (!u) {
64+
std::cerr << "WARNING: Using default database user. Set POSTGRES_USER environment variable for production." << std::endl;
65+
return "jic";
66+
}
67+
return u;
6368
}
6469

6570
inline std::string get_pg_password() {
6671
const char* p = getenv("POSTGRES_PASSWORD");
67-
return p ? p : "jic_password";
72+
if (!p) {
73+
std::cerr << "WARNING: Using default database password. Set POSTGRES_PASSWORD environment variable for production." << std::endl;
74+
return "jic_password";
75+
}
76+
return p;
6877
}

0 commit comments

Comments
 (0)