Skip to content

fix(tools): add logging filter to redact secrets from libtmux log output - #4871

Open
all-hands-bot wants to merge 1 commit into
mainfrom
fix/redact-libtmux-log-secrets
Open

fix(tools): add logging filter to redact secrets from libtmux log output#4871
all-hands-bot wants to merge 1 commit into
mainfrom
fix/redact-libtmux-log-secrets

Conversation

@all-hands-bot

@all-hands-bot all-hands-bot commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a SecretRedactFilter logging filter to the libtmux logger to prevent secrets from leaking in tmux command log output.

Problem

The libtmux library's tmux_cmd class logs the full tmux command string (including send-keys arguments) via logger.exception() / logger.error() when exceptions occur. When an agent sends a command containing API keys or other secrets through the terminal, those secrets appear unredacted in production stderr logs (observed in Datadog: prod-runtime/runtime-pods/runtime-*).

Fix

Install a logging filter on the libtmux logger during TmuxTerminal initialization that applies redact_api_key_literals() from openhands.sdk.utils.redact to log messages and extra fields before they're emitted.

Refs: OpenHands/evaluation#446, #383


This PR was created by an AI agent (OpenHands) on behalf of the security scan workflow.


🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:494251b-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-494251b-python \
  ghcr.io/openhands/agent-server:494251b-python

All tags pushed for this build

ghcr.io/openhands/agent-server:494251b-golang-amd64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-golang-amd64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-golang-amd64
ghcr.io/openhands/agent-server:494251b-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:494251b-golang-arm64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-golang-arm64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-golang-arm64
ghcr.io/openhands/agent-server:494251b-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:494251b-java-amd64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-java-amd64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-java-amd64
ghcr.io/openhands/agent-server:494251b-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:494251b-java-arm64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-java-arm64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-java-arm64
ghcr.io/openhands/agent-server:494251b-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:494251b-python-amd64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python-amd64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python-amd64
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:494251b-python-arm64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python-arm64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python-arm64
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:494251b-python-slim-amd64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python-slim-amd64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python-slim-amd64
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-slim-amd64
ghcr.io/openhands/agent-server:494251b-python-slim-arm64
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python-slim-arm64
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python-slim-arm64
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-slim-arm64
ghcr.io/openhands/agent-server:494251b-golang
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-golang
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-golang
ghcr.io/openhands/agent-server:494251b-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:494251b-java
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-java
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-java
ghcr.io/openhands/agent-server:494251b-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:494251b-python-slim
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python-slim
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python-slim
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-slim
ghcr.io/openhands/agent-server:494251b-python
ghcr.io/openhands/agent-server:494251badebd3e8baab31b7fd614451dd6c58c06-python
ghcr.io/openhands/agent-server:fix-redact-libtmux-log-secrets-python
ghcr.io/openhands/agent-server:494251b-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim

About Multi-Architecture Support

  • Each variant tag (e.g., 494251b-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 494251b-python-amd64) are also available if needed

The libtmux library logs full tmux command strings (including send-keys
arguments) to stderr when exceptions occur. This can leak API keys and
other secrets that agents send through the terminal.

Add a SecretRedactFilter to the libtmux logger that applies
redact_api_key_literals() from the SDK's redaction utilities to all
log messages before they are emitted.

Refs: OpenHands/evaluation#446

Co-authored-by: openhands <openhands@all-hands.dev>
@all-hands-bot

Copy link
Copy Markdown
Collaborator Author

👋 This PR needs a couple of things fixed before OpenHands can review it:

  • the PR description's HUMAN: section needs at least 20 characters describing what you tested, not just the template placeholder

Push an update once this is addressed and this check re-runs automatically.

This is an automated check - no AI was used to generate this comment.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-tools/openhands/tools/terminal/terminal
   tmux_terminal.py1229225%34–38, 42–43, 47–50, 92–94, 98–99, 103–105, 107, 110–111, 113–115, 117, 119, 121–123, 130–131, 135–136, 139–140, 145–149, 153, 156, 158–160, 164–169, 173–174, 190–191, 194, 197–199, 202–205, 209–211, 219–220, 222, 229, 241–242, 244–246, 254–261, 269–270, 272–273, 275, 277–279
TOTAL5981417530% 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants