• Steven's avatar
    fix(backend): implement protocol-agnostic header setting for dual gRPC/Connect-RPC support · 3d893a73
    Steven authored
    Problem:
    The codebase supports both native gRPC and Connect-RPC protocols, but auth
    service was using grpc.SetHeader() which only works for native gRPC. This
    caused "failed to set grpc header" errors when using Connect-RPC clients
    (browsers using nice-grpc-web).
    
    Solution:
    - Created HeaderCarrier pattern for protocol-agnostic header setting
    - HeaderCarrier stores headers in context for Connect-RPC requests
    - Falls back to grpc.SetHeader for native gRPC requests
    - Updated auth service to use SetResponseHeader() instead of grpc.SetHeader()
    - Refactored Connect wrappers to use withHeaderCarrier() helper to eliminate
      code duplication
    
    Additional fixes:
    - Allow public methods when gRPC metadata is missing in ACL interceptor
    - Properly handle ParseSessionCookieValue errors instead of ignoring them
    - Fix buildSessionCookie to gracefully handle missing metadata
    
    Files changed:
    - server/router/api/v1/header_carrier.go: New protocol-agnostic header carrier
    - server/router/api/v1/auth_service.go: Use SetResponseHeader, handle missing metadata
    - server/router/api/v1/connect_services.go: Use withHeaderCarrier helper
    - server/router/api/v1/acl.go: Allow public methods without metadata
    - server/router/api/v1/connect_interceptors.go: Handle ParseSessionCookieValue errors
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    Co-Authored-By: 's avatarClaude Sonnet 4.5 <noreply@anthropic.com>
    3d893a73
Name
Last commit
Last update
.github Loading commit data...
cmd/memos Loading commit data...
internal Loading commit data...
plugin Loading commit data...
proto Loading commit data...
scripts Loading commit data...
server Loading commit data...
store Loading commit data...
web Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
.golangci.yaml Loading commit data...
CLAUDE.md Loading commit data...
CODEOWNERS Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
go.mod Loading commit data...
go.sum Loading commit data...