fix(security): 공개 /api/bots에서 민감 정보 제거

무인증 공개 엔드포인트가 봇 설정(채널/계정/필터)과 에러 내부정보
(errorMessage 등)를 그대로 노출하던 것을 상태 요약 필드만 반환하도록
화이트리스트. getBots() await 누락(잠재 버그)도 함께 수정.
관리자 화면은 인증된 /api/admin/bots 사용(영향 없음).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-06-07 15:40:42 +09:00
parent 6b66445295
commit e16d3f1230

View file

@ -122,13 +122,22 @@ export async function buildApp(opts = {}) {
return { status: 'ok', timestamp: nowKST() };
});
// 봇 상태 조회 엔드포인트
// 봇 상태 조회 엔드포인트 (공개)
// 민감한 설정(채널/계정/필터)·에러 내부정보는 제외하고 상태 요약만 노출.
// 관리자 화면은 인증된 /api/admin/bots를 사용한다.
fastify.get('/api/bots', async () => {
const bots = fastify.scheduler.getBots();
const bots = await fastify.scheduler.getBots();
const statuses = await Promise.all(
bots.map(async bot => {
const status = await fastify.scheduler.getStatus(bot.id);
return { ...bot, ...status };
return {
id: bot.id,
type: bot.type,
enabled: bot.enabled,
status: status.status,
lastCheckAt: status.lastCheckAt,
lastAddedCount: status.lastAddedCount,
};
})
);
return statuses;