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

Add auth token to GRPC requests #236

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

neekolas
Copy link
Contributor

@neekolas neekolas commented Oct 16, 2024

tl;dr

  • Creates a client interceptor for attaching auth tokens to requests
  • Actually attaches JWTs to requests coming from the sync service

AI Generated Summary

Implemented node-to-node authentication using JWT tokens for secure communication between XMTP nodes.

What changed?

  • Added an AuthInterceptor for client-side gRPC calls to inject JWT tokens into request headers.
  • Updated the TokenFactory to use uint32 for node IDs instead of int32.
  • Modified the Registrant to include a TokenFactory.
  • Updated the syncWorker to use the new AuthInterceptor when connecting to other nodes.
  • Added a new constant NODE_AUTHORIZATION_HEADER_NAME for the authentication header.
  • Created mock implementations and tests for the new authentication system.

How to test?

  1. Run the existing test suite to ensure no regressions.
  2. Check the new test file pkg/interceptors/client/auth_test.go for specific tests of the authentication system.
  3. Manually test node-to-node communication to verify that authentication is working as expected.

Why make this change?

This change enhances the security of the XMTP network by implementing node-to-node authentication. It ensures that only authorized nodes can communicate with each other, preventing unauthorized access to sensitive data and operations. This is a crucial step in maintaining the integrity and confidentiality of the XMTP network.

Copy link
Contributor Author

neekolas commented Oct 16, 2024

@neekolas neekolas force-pushed the 10-16-add_auth_token_to_grpc_requests branch from 5b223b3 to a8dc2b7 Compare October 16, 2024 23:47
@neekolas neekolas marked this pull request as ready for review October 16, 2024 23:50
@neekolas neekolas requested a review from a team as a code owner October 16, 2024 23:50
Copy link
Contributor

@richardhuaaa richardhuaaa left a comment

Choose a reason for hiding this comment

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

Very clean

@neekolas neekolas force-pushed the 10-16-add_domain_separation_for_originator_signatures branch from 9657d8c to 5a4631f Compare October 17, 2024 23:05
@neekolas neekolas force-pushed the 10-16-add_auth_token_to_grpc_requests branch from a8dc2b7 to 3808b1d Compare October 17, 2024 23:05
Copy link
Contributor Author

neekolas commented Oct 18, 2024

Merge activity

  • Oct 17, 5:18 PM PDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 17, 5:25 PM PDT: Graphite couldn't merge this PR because it had conflicts with the trunk branch.
  • Oct 17, 5:35 PM PDT: A user merged this pull request with Graphite.

@neekolas neekolas force-pushed the 10-16-add_domain_separation_for_originator_signatures branch from 5a4631f to 93719d9 Compare October 18, 2024 00:22
Base automatically changed from 10-16-add_domain_separation_for_originator_signatures to main October 18, 2024 00:25
@neekolas neekolas force-pushed the 10-16-add_auth_token_to_grpc_requests branch from 3808b1d to 80fcbb5 Compare October 18, 2024 00:32
@neekolas neekolas merged commit d3fe5c1 into main Oct 18, 2024
7 checks passed
@neekolas neekolas deleted the 10-16-add_auth_token_to_grpc_requests branch October 18, 2024 00:35
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.

2 participants