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

acme.messages.OrderResource: Make roundtrippable through JSON #9617

Merged
merged 1 commit into from
Mar 21, 2023

Conversation

aglasgall
Copy link
Contributor

Right now if you to_json() an OrderResource and later deserialize it, the AuthorizationResource objects don't come back through the round-trip (they just get de-jsonified as frozendicts and worse, they can't even be passed to AuthorizationResource.from_json because frozendicts aren't dicts). In addition, the csr_pem field gets encoded as an array of integers, which definitely does not get de-jsonified into what we want.

Fix these by adding an encoder to authorizations and encoder and decoder to csr_pem.

Fixes #9615

Pull Request Checklist

  • The Certbot team has recently expressed interest in reviewing a PR for this. If not, this PR may be closed due our limited resources and need to prioritize how we spend them.
  • If the change being made is to a distributed component, edit the master section of certbot/CHANGELOG.md to include a description of the change being made.
  • Add or update any documentation as needed to support the changes in this PR.
  • Include your name in AUTHORS.md if you like.

Right now if you to_json() an `OrderResource` and later deserialize
it, the `AuthorizationResource` objects don't come back through the
round-trip (they just get de-jsonified as frozendicts and worse, they
can't even be passed to `AuthorizationResource.from_json` because
frozendicts aren't dicts). In addition, the `csr_pem` field gets
encoded as an array of integers, which definitely does not get
de-jsonified into what we want.

Fix these by adding an encoder to `authorizations` and encoder and
decoder to `csr_pem`.
@bmw bmw self-assigned this Mar 20, 2023
Copy link
Member

@bmw bmw left a comment

Choose a reason for hiding this comment

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

This looks great. Thanks again!

@bmw bmw merged commit 5d5dc42 into certbot:master Mar 21, 2023
@bmw bmw added this to the 2.5.0 milestone Mar 21, 2023
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.

acme: acme.messages.OrderResource cannot be roundtripped through JSON (patch available)
2 participants