T09 · Insecure Skill Coding Practices
- Location
scripts/supervision/audit.py:82- Finding
Insufficient redaction and insecure storage of potentially sensitive audit data
- Content
View full analysis
Optional[str]: """Truncate args for audit log, stripping PII-prone values.""" if args is None: return None s = str(args) if len(s) > self.max_args_length: return s[:self.max_args_length] + "..." return s ``` ```python entry = AuditEntry( timestamp=time.time(), request_id=str(uuid.uuid4()), session_id=session_id, agent_id=agent_id, tool=tool, phase=phase, outcome=outcome, duration_ms=round(duration_ms, 2), tokens_used=tokens_used, estimated_cost_usd=round(estimated_cost_usd, 6), error=error, args_summary=self._truncate_args(args), metadata=metadata or {}, ) try: if self._should_rotate(): self._rotate() with open(self.audit_file, "a") as f: f.write(entry.to_json() + "\n") except IOError as e: logger.error(f"Failed to write audit log: {e}") ``` ```python crash_record = { "timestamp": now, "session_id": session_id, "task_name": task_name, "error": error, } state.crashes.append(crash_record) ``` ```python try: with open(self.state_file, "w") as f: json.dump(data, f, indent=2) except IOError as e: logger.error(f"Failed to save crash state: {e}") ``` ### Technical Analysis The audit logger states that argument processing strips PII-prone values, but `_truncate_args` only converts the supplied value to a string and limits its length. Truncation is not sanitization or redaction. Sensitive values appearing near the beginning of an argument—such as API keys, authorization headers, passwords, cookies, personal information, prompt content, or private file paths—remain i ...[truncated 2575 chars]- Remediation
View remediation
