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
|
||||
|
||||
Reference in New Issue
Block a user