other
- Location
scripts/parse_gateway_logs.py:46- Finding
Undisclosed Inspection of Potentially Sensitive Gateway Message Content
- Content
View full analysis
Vulnerability Details
File Location:
scripts/parse_gateway_logs.py, lines 46-61 and 81-101
Vulnerability Type: Undisclosed sensitive gateway-log reconnaissance
Risk Level: MediumVulnerable Code
python # Gateway log directory LOG_DIR = Path("/tmp/openclaw") def get_gateway_logs(days: int = 1) -> list: """Get Gateway log content.""" logs = [] today = date.today() for i in range(days): log_date = today - timedelta(days=i) log_file = LOG_DIR / f"openclaw-{log_date.isoformat()}.log" if log_file.exists(): with open(log_file, 'r', encoding='utf-8') as f: logs.append(f.read()) return logspython def parse_gateway_logs(logs: list) -> dict: """Parse Gateway logs and extract Skill usage.""" skill_usage = defaultdict(lambda: { 'count': 0, 'total_chars': 0, 'examples': [] }) for log_content in logs: lines = log_content.split('\n') for line in lines: if '"type":"error"' in line or '"type":"warn"' in line: continue try: entry = json.loads(line) msg = entry.get('0', '') or entry.get('message', '') if isinstance(msg, str): skills = detect_skill_from_text(msg) for skill in skills: skill_usage[skill]['count'] += 1 skill_usage[skill]['total_chars'] += len(msg) if len(skill_usage[skill]['examples']) < 3: example = msg[:100].replace('\n', ' ') skill_usage[skill]['examples'].append(example) except: continueTechnical Analysis
The parser reads complete OpenClaw gateway log files and examines arbitrary message bodies to infer Skill usage from keywords. This is broader than consuming structured Skill invocation events and may expo ...[truncated 2417 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace message-body keyword detection with parsing of structured, explicitly defined Skill invocation metadata.
- Do not read arbitrary
messageor0fields unless the user has provided explicit, informed consent. - Remove the
examplesfield and message-excerpt collection because the excerpts are unused by the recording workflow. - Document
parse_gateway_logs.py, the exact files it accesses, the fields it processes, retention behavior, and associated privacy implications inSKILL.md. - Apply strict input controls, including maximum file sizes, maximum line lengths, accepted JSON schemas, and bounded processing windows.
- Process logs incrementally rather than loading complete files into memory.
- Restrict accepted log files to validated regular files under the intended directory and reject symbolic links where appropriate.
- Avoid broad exception handling; catch specific parsing and I/O exceptions and report malformed or unexpected records safely.
- Add a privacy-preserving mode that records only aggregate invocation counters and durations without retaining message content.
