fix: strip ASCII control characters from API keys before saving (#55335) - #55406
Closed
Stoltemberg wants to merge 1 commit into
Closed
fix: strip ASCII control characters from API keys before saving (#55335)#55406Stoltemberg wants to merge 1 commit into
Stoltemberg wants to merge 1 commit into
Conversation
…Research#55335) save_env_value() only stripped \n and \r before writing credentials to ~/.hermes/.env. Other ASCII control bytes (NUL, TAB, DEL, etc.) could still be saved, causing ValueError on Windows when os.environ[key] = value is called with embedded null characters. Fix: strip all ASCII control characters (0x00-0x1F, 0x7F) except common whitespace (tab) before saving. Fixes NousResearch#55335.
Collaborator
Duplicate of #55336 — both add ASCII control-character stripping to |
Contributor
Author
|
Closing — duplicate detected by alt-glitch bot. Consolidating into earlier PRs. 🙏 |
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.
What does this PR do?
Fixes #55335 —
save_env_value()only stripped\nand\rbefore writing credentials to~/.hermes/.env. Other ASCII control characters (NUL, TAB, DEL, etc.) could still be saved, causingValueErroron Windows whenos.environ[key] = valueis called with embedded null characters.Related Issue
Fixes #55335
Type of Change
Changes Made
Added stripping of all ASCII control characters (0x00-0x1F, 0x7F) except common whitespace (tab) before saving API keys to the .env file.
How to Test
hermes auth addPlatforms Tested