Skip to content

[LOW] Invalidate cached ECDSA keys after point mutation - #25

Open
OskarEichler wants to merge 1 commit into
cedarcode:masterfrom
OskarEichler:codex/invalidate-mutated-ecdsa-key-cache
Open

[LOW] Invalidate cached ECDSA keys after point mutation#25
OskarEichler wants to merge 1 commit into
cedarcode:masterfrom
OskarEichler:codex/invalidate-mutated-ecdsa-key-cache

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Invalidate ECDSA::VerifyKey’s cached OpenSSL public-key wrapper after delegated in-place point mutations. Verification and serialization then use the key state exposed by the mutable point object.

Reproduction

After serialize or verify initializes @ec_key, calls such as invert! mutate the delegated EC point but leave subsequent serialization and verification on the old cached point. A verifier can therefore authenticate with a stale key while exposing a different current point to callers.

Verification

  • Focused model fails on master and confirms candidate serialization changes after point inversion
  • Existing suite: 31 examples, 0 failures on Ruby 4.0.6 through rbenv
  • The cumulative six-check model and RuboCop (20 files) pass
  • Unmutated verification keys retain the cached fast path; mutation methods preserve underlying return values
  • No repository tests or dependency files changed

Compatibility and breaking changes

Unmutated keys are unchanged. Code that mutates a verification point after warming its cache now verifies and serializes the mutated key instead of the stale pre-mutation key; relying on the stale behavior was unsafe.

@OskarEichler OskarEichler changed the title Invalidate cached ECDSA keys after point mutation [LOW] Invalidate cached ECDSA keys after point mutation Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant