Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(H-Keyring): if getCache returns Error not EntryDoesNotExist, error #846

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

texastony
Copy link
Contributor

@texastony texastony commented Oct 10, 2024

Issue #, if available:

Description of changes:
The Cache querying logic in the H-Keyring confuses a cache miss
with an opaque error.

i.e: getCachOutput.Failure? is not always EntryDoesNotExist but could be something like Opaque(obj? := java.nio.BufferUnderflowException).

Thus, I suggest we refactor the methods that call the cache to differentiate b/w Opaque and EntryDoesNotExist.

For an explanation on why we should never catch and swallow all exceptions/errors,
see: https://stackoverflow.com/questions/2416316/why-is-the-catchexception-almost-always-a-bad-idea

Finally, the behavior of the H-Keyring is possibly better respected by such a change.
The H-Kerying's specification reads:

If a cache entry is not found or the cache entry is expired, the hierarchical keyring MUST attempt to obtain the branch key materials by querying the backing branch keystore specified in the retrieve OnEncrypt branch key materials section.

The specification does not say it MUST swallow all exceptions.

Squash/merge commit message, if applicable:
fix(H-Keyring): if getCache returns Opaque Error, return Opaque

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@texastony texastony marked this pull request as ready for review October 10, 2024 20:04
@texastony texastony requested a review from a team as a code owner October 10, 2024 20:04
Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

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

This is a bending change that we can not make to our customers.

Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

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

Given the number of people with custom caches that exist I'm ok.

However, we need to update put, and work out updating the DB-ESDK as well

@texastony texastony changed the title fix(H-Keyring): if getCache returns Opaque Error, return Opaque fix(H-Keyring): if getCache returns Error !EntryDoesNotExist, error Oct 11, 2024
@texastony texastony changed the title fix(H-Keyring): if getCache returns Error !EntryDoesNotExist, error fix(H-Keyring): if getCache returns Error not EntryDoesNotExist, error Oct 11, 2024
@texastony texastony merged commit 3413fcb into main Oct 11, 2024
95 checks passed
@texastony texastony deleted the tony/fix-get-cache-entry branch October 11, 2024 16:49
lucasmcdonald3 pushed a commit that referenced this pull request Oct 11, 2024
# [1.8.0](v1.7.0...v1.8.0) (2024-10-11)

### Bug Fixes

* **H-Keyring:** if getCache returns Error not EntryDoesNotExist, error ([#846](#846)) ([3413fcb](3413fcb))
* **Python:** Repolymorph to add orphaned shapes ([#831](#831)) ([2481dd8](2481dd8))

### Features

* Python MPL ([#805](#805)) ([cfb2f7e](cfb2f7e))
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