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

Issue #11560 - Implement EIP-4361 Sign-In With Ethereum #11883

Closed
wants to merge 21 commits into from

Conversation

lachlan-roberts
Copy link
Contributor

Issue #11560

Add new Jetty module called jetty-siwe, which implements EIP4361 Sign-In With Ethereum via the EthereumAuthenticator. This allows you to authenticate with a crypto wallet such as MetaMask.

See https://eips.ethereum.org/EIPS/eip-4361

@lachlan-roberts lachlan-roberts self-assigned this Jun 6, 2024
@lachlan-roberts
Copy link
Contributor Author

lachlan-roberts commented Jun 6, 2024

This is ready for early reviews as the implementation is complete.

To test this yourself you can install MetaMask browser extension and run org.eclipse.jetty.security.siwe.example.SignInWithEthereumEmbeddedExample.

TODOs:

  • Write Javadoc.
  • Add jetty-home module.
  • Add new section in the documentation.
  • Extract out the multipart changes to separate PR and use application/x-www-form-urlencoded instead.
  • Fix issues with module-info.java

lachlan-roberts added a commit that referenced this pull request Jun 7, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts lachlan-roberts requested review from gregw, sbordet and janbartel and removed request for gregw June 11, 2024 14:13
lachlan-roberts added a commit that referenced this pull request Jun 11, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit that referenced this pull request Jun 11, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Copy link
Contributor

@sbordet sbordet left a comment

Choose a reason for hiding this comment

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

Please don't use LOG.warn() especially if you can default the value.

Also, try to make all classes internal if possible, and leave exported only those that are strictly necessary.

If possible, make it asynchronous.
I would prefer to avoid that half-sent messages to block threads for the whole idle timeout.

lachlan-roberts added a commit that referenced this pull request Jun 19, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit that referenced this pull request Jun 19, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

Need to do some doco as part of this pr too ;)

lachlan-roberts added a commit that referenced this pull request Jun 20, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit that referenced this pull request Jun 20, 2024
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts lachlan-roberts force-pushed the jetty-12.0.x-SignInWithEthereum branch from 78403ec to 436ca41 Compare July 5, 2024 05:47
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@gregw
Copy link
Contributor

gregw commented Jul 8, 2024

@lachlan-roberts forced push????? what??!?!?!?!? Now I've lost all my review context! IMNSHO you should only ever force push when you've screwed up.... or put the other way, if I see a forced push I KNOW you've screwed up !)

We went looking everywhere, but couldn’t find those commits.
Sometimes commits can disappear after a force-push. Head back to the latest changes here.

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Mostly good, but the agro from the forced push is making me set a high bar for javadoc, formatting, naming and layout.!

lachlan-roberts and others added 3 commits July 8, 2024 16:21
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts lachlan-roberts marked this pull request as ready for review July 23, 2024 08:15
@SuppressWarnings("unchecked")
Set<String> attribute = (Set<String>)session.getAttribute(NONCE_SET_ATTR);
if (attribute == null)
session.setAttribute(NONCE_SET_ATTR, attribute = new FixedSizeSet<>(5));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the FixedSizeSet class? Isn't this just setting a single element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, but I've had issues with openId where multiple authentication requests come in from the browser and then one of them fails because the nonce is forgotten and causes the other ones to fail.

jetty-core/jetty-siwe/src/test/resources/login.html Outdated Show resolved Hide resolved
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>

= Jetty Security

TODO: introduction
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that TODO shown in the resulting documentation, or is it treated like a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shows the todo in the documentation, but the documentation is very incomplete and doesn't yet have any other security modules. And a bunch of the other main headers have the same TODOs for the introduction page.

But I will remove this index file and just have a header without an intro page for this.

gregw
gregw previously approved these changes Aug 21, 2024
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts
Copy link
Contributor Author

replaced by #12188

@lachlan-roberts lachlan-roberts deleted the jetty-12.0.x-SignInWithEthereum branch August 22, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants