Skip to content

hooks: Add support for gRPC mTLS #1114

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

Merged
merged 7 commits into from
Sep 18, 2024

Conversation

TaridaGeorge
Copy link
Contributor

@TaridaGeorge TaridaGeorge commented Apr 17, 2024

This PR adds the following things:

  1. Add the Authorization Header to the gRPC OutgoingContext in order to make use of it directly from the gRPC headers.
  2. adds mTLS support for gRPC hook. grpc hook now have a hooks-grpc-secure flag
--hooks-grpc-secure=true
--hooks-grpc-server-tls-certificate=/home/user/tls.pem
--hooks-grpc-client-tls-certificate=/home/user/client.pem
--hooks-grpc-client-tls-key=/home/user/client_key.pem

@Acconut
Copy link
Member

Acconut commented Apr 17, 2024

Thank you for the PR! These two changes should probably go into two separate PRs as they are distinct from each other.

  1. Add the Authorization Header to the gRPC OutgoingContext in order to make use of it directly from the gRPC headers.

This should not be enabled by default as it allows a user to smuggle an arbitrary header value to the gRPC backend, which can have unintended consequences. Header forwarding should be an opt-in feature and even then be customizable to allow the administrator to select headers to be forwarded. Overall, I am thinking about an option that is similar to the -hooks-http-forward-headers flag that exists for HTTP hooks.

@Acconut Acconut changed the title Send Authorization Header to gRPC endpoint, adds gRPC mTLS support hooks: Add support for gRPC mTLS Sep 18, 2024
@Acconut
Copy link
Member

Acconut commented Sep 18, 2024

I took the liberty to remove the Authorization header from this PR to get this merged. I'll open a new PR for implementing header forwarding via an option.

Thank you for working on this!

@Acconut Acconut merged commit 061eb11 into tus:main Sep 18, 2024
7 checks passed
@Acconut
Copy link
Member

Acconut commented Sep 18, 2024

PR for forwarding headers: #1188

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