Keep co-op's private settings out of the log and out of bug reports.

This line logs every setting nx2navi.ini sets, and a bug report takes a copy of nx2navi.ini along: with co-op both would have carried a room's secret, the relay's address and the player's name to whoever reads the report, and the secret lets anyone into the room. One list (runtime/cfg_private.h: the room's secret, the offer number, the relay, the name, the key a maker removes, the menu's test hook) now serves the log's line, "Copy system info" and the report's copy of the file, in the game and in the launcher: such a key reads "(set, not shown)", every other byte of the file stays.

Also: the last leftovers of the restorations that were left out with the puppets (their settings prefix and section), main.c's byte order mark as it was, and two comments that cited files this tree does not have.

Checked: with a room, a relay and a name in nx2navi.ini the log's line shows all three as set and none of their values; the same text gives the same bytes through the game's scrub and the launcher's (a launcher test, and the C function built alone); the launcher tests, the co-op probe, the relay tests and the tab check pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 00:20:22 -05:00
parent 7e07e13bac
commit ba9d6bac06
10 changed files with 151 additions and 27 deletions

View File

@@ -13,6 +13,7 @@
#include <string.h>
#include <time.h>
#include "cfg_private.h"
#include "folder_pick.h"
#include "fs.h"
#include "host.h"
@@ -118,6 +119,19 @@ static void add_file(Export *e, const char *name, const char *path) {
free(data);
}
// nx2navi.ini for a bug report: as it is, except that the values of the private settings (cfg_private.h: a co-op
// room's secret, the relay, the player's name) read "(set, not shown)". A report goes to people the player does not
// know, and the secret lets anyone into the room.
static void add_settings_file(Export *e, const char *name, const char *path) {
uint64_t n = 0;
uint8_t *data = plat_file_read(path, &n);
size_t sn = 0;
char *scrubbed = data ? cfg_ini_scrub((const char *)data, (size_t)n, &sn) : NULL;
if (scrubbed) sz_writer_add(&e->w, name, scrubbed, sn);
free(scrubbed);
free(data);
}
SaveShareResult save_share_export(const char *dir, int bug_report, char *path, size_t cap) {
*path = 0;
struct tm t;
@@ -137,7 +151,7 @@ SaveShareResult save_share_export(const char *dir, int bug_report, char *path, s
add_file(&e, "bug-report/nx2navi.log", rt_log_path());
if (exe_dir(base, sizeof base)) {
snprintf(file, sizeof file, "%s/nx2navi.ini", base);
add_file(&e, "bug-report/nx2navi.ini", file);
add_settings_file(&e, "bug-report/nx2navi.ini", file);
}
}
struct tm u;