Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Sep 12, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

byroot and others added 9 commits September 12, 2025 09:24
[Bug #21561]

It's preferable if the method is consistent in the encoding in
the returned string.
Strings created from the C API with a len but no ptr have a buffer allocated
and the length set, but the buffer is not zero'd. This causes use of uninitialized
memory and allows reading memory that previously existed there.

For example, the rb_str_tmp_new spec fails when we create a string with
a large length greater than 24 bytes (since we zero the first 24 bytes
of the slot).
Add tests covering edge cases in the current behavior to prevent
accidental regressions. The next patches will update the OpenSSL 3.x
path.

ruby/openssl@468f8ceea2
…t is needed

Specify OSSL_DECODER_CTX_set_pem_password_cb() only when we expect a
passphrase-protected private key.

OSSL_DECODER appears to try to decrypt every PEM block in the input even
when the PEM header does not match the requested selection. This can
cause repeated prompts for a passphrase in a single OpenSSL::PKey.read
call.

ruby/openssl@933503f49f
…L_DECODER

Continue processing only when OSSL_DECODER_from_bio() returns the error
code ERR_R_UNSUPPORTED. Otherwise, raise an exception without retrying
decoding the input in another format.

This fixes another case where OpenSSL::PKey.read prompts for a
passphrase multiple times when the input contains multiple
passphrase-protected PEM blocks and the first one cannot be decoded.

I am not entirely sure if the error code ERR_R_UNSUPPORTED is considered
part of the public interface of OpenSSL, but this seems to be the only
option available and is the approach used internally by the
PEM_read_bio_*() functions.

Fixes ruby/openssl#927

ruby/openssl@985ba27d63
@pull pull bot locked and limited conversation to collaborators Sep 12, 2025
@pull pull bot added the ⤵️ pull label Sep 12, 2025
@pull pull bot merged commit c082005 into turkdevops:master Sep 12, 2025
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants