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

metadata API: Improve exception handling in Metadata.sign() #2309

Open
jku opened this issue Feb 25, 2023 · 0 comments
Open

metadata API: Improve exception handling in Metadata.sign() #2309

jku opened this issue Feb 25, 2023 · 0 comments
Assignees
Labels

Comments

@jku
Copy link
Member

jku commented Feb 25, 2023

Metadata.sign():

        try:
            signature = signer.sign(bytes_data)
        except Exception as e:
            raise UnsignedMetadataError("Problem signing the metadata") from e

The reason we're catching Exception is that we have no idea what kind of errors might happen in Signer.sign() -- as an example, what does a Google Cloud Authentication error look like?

However, we do have to improve this somehow, maybe just leave generic exception handling to the application (which was the other approach we considered IIRC): this current approach leads to e.g. this:

  • application signs with a HSMSigner, this leads to secret handler getting called "Please enter PIN:"
  • user decides they don't want to sign and presses ctrl-C
  • application sees UnsignedMetadataError -- the logical assumption is a PIN input error so application tries signing again "Please enter PIN:"
  • user is stuck without ability to exit without signing

I don't see reasonable ways to solve this within the application: Ctrl-C really should exit and not be a UnsignedMetadataError

@jku jku added the bug label Mar 16, 2023
@jku jku self-assigned this Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant