Protect RCON diagnostics and redact player addresses (Refs #61)
This commit is contained in:
@@ -55,12 +55,12 @@ it('omits the fixed instance selector while keeping promoted/live distinction',
|
||||
expect(body).toContain('Live files and active betas may differ');
|
||||
});
|
||||
|
||||
function pageBody(tab: string) {
|
||||
(page as unknown as ReturnType<typeof writable>).set({ data: { user: { role: 'admin' } }, params: { name: 't5_zombie_theater_1' }, url: new URL(`http://localhost/servers/t5_zombie_theater_1?tab=${tab}&returnTo=%2F%3Ffilter%3Doccupied`) });
|
||||
function pageBody(tab: string, role = 'admin') {
|
||||
(page as unknown as ReturnType<typeof writable>).set({ data: { user: { role } }, params: { name: 't5_zombie_theater_1' }, url: new URL(`http://localhost/servers/t5_zombie_theater_1?tab=${tab}&returnTo=%2F%3Ffilter%3Doccupied`) });
|
||||
const telemetry = report();
|
||||
const server = { name: 't5_zombie_theater_1', game: 't5', map: 'zombie_theater', last_map: 'zombie_theater', health: 'online', last_players: 1,
|
||||
last_seen_at: telemetry.receivedAt, last_error: null, held: [], telemetry, status_source: 'telemetry', host_id: 'host-1', native_instance_id: 'instance-1',
|
||||
host: { name: 'ec-1', connected: true, lastHeartbeat: telemetry.receivedAt },
|
||||
host: { name: 'ec-1', connected: true, lastHeartbeat: telemetry.receivedAt }, replySnippet: 'legacy private reply 192.0.2.123:28960',
|
||||
rcon_status: { last_seen_at: null, last_error: 'timeout: no reply' }, game_started_at: null, game_ended_at: null, active_since: null, inactive_since: null };
|
||||
const data = { serverSnapshot: { servers: [server], operations: [], serverNow: get(uiNow), integrations: {}, reservedNames: [] } } as unknown as ComponentProps<typeof ServerPage>['data'];
|
||||
return render(ServerPage, { props: { data } }).body;
|
||||
@@ -83,6 +83,15 @@ it('reports RCON failures independently of fresh telemetry and defers the reques
|
||||
expect(body).toContain('Connection details');
|
||||
expect(body).not.toContain('Telemetry API requests');
|
||||
expect(body).not.toContain('>Healthy<');
|
||||
expect(body).toContain('Test connection');
|
||||
expect(body).not.toContain('legacy private reply');
|
||||
});
|
||||
|
||||
it('keeps connection summaries visible to viewers without raw diagnostics or probe controls', () => {
|
||||
const body = pageBody('diagnostics', 'viewer');
|
||||
expect(body).toContain('Game connection · RCON');
|
||||
expect(body).not.toContain('Test connection');
|
||||
expect(body).not.toContain('legacy private reply');
|
||||
});
|
||||
|
||||
it('uses the shared Activity view for server history', () => {
|
||||
|
||||
Reference in New Issue
Block a user