New to Claude Skills? Learn how to install them →

openai on GitHub

Sensitive Logging Audit

OfficialFree

Audit and fix sensitive data exposure in Python logging.

Get this skill

Free · Opens the source repo

What Sensitive Logging Audit does

The Sensitive Logging Audit skill is designed for developers working with the OpenAI Agents Python framework who need to ensure that sensitive data is not inadvertently logged during runtime. This skill provides a structured approach to identify potential leaks in logging outputs, including print statements, warnings, and exception messages, which may expose user data. By employing a systematic workflow, users can evaluate logging practices and apply necessary fixes to safeguard sensitive information.

The workflow begins with establishing a review surface by examining specific files within the OpenAI Agents repository. Users are guided to run collector tests and utilize scripts to identify candidate output sinks that may leak sensitive data. This initial step helps in gathering potential logging points that require closer inspection. The skill emphasizes the importance of manual classification of these paths to assess their sensitivity and determine the appropriate actions to take.

Once candidates are identified, users can delve deeper into the source code to trace the origins of logged data. This involves searching for specific logging functions and analyzing how data flows through the application. The skill encourages a thorough understanding of the codebase, as it does not automatically determine which paths are safe or unsafe. Instead, it empowers developers to make informed decisions based on their findings.

Finally, the skill supports the implementation of fixes at runtime boundaries, ensuring that sensitive data is redacted or omitted when necessary. By following the outlined steps, developers can validate their changes through testing, thus reinforcing the integrity of their logging practices. This skill is particularly useful for teams aiming to comply with data privacy regulations and maintain user trust by preventing data leaks in their applications.

When to use it

Use this skill when reviewing and auditing logging practices in OpenAI Agents Python projects, especially when handling user data.

When not to use it

This skill may not be suitable for applications that do not involve sensitive data or where logging practices are already well-established and compliant with privacy standards.

What you can build with it

Auditing Logging in a New Project

When starting a new project with OpenAI Agents, use this skill to establish secure logging practices from the outset.

Reviewing Legacy Code

If you inherit a legacy codebase, apply this skill to audit existing logging practices and identify potential sensitive data exposures.

Ensuring Compliance with Data Regulations

Use this skill to verify that your logging practices comply with data privacy regulations by auditing sensitive data handling.

How to install Sensitive Logging Audit

View source

1. Install with the skills CLI

npx skills add openai/openai-agents-python/sensitive-logging-audit --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by openai

Sensitive Logging Audit

Objective

Find candidate output sinks, trace their values manually, fix demonstrated leaks at shared runtime boundaries, and prove redaction with adversarial tests.

The collector is only a syntax-based search aid. It does not resolve Python aliases or control flow, certify policy guards, or prove that an absent candidate is safe.

Workflow

1. Establish the review surface

  • Work in the current checkout and preserve unrelated changes.
  • Read src/agents/_debug.py, src/agents/logger.py, and the affected callers.
  • Treat exception messages, arguments, tracebacks, causes, contexts, notes, names, URLs, and arbitrary values as potentially sensitive.
  • Read the Python redaction validation matrix.

Run the collector tests, then collect candidates:

uv run python .agents/skills/sensitive-logging-audit/scripts/test_inventory.py
uv run python .agents/skills/sensitive-logging-audit/scripts/inventory_logging.py \
  --format json --output /tmp/sensitive-logging-candidates.json

The report intentionally contains no policy, safe, or guard classification.

2. Supplement the collector with source search

The collector does not follow assignments such as emit = logger.error. Search the source directly and inspect aliases, callbacks, wrappers, and reflective dispatch:

rg -n '\.(debug|info|warning|warn|error|exception|critical|fatal|log)\b' src/agents
rg -n '\b(print|pprint|pp|warn|warn_explicit|write|writelines|print_exc|print_exception)\b' src/agents
rg -n 'DONT_LOG_(MODEL|TOOL)_DATA|log_(model|tool|model_and_tool)_action' src/agents

Do not turn collector coverage or a textual guard into a security conclusion. Trace producers and callers.

3. Classify manually

Assign each reviewed path one disposition:

  • model: model requests, responses, Realtime events, or derived values.
  • tool: tool arguments, outputs, MCP data, tool events, or derived values.
  • model+tool: either class may reach the sink.
  • operational: demonstrated to contain only non-sensitive SDK metadata.
  • intentional-output: explicitly user-facing output rather than diagnostics.
  • uncertain: source tracing is incomplete.

Record evidence in the audit report. The script does not validate or inherit dispositions.

4. Fix runtime boundaries

Before changing runtime behavior, use $implementation-strategy.

  • Check the relevant _debug.DONT_LOG_MODEL_DATA and _debug.DONT_LOG_TOOL_DATA flags before formatting or inspecting sensitive values.
  • Redact mixed model/tool values when either flag disables data logging.
  • In redacted mode, emit a fixed message and omit sensitive args, extra, and exc_info.
  • Build diagnostic-only context lazily so redacted mode never reads it.
  • Preserve useful diagnostics when sensitive-data logging is explicitly enabled.
  • Keep logging failure from changing fallback, cleanup, event, rejection, or cancellation behavior.
  • For MCP URLs, remove credentials, query parameters, and fragments in diagnostic mode; never use sanitized names as a substitute for fixed redacted messages.

5. Prove caller behavior

Add tests at every changed caller boundary. Inspect the complete LogRecord, not only rendered text. Test both redacted policies, diagnostic mode, hostile objects, exception chains, and the caller's observable fallback or cleanup behavior as applicable.

6. Re-run and close out

Re-run the collector, the manual searches, focused tests, and applicable repository gates. Use $code-change-verification for runtime or test changes and $pr-draft-summary when required.

Report candidate counts as search coverage only. Lead with confirmed leaks fixed, retained intentional output, reviewed uncertainty, and verification results. Never report a clean collector result as proof that no sensitive logging path exists.

Frequently asked questions about Sensitive Logging Audit

Similar skills