보안 리뷰 반영: 봇 중계 유저별 서버 · 채널 권한, 인증서 검증 우회 차단

봇 중계 권한 (앱 유저의 디스코드 아이디 기준)
- 서버 목록 · watch: 그 유저가 가입한 서버만. 아니면 watch_denied (명령 등록 · 멤버 목록도 거절)
- 채널 · 음성 상태: 그 유저가 볼 수 있는(ViewChannel) 채널만. 볼 수 없는 채널로 옮기면 "나감"으로 가린다
- 음성 참여 op 4: 그 유저가 들어갈 수 있는(ViewChannel + Connect) 음성채널만
- /녹음시작 은 그 음성채널에 들어갈 수 있는 유저의 PC 로만, 다른 PC 로 가는 명령에는 볼 수 없는 채널 이름을 넣지 않는다

인증서
- 사이트 서버 https/wss(로그인 · 기기 등록 · 봇 중계 · 기기 중계)는 Node 내장 Mozilla 루트만 믿고 검증을 항상 켠다 (core/util/secure-http.ts)
  NODE_TLS_REJECT_UNAUTHORIZED=0 · 시스템 인증서 저장소의 가짜 루트로 엿볼 수 없다
- 시작할 때 NODE_TLS_REJECT_UNAUTHORIZED 를 지운다 (Electron main · 헤드리스 코어). fuses 로 막히지 않는 변수
- win smoke: 내장 루트만으로 실서버 https 가 검증되는지 확인 (siteTls)

테스트: 봇 중계 권한 1건(가입하지 않은 서버 · 비공개 채널 · 연결 권한 없는 채널 · 명령), 자체 서명 서버 + 검증 끄기 변수 1건(대조군 포함)
login-e2e 친구 계정을 실제 F&L 멤버(테스트봇)로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 11:19:13 +09:00
parent b90a895501
commit 6721db23ac
14 changed files with 372 additions and 68 deletions

View File

@@ -7,11 +7,14 @@ import { AppAuth } from '../core/auth.js';
import { startCore, type Core } from '../core/index.js';
import { plainCodec, SettingsStore, type SecretCodec } from '../core/settings.js';
import { logger } from '../core/util/log.js';
import { hardenTlsEnv, secureFetch } from '../core/util/secure-http.js';
import { Finetuner } from './finetune.js';
import type { AuthView } from './api-types.js';
import { buildState, registerIpc } from './ipc.js';
import { brandDir, rendererDir, resolveDataDir, resourcesDir, workerCommand } from './paths.js';
// 인증서 검증을 끄는 환경변수(NODE_TLS_REJECT_UNAUTHORIZED=0)는 무시한다. fuses 로 막지 못하는 변수라 가장 먼저 지운다
hardenTlsEnv();
const log = logger('app');
const argv = process.argv.slice(1);
const flag = (name: string) => argv.includes(`--${name}`);
@@ -187,13 +190,18 @@ async function smoke(): Promise<void> {
out.bot = { status: c.bot.state.status, error: c.bot.state.error };
const botOk = a.status === 'signed_out' && !st.hasBuiltinBot && c.bot.state.status !== 'ready';
out.gpu = await c.worker.request('gpu_info', {}, 30000).catch((e) => String(e));
// 사이트 서버 https: 앱이 믿는 루트 인증서(Node 내장 Mozilla 목록)만으로 실제 서버 인증서가 검증되는지
out.siteTls = await secureFetch(`${c.settings.get().site.serverUrl}/healthz`, { timeoutMs: 20000 }).then(
(r) => r.ok,
(e) => String(e?.message ?? e),
);
c.settings.setSecret('riotApiKey', 'smoke-test');
out.secretRoundTrip = c.settings.getSecret('riotApiKey') === 'smoke-test';
c.settings.setSecret('riotApiKey', null);
out.dict = c.store.listDict().length;
out.renderer = fs.existsSync(path.join(rendererDir(), 'index.html'));
out.tray = fs.existsSync(path.join(brandDir(), 'tray.png'));
code = ready && botOk && out.secretRoundTrip && out.renderer && out.tray ? 0 : 1;
code = ready && botOk && out.secretRoundTrip && out.renderer && out.tray && out.siteTls === true ? 0 : 1;
await c.stop();
} catch (e: any) {
out.error = e.stack || e.message;