Skip to content

Comments

[FS-736] ACME Create DPoP Access Token#2652

Merged
battermann merged 73 commits intodevelopfrom
SQSERVICES-1722-acme-be-create-dpop-access-token
Sep 28, 2022
Merged

[FS-736] ACME Create DPoP Access Token#2652
battermann merged 73 commits intodevelopfrom
SQSERVICES-1722-acme-be-create-dpop-access-token

Conversation

@battermann
Copy link
Contributor

@battermann battermann commented Aug 25, 2022

https://wearezeta.atlassian.net/browse/FS-736

Since this is just the "skeleton" implementation for this feature, and the rust library this feature depends on is not finished either, documentation, exhaustive tests, and release notes will be in a separate PR.

Checklist

  • The PR Title explains the impact of the change.
  • The PR description provides context as to why the change should occur and what the code contributes to that effect. This could also be a link to a JIRA ticket or a Github issue, if there is one.
  • If HTTP endpoint paths have been added or renamed, check docs/developer/adding-api-endpoints and follow the steps there.
  • If configuration options have been added or removed, check docs/developer/adding-config-options and follow the steps there.
  • I swear that if I have changed internal end-points, I do not implicitly rely on deployment ordering (brig needing to be deployed before galley), i.e. I have not introduced a new internal endpoint in brig and already make use of if in galley, as I'm aware old deployed galleys would throw 500s until all new version have been rolled out and I do not want a few minutes of downtime. Instead, I have thought how to merge brig an galley codebases.
  • I updated changelog.d subsections with one or more entries with the following bits of information (details)

@battermann battermann temporarily deployed to cachix August 25, 2022 15:03 Inactive
@battermann battermann temporarily deployed to cachix August 25, 2022 15:03 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 10:59 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 10:59 Inactive
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 26, 2022
@battermann battermann temporarily deployed to cachix August 26, 2022 11:29 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 11:29 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 11:35 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 11:35 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 11:38 Inactive
@battermann battermann temporarily deployed to cachix August 26, 2022 11:38 Inactive
@battermann battermann force-pushed the SQSERVICES-1722-acme-be-create-dpop-access-token branch from 6eb8d97 to 44309f1 Compare August 29, 2022 11:21
@battermann battermann temporarily deployed to cachix August 29, 2022 11:21 Inactive
@battermann battermann temporarily deployed to cachix August 29, 2022 11:21 Inactive
@battermann battermann temporarily deployed to cachix August 29, 2022 11:22 Inactive
@battermann battermann temporarily deployed to cachix August 29, 2022 11:22 Inactive
@battermann battermann temporarily deployed to cachix September 1, 2022 13:20 Inactive
@battermann battermann temporarily deployed to cachix September 1, 2022 13:20 Inactive
@battermann battermann temporarily deployed to cachix September 1, 2022 13:27 Inactive
@battermann battermann temporarily deployed to cachix September 1, 2022 13:27 Inactive
@battermann battermann force-pushed the SQSERVICES-1722-acme-be-create-dpop-access-token branch from f465672 to 501ef68 Compare September 5, 2022 14:46
@battermann battermann temporarily deployed to cachix September 5, 2022 14:46 Inactive
@battermann battermann temporarily deployed to cachix September 5, 2022 14:46 Inactive
@battermann battermann temporarily deployed to cachix September 6, 2022 11:43 Inactive
@battermann battermann temporarily deployed to cachix September 6, 2022 11:43 Inactive
@battermann battermann temporarily deployed to cachix September 6, 2022 13:03 Inactive
@battermann battermann temporarily deployed to cachix September 6, 2022 13:03 Inactive
@battermann battermann force-pushed the SQSERVICES-1722-acme-be-create-dpop-access-token branch from 6e4d7f6 to 95ff755 Compare September 7, 2022 10:59
@battermann battermann temporarily deployed to cachix September 28, 2022 09:05 Inactive
@battermann battermann temporarily deployed to cachix September 28, 2022 09:05 Inactive
@battermann battermann requested a review from fisx September 28, 2022 09:08
@battermann battermann temporarily deployed to cachix September 28, 2022 09:09 Inactive
@battermann battermann temporarily deployed to cachix September 28, 2022 09:09 Inactive
@fisx fisx temporarily deployed to cachix September 28, 2022 10:12 Inactive
@fisx fisx temporarily deployed to cachix September 28, 2022 10:12 Inactive
@fisx
Copy link
Contributor

fisx commented Sep 28, 2022

re 3226c9c: this isn't done, but it should show you what i want to do differently:

  • there should be one haskell enum type that maps all the error codes that can be returned from rust.
  • (what i haven't done yet) there should probably also some data SuperError = RustError DPoPTokenGenerationError | OtherSuperError | YetanotherSuperError, where DPoPTokenGenerationError is fully isomorphic to the rust number range (no collapsing of other errors into FfiError).
  • {from,to}Enum should be used instead of manual enumeration.

I don't insist on this change, but it revealed to me that the error types in haskell do not map to the errors in rust very cleanly, so at least that part I would like to see fixed.

This reverts commit 3226c9c.
@fisx fisx temporarily deployed to cachix September 28, 2022 10:27 Inactive
@fisx fisx temporarily deployed to cachix September 28, 2022 10:27 Inactive
Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

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

I've reverted my last commit to make this compile again. please cherry-pick it if you decide it's useful.

Also, more comments. :)

toCStr = liftIO . newCString . toStr
where
toStr :: a -> String
toStr = cs . toByteString'
Copy link
Contributor

Choose a reason for hiding this comment

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

newCString takes a String?! that's horrible. :')

but ok, then this is fine i suppose... you could have also left things inline and written (cs @ByteString @String) instead of cs.

fromUnion (Z (I ())) = Nothing
fromUnion (S (Z (I (DeletionCodeTimeout t)))) = Just t
fromUnion (S (S x)) = case x of {}
fromUnion (S (S x)) = case x of
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because x :: Void? can't you just skip this case, then? (it's nice to have it there explicitly, just trying to understand.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Annoyingly, this change was made by my code formatter, but it does not match the formatting that is expected on CI. I reverted the change.

@battermann battermann temporarily deployed to cachix September 28, 2022 12:10 Inactive
@battermann battermann temporarily deployed to cachix September 28, 2022 12:10 Inactive
@battermann battermann requested a review from fisx September 28, 2022 12:15
@fisx fisx temporarily deployed to cachix September 28, 2022 12:38 Inactive
@fisx fisx temporarily deployed to cachix September 28, 2022 12:38 Inactive
Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

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

I added two more commits and merged develop. Please take another look, but otherwise LGTM!

@battermann battermann merged commit 4ad1b44 into develop Sep 28, 2022
@battermann battermann deleted the SQSERVICES-1722-acme-be-create-dpop-access-token branch September 28, 2022 15:18

instance AsHeaders '[AssetLocation r] Asset (Asset, AssetLocation r) where
toHeaders (asset, loc) = (I loc :* Nil, asset)
fromHeaders (I loc :* Nil, asset) = (asset, loc)
Copy link
Member

Choose a reason for hiding this comment

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

What's the motivation for this removal that appears unrelated to this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this PR a generic version of this is introduced so this instance is obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants