fix: 전체 시스템 감사 — 6건 수정 (보안 + 안정성)
Bug 1 (만료됨 스팸): Collector 시작 시 기존 pending skip Bug 2 (pending 미삭제): Gateway에서 response 소비 시 pending도 삭제 Bug 3 (재시작 중복): Bug 1로 해결 Security 1: API 요청 1MB 크기 제한 (client_max_size) Security 2: IP별 rate limiting (10 req/s) Security 3: _commands 메모리 누수 방지 (TTL 30분)
This commit is contained in:
@@ -38,10 +38,17 @@ class CollectorBridge:
|
||||
self.remote = remote
|
||||
self.project_name = project_name
|
||||
self.event_queue = event_queue
|
||||
self._forwarded_pending: set[str] = set() # already forwarded request IDs
|
||||
self._poll_interval = 3 # seconds
|
||||
self._running = False
|
||||
|
||||
# Pre-populate with existing pending files → skip on startup (prevents 만료됨 spam)
|
||||
self._forwarded_pending: set[str] = set()
|
||||
for fname in self.local.list_json_files("pending"):
|
||||
rid = fname.replace(".json", "")
|
||||
self._forwarded_pending.add(rid)
|
||||
if self._forwarded_pending:
|
||||
logger.info(f"[COLLECTOR] skipping {len(self._forwarded_pending)} existing pending files")
|
||||
|
||||
async def start(self):
|
||||
"""Start the Collector polling loops."""
|
||||
self._running = True
|
||||
|
||||
Reference in New Issue
Block a user