Replace password string with proper class#2925
Merged
samuel40791765 merged 2 commits intoaws:mainfrom Jan 5, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2925 +/- ##
==========================================
+ Coverage 78.21% 78.22% +0.01%
==========================================
Files 690 690
Lines 118737 118733 -4
Branches 16679 16679
==========================================
+ Hits 92865 92875 +10
+ Misses 24983 24970 -13
+ Partials 889 888 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
09dcb21 to
0e1e430
Compare
tool-openssl/internal.h
Outdated
| Password& operator=(const Password& other) { | ||
| if (this != &other) { | ||
| secure_clear(); | ||
| data_ = other.data_; |
Contributor
There was a problem hiding this comment.
making a note, no change requested -- confirmed that std::string's assignment operator ensures that other.data_'s
value is either copied (1) or moved (5) if different from *this (if moved, str is left in an unspecified but valid state).
so no need to worry about duplicate ownership after this assignment
b82ed2d to
31ec5f3
Compare
WillChilds-Klein
approved these changes
Jan 5, 2026
31ec5f3 to
a068b58
Compare
justsmth
approved these changes
Jan 5, 2026
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.
The
bssl::UniquePtr<std::string>pattern that we're using for passwords in the CLI tool is a bit confusing. C++std::stringclass automatically manages its own memory.This was an attempt to manage the cleansing of passwords/secrets once they were out of scope, but the existing scheme forces the developer to have to remember to wrap Password strings with these pointers. Replacing the
bssl::UniquePtr<std::string>pattern with a proper Password class should enforce correct usage through stronger typing and make the code more readable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.