Repository navigation
Reject temporary buffers in Unique_BIO constructors - #8628
Open
Max (maxtropets) wants to merge 4 commits into
Open
Max (maxtropets) wants to merge 4 commits into
Max (maxtropets) wants to merge 4 commits into
Conversation
Delete the rvalue overloads for std::vector<uint8_t> and Pem so that passing a temporary (including a std::string implicitly converted to a Pem) fails to compile instead of leaving the BIO over freed memory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
Prevents ccf::crypto::OpenSSL::Unique_BIO from being constructed from temporary buffers which would leave OpenSSL’s BIO viewing freed memory, and bumps the project version accordingly.
Changes:
- Deleted
Unique_BIOconstructors that accept rvaluestd::vector<uint8_t>/Pemto avoid dangling-pointer footguns. - Bumped Python package version to
7.0.23. - Added changelog entry describing the behavioral change.
| File | Description |
|---|---|
| python/pyproject.toml | Bumps the Python project version to match the release containing the constructor restriction. |
| include/ccf/crypto/openssl/openssl_wrappers.h | Deletes rvalue constructors for Unique_BIO to prevent temporaries from being passed. |
| CHANGELOG.md | Documents the change in Unique_BIO behavior in release notes for 7.0.23. |
Review effort: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines
+188
to
+189
| Unique_BIO(const std::vector<uint8_t>&&) = delete; | ||
| Unique_BIO(const Pem&&) = delete; |
This branch has not been deployed
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.


Unique_BIOcan take ownership of the raw memory released into it, but passing rvalue ref can (and almost always will) lead to dangling pointers. Removing those CTORs will prevent this footgun from happening.cpp Unique_BIO(const std::vector<uint8_t>&&) = delete; Unique_BIO(const Pem&&) = delete;