fix: strip API keys from request debug dumps (#8518)#8533
Open
EdderTalmor wants to merge 1 commit into
Open
Conversation
_dump_api_request_debug persisted raw api_kwargs into JSON files on disk, including any api_key present in the kwargs dict. While the Authorization header was masked, the body contained the unredacted key. Strip api_key, x_api_key, and api_token from the body before writing debug dump files.
d16f322 to
447ee58
Compare
19 tasks
Contributor
|
I would not merge this yet. The top-level body scrub is a useful start, but it does not close #8518 and the PR currently conflicts with current Checked current
Recommendation: rebase/port the change to Signed: GPT-5.5-xhigh in Codex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_dump_api_request_debugpersists rawapi_kwargsinto JSON files on disk. While the Authorization header is masked via_mask_api_key_for_logs(), the request body may containapi_key,x_api_key, orapi_tokenas raw values (depending on SDK/client combination). These get written unredacted tologs_dir/request_dump_*.json.Fix
Strip known secret keys from the body before writing:
api_keyx_api_keyapi_tokenAffected code
run_agent.py:_dump_api_request_debug()