Do not log or persist API credentials; allow endpoint override - #4
Open
KTanmay1 wants to merge 1 commit into
Open
Do not log or persist API credentials; allow endpoint override#4KTanmay1 wants to merge 1 commit into
KTanmay1 wants to merge 1 commit into
Conversation
The agent currently writes the API key to stdout on every request and stores the live `Authorization: Bearer <key>` header in conversation_logs/*.json, which is the directory users attach to bug reports. It also hardcodes the API endpoint, so pointing the agent at a different provider requires editing source. - Log only the last four characters of the key. - Redact the Authorization header before writing conversation logs. - Read the endpoint from REPOTRANSBENCH_BASE_URL, defaulting to the current value so existing setups are unaffected. - Read keys from REPOTRANSBENCH_API_KEY (comma-separated) when set, otherwise from API_KEY.txt as before. - Raise a clear error when no key is configured. A blank or malformed API_KEY.txt previously failed with IndexError from line.split()[1]. No change to agent behaviour, prompts, or scoring.
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
RepoTransAgent/generator.pyexposes the API key in two places::93logs it verbatim on every request:self.logger.info(f"Using key: {self.api_key}")record_conversationwrites the liveAuthorization: Bearer <key>header intoconversation_logs/*.json— which is the directory a user would naturally attach to a bug reportThe endpoint is also hardcoded, so pointing the agent at a different provider means editing source.
Separately, a blank or malformed
API_KEY.txtfails withIndexErrorfromline.split()[1]rather than a message saying what is wrong. That is close to the startup confusion reported in #2.Changes
Authorizationheader before writing conversation logs.REPOTRANSBENCH_BASE_URL, defaulting to the current value so existing setups are unaffected.REPOTRANSBENCH_API_KEY(comma-separated, for the existing rotation behaviour) when set, otherwise fromAPI_KEY.txtexactly as before.Verification
Exercised all three paths locally: env-supplied keys rotate as before,
REPOTRANSBENCH_BASE_URLoverrides and strips a trailing slash, and an emptyAPI_KEY.txtnow reportsNo API key found. Set REPOTRANSBENCH_API_KEY, or add lines of the form "<name> <key>" to RepoTransAgent/API_KEY.txt.No change to agent behaviour, prompts, or scoring.