T05 · Unauthorized Access and Privilege Escalation
- Location
monitor.py:26- Finding
Undisclosed Access to Main-Agent Session Transcripts
- Content
View full analysis
Dict: """Parse session files to obtain model usage details for each session.""" session_stats = {} if not os.path.exists(SESSIONS_DIR): return session_stats try: session_files = [ f for f in os.listdir(SESSIONS_DIR) if f.endswith('.jsonl') ] except Exception: return session_stats for session_file in session_files[:20]: session_path = os.path.join(SESSIONS_DIR, session_file) session_key = session_file.replace('.jsonl', '') try: with open( session_path, 'r', encoding='utf-8', errors='ignore' ) as f: lines = f.readlines() msg_count = 0 models_used = set() last_model = None for line in lines[-100:]: try: data = json.loads(line) msg = data.get('message', {}) if msg.get('role') == 'assistant': msg_count += 1 metadata = data.get('metadata', {}) model = metadata.get('model') if model: short = extract_model_name(model) models_used.add(short) last_model = short except: continue if msg_count > 0: session_stats[session_key[:20]] = { "message_count": msg_count, "models_used": list(mo ...[truncated 2671 chars]- Remediation
View remediation
