T09 · Insecure Skill Coding Practices
- Location
scripts/ima_image_create.py:747- Finding
Sensitive generation data is persisted in operational logs
- Content
View full analysis
- Remediation
View remediation
str: parts = urlsplit(value) return urlunsplit((parts.scheme, parts.netloc, parts.path, "", "")) def redact_path(value: str) -> str: return os.path.basename(value) ``` 4. Ensure `extract_error_info()` and retry diagnostics retain structured, sanitized error fields rather than the original exception string. 5. Remove `error_info["message"]` from `attempt_log`, or replace it with a bounded and redacted error category. 6. Make verbose diagnostic logging opt-in rather than enabled by default. Keep production logs at a minimal level. 7. Create the log directory and files with restrictive permissions, such as directory mode `0700` and file mode `0600`, and verify permissions after handler creation. 8. Reduce retention where practical and provide a documented mechanism to disable file logging or immediately delete logs containing user content. 9. Add automated tests asserting that representative secrets, prompts, query parameters, local paths, and image URLs never appear in log output during failed requests and exhausted retries. ]]>
