T09 · Insecure Skill Coding Practices
- Location
scripts/obs_core.py:59- Finding
Raw Trace Telemetry Stored in an Insecure Shared Temporary Cache
- Content
View full analysis
Vulnerability Details
File Location:
scripts/obs_core.py, lines 59–60 and 104–113
Vulnerability Type: Insecure temporary storage and sensitive data exposure
Risk Level: MediumComplete Code Snippet
python def cache_dir(): return os.environ.get("AGENT_OBS_CACHE_DIR") or os.path.join( tempfile.gettempdir(), "agent_obs_cache") def cache_put(key_dict, data, stable=False): """Store a response atomically; prune the directory occasionally.""" if not cache_enabled(): return try: os.makedirs(cache_dir(), exist_ok=True) entry = {"v": 1, "ts": int(time.time()), "stable": stable, "key": key_dict, "data": data} path = _cache_path(key_dict) tmp = path + ".tmp" with open(tmp, "w", encoding="utf-8") as fh: json.dump(entry, fh, ensure_ascii=False) os.replace(tmp, path)Technical Analysis
When
AGENT_OBS_CACHE_DIRis not configured, the Skill stores cached cloud responses in the predictable shared temporary directoryagent_obs_cacheunder the system temporary directory, normally/tmp/agent_obs_cache.The directory and files are created without explicit restrictive permissions. Their effective permissions therefore depend on the process umask. The implementation also does not verify that the cache directory is owned by the current user, is not a symbolic link, or was not pre-created by another local user.
Raw responses from authenticated CMS and SLS requests are passed into this cache. These responses can contain enterprise trace attributes, conversation excerpts, tool arguments, tool results, infrastructure metadata, and secrets accidentally recorded in telemetry. Redaction performed during report rendering does not protect the raw cache.
Historical windows marked as stable do not expire, increasing the duration of exposure.
Trigger conditions:
- Caching is enabled, which is the default.
AGENT_OBS_CACHE_DIRis unset ...[truncated 2293 chars]
- Remediation
View remediation
Remediation Suggestions
- Use a private per-user cache directory, such as an application directory under the user's home or XDG cache directory.
- Create the directory with mode
0700and verify that it is owned by the current effective UID. - Reject cache paths that are symbolic links or resolve to directories owned by another user.
- Create cache files with mode
0600, preferably usingos.open()withO_CREAT | O_EXCL | O_NOFOLLOWwhere supported. - Use uniquely named temporary files in the verified cache directory before performing an atomic replacement.
- Validate that a cache entry's stored key exactly matches the requested key before returning its data.
- Apply bounded retention to stable and recent cache entries rather than retaining stable-window responses indefinitely.
- Avoid caching message bodies, tool results, or other sensitive fields unless the user explicitly enables sensitive-data caching.
- Document the local retention behavior and provide a supported command or option to securely clear cached telemetry.
