Protect RCON diagnostics and redact player addresses (Refs #61)
This commit is contained in:
@@ -357,6 +357,16 @@ export function db(): Database.Database {
|
||||
{ name: 'origin', ddl: "ALTER TABLE maintenance_jobs ADD COLUMN origin TEXT NOT NULL DEFAULT 'manual'" }
|
||||
]);
|
||||
migrateServers(handle);
|
||||
// Old snippets may contain player addresses, including hex-encoded bytes.
|
||||
// Discard them once; newly retained diagnostics are sanitized failure replies only.
|
||||
if (!handle.prepare("SELECT 1 FROM settings WHERE key='rcon_private_diagnostics_v1'").get()) {
|
||||
handle.transaction(() => {
|
||||
handle.exec(`UPDATE servers SET last_reply_snippet=NULL;
|
||||
UPDATE servers SET last_error='bad-reply:unparseable print reply'
|
||||
WHERE last_error LIKE 'bad-reply:print reply not recognized:%';
|
||||
INSERT INTO settings(key,value) VALUES('rcon_private_diagnostics_v1','1');`);
|
||||
})();
|
||||
}
|
||||
backfillDesiredState(handle);
|
||||
// Column additions must run BEFORE any statement that references the
|
||||
// new columns. schema.sql cannot include those references — see the
|
||||
|
||||
@@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS servers (
|
||||
last_seen_at TEXT, -- ISO ts of last successful RCON reply
|
||||
last_error TEXT, -- last RCON failure reason (cleared on success)
|
||||
rcon_failures INTEGER NOT NULL DEFAULT 0, -- consecutive monitoring failures, capped at two
|
||||
last_reply_snippet TEXT, -- hex+ASCII of last bad-reply UDP payload
|
||||
last_reply_snippet TEXT, -- sanitized failure diagnostics; operator-only
|
||||
-- Provisioning fields — set when Electric Cherry creates the deployment.
|
||||
game_mode TEXT, -- 'zombie' | 'mp' | 'sp' (currently zombie only)
|
||||
map_slug TEXT, -- 'cosmodrome' — short slug used in server name
|
||||
|
||||
Reference in New Issue
Block a user