Skip to content

drpc: add TLS certificate handling and metadata infra for auth interceptors #11

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shubhamdhama
Copy link

@shubhamdhama shubhamdhama commented Jul 15, 2025

This commit adds infrastructure needed for authentication interceptors:

  1. New drpcctx/tlscert.go: Functions to store/retrieve TLS peer certificates in context
  2. Server-side TLS certificate extraction in drpcserver
  3. Improved metadata API with ClearContext, ClearContextExcept, and GetValue functions
  4. Client-side per-RPC metadata support via WithPerRPCMetadata option

Also, see cockroachdb/cockroach#150225

@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch from 97cbff1 to 89afdcf Compare July 15, 2025 09:08
@shubhamdhama shubhamdhama changed the title drpc: add changes for auth interceptor changes drpc: add TLS certificate handling and metadata infra for auth interceptors Jul 16, 2025
@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch from 89afdcf to b297942 Compare July 16, 2025 07:39
@shubhamdhama shubhamdhama marked this pull request as ready for review July 16, 2025 07:56
@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch from 1082c70 to 3a4f5d1 Compare July 29, 2025 05:37
@cthumuluru-crdb cthumuluru-crdb requested a review from Copilot July 30, 2025 11:16
Copilot

This comment was marked as outdated.

Copy link

@cthumuluru-crdb cthumuluru-crdb left a comment

Choose a reason for hiding this comment

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

Left a few minor comments. Please take a look.

@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch 2 times, most recently from 86d94c4 to 3b188c3 Compare July 31, 2025 13:20
@shubhamdhama shubhamdhama requested review from Copilot and cthumuluru-crdb and removed request for Copilot July 31, 2025 13:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds TLS certificate handling and metadata infrastructure for authentication interceptors. It extracts TLS peer certificates on the server side and provides improved metadata APIs for managing per-RPC metadata in clients.

  • Adds TLS peer certificate extraction and context storage in server connections
  • Introduces new metadata utility functions for context manipulation (ClearContext, ClearContextExcept, GetValue)
  • Implements client-side per-RPC metadata support with WithPerRPCMetadata option

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
drpcserver/server.go Adds TLS certificate extraction and context storage during connection handling
drpcctx/tlscert.go New module providing TLS peer certificate context utilities
drpcmetadata/metadata.go Adds context clearing and value retrieval functions to metadata API
drpcclient/dialoptions.go Adds WithPerRPCMetadata dial option for client configuration
drpcclient/clientconn.go Implements per-RPC metadata injection in client calls

@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch from 3b188c3 to a2fbe6d Compare August 1, 2025 03:49
Copy link

@cthumuluru-crdb cthumuluru-crdb left a comment

Choose a reason for hiding this comment

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

I left some comments on the PR. Please feel free to take care of them in the followup PR.

…eptors

This commit adds infrastructure needed for authentication interceptors:

1. New drpcctx/tlscert.go: Functions to store/retrieve TLS peer certificates in context
2. Server-side TLS certificate extraction in drpcserver
3. Improved metadata API with ClearContext, ClearContextExcept, and GetValue functions
4. Client-side per-RPC metadata support via WithPerRPCMetadata option
@shubhamdhama shubhamdhama force-pushed the drpc/server-auth-interceptor branch from a2fbe6d to 4fd5c54 Compare August 1, 2025 10:35
Copy link

@cthumuluru-crdb cthumuluru-crdb left a comment

Choose a reason for hiding this comment

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

lgtm!

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