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

Update to actix-web 2.0 #71

Closed
2 tasks done
HeroicKatora opened this issue Dec 23, 2019 · 11 comments
Closed
2 tasks done

Update to actix-web 2.0 #71

HeroicKatora opened this issue Dec 23, 2019 · 11 comments
Labels
improvement Improve existing implementation

Comments

@HeroicKatora
Copy link
Owner

HeroicKatora commented Dec 23, 2019

Project Improvement

actix-web 2.x has some breaking changes and comes with support for standard futures.

Other context

See prior comments in #37. It also requires an update to ring to support v0.16.

Tracking pull request

@HeroicKatora HeroicKatora added the improvement Improve existing implementation label Dec 23, 2019
@gzp79
Copy link
Contributor

gzp79 commented Dec 28, 2019

The error handling part (ex Resource grant) looks awkward a little bit:

 {
        Ok(Ok(_grant)) => ...  // granted
        Ok(Err(Ok(e))) => ... // denied
        Ok(Err(Err(e))) => ... // "internal" error during grant (ResourceFlow)
        Err(e) => ... // "internal" error in handler ex. mailbox error
    }

edit: fixed using ? operator

@gzp79
Copy link
Contributor

gzp79 commented Jan 7, 2020

Is there anything that block the related PR to be merged back to main? (#72)
Or is it the ring dependency ?

@thespooler
Copy link
Contributor

thespooler commented Apr 9, 2020

Since #37 is closed and dicussion moved here, I'm also wondering about that.
The actix-web 2.0 update has been merged a few months ago (thanks @HeroicKatora).
Without bumping to ring 0.16.9, actix-identity and actix-session can't be used as they force actix-web/actix-http with feature session-cookie, wich requires 0.16.9.

Is there any path forward?

@HeroicKatora
Copy link
Owner Author

Yes, bite the bullet and replace ring with RustCrypto/* in the main crate, and create a oxide-auth-ring side crate with the ring-based code (which can then probably also be updated to a much newer version of ring).

@HeroicKatora
Copy link
Owner Author

HeroicKatora commented Apr 9, 2020

The question is whether it really is sensible (from a security standpoint) to provide all existing implementations of authorizer and issuer or to drop some from the main crate. The map-based implementations are fine without having to rely on any the security of any crypto implementation so one could say that the encrypting ones are only supplementary and could live in another optional crate. The registrar implementation is a slight concern but really, pbkdf2 is not exactly state-of-the-art in any case. (Edit: possibly go for argon2 with argonautica).

@thespooler
Copy link
Contributor

Quite the undertaking!
Why the side crate, is there really a hard dependency on someting from ring explicitly that doesn't have a RustCrypto equivalent? If so, could it really be decoupled from the main crate without introducing the same ring dependency, but one crate further? In other words, is it worth it? If we have an alternative, is keeping a ring impl something desirable?

As for replacing pbkdf2 with argon2, that seems easy enough.
I might try to start with that if it can help.

@HeroicKatora
Copy link
Owner Author

Between ring and RustCrypto there is a perceived difference in security. For example, ring puts great focus on making their interface misuse resistant. This has some security implications, despite RustCrypto being more efficient to write code in for new users 1. It would be disingenuous to interpret this as saying that RustCrypto's implementation being insecure but I tried to limit its use.

If so, could it really be decoupled from the main crate without introducing the same ring dependency, but one crate further?

That's what made me close #58 previously. The argument, however, was that it left some interface entirely without an implementation and the conclusion was to prioritize if the ecosystem were to split further. It certainly has. So the idea would be to ensure that some implementation of all traits exists in the main crate and the ring implementations are in the extra side crate. This structure would at least make it possible to use oxide-auth without ring.

As for replacing pbkdf2 with argon2, that seems easy enough.
I might try to start with that if it can help.

Yep, that would be great. The blocker last time I had looked at it were slightly immature Rust crates for it but I wasn't aware of argonautica back then.

Footnotes

  1. https://arxiv.org/pdf/1806.04929.pdf

@thespooler
Copy link
Contributor

thespooler commented Apr 9, 2020

Also, as discussed in #55, would you feel confident enough about rand to use its rand::CryptoRng?
Note that by default, it is just ThreadRng, wich is not Send+Sync.

@HeroicKatora
Copy link
Owner Author

Not really; given that it is a safe trait to implement, it is not sealed, and that its documentation explicitely states:

Note that this trait is provided for guidance only and cannot guarantee suitability for cryptographic applications.

However directly using a concrete implementor such as OsRng would be okay. Not so sure with ThreadRng.

@thespooler
Copy link
Contributor

thespooler commented Apr 9, 2020

It is guidance only yes. OsRng and StdRng implements it. It just means that as far as you can trust the lib author, it is deemed Crypto worthy. From what I can see, StdRnd is chacha20, and OsRng is whatever PRNG is available from the OS from getrandom.

But you're alright with me trying my hand with a PR for using rand as crypto provider?

@thespooler
Copy link
Contributor

With #85 #86 and #87 merged, oxide-auth should be able to be built alongside actix-web with actix-session and actix-identity.
I think this can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve existing implementation
Projects
None yet
Development

No branches or pull requests

3 participants