Skip to content

Reset the cached encoder when encoding changes - #510

Open
OskarEichler wants to merge 2 commits into
cedarcode:masterfrom
OskarEichler:audit/reset-cached-encoder
Open

Reset the cached encoder when encoding changes#510
OskarEichler wants to merge 2 commits into
cedarcode:masterfrom
OskarEichler:audit/reset-cached-encoder

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Configuration delegates encoder=, but RelyingParty has no writer. Changing encoding after first access also leaves the memoized encoder stale. This adds the intended writer and clears the cache from encoding=. Verified with the full 502-example suite, a focused behavior model, RuboCop, and syntax checks on Ruby 4.0 and Ruby 3.2.11.

@santiagorodriguez96 santiagorodriguez96 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @OskarEichler!

Out of curiosity, is this an issue you were hitting in a real app, or did you discover it from reading the code? Just to understand if this was impacting users or not.

@encoder ||= WebAuthn::Encoder.new(encoding)
end

attr_writer :encoder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Comment thread lib/webauthn/relying_party.rb Outdated
:acceptable_attestation_types,
:legacy_u2f_appid

attr_reader :encoding

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants