Import shared proto types for identity and audit#114
Conversation
PR SummaryMedium Risk Overview Identity/tenant APIs now use Audit logging is refactored to emit and buffer CI/proto generation is updated to pull shared proto imports via symlinks, scope Reviewed by Cursor Bugbot for commit d7f1c6c. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
836ad5b to
a4bdccf
Compare
8631989 to
15a5493
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the spend limit has been reached. To enable Bugbot Autofix, have a team admin raise the spend limit in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 15a5493. Configure here.
internal/controlplane/connect.go
Outdated
| ), | ||
| ), | ||
| ) | ||
| connectHandler := s.newConnectHandler() |
There was a problem hiding this comment.
ConnectRPC endpoints lose rate limiting and security middleware
High Severity
The connectMuxHandler method previously wrapped the ConnectRPC handler with middleware.RealIP, s.rateLimiter.Middleware(), maxBodySize(10 * 1024 * 1024), and securityHeaders. This commit removes all four layers, so requests to /gate.v1.* ConnectRPC endpoints now bypass rate limiting, request body size limits (10 MB), client IP detection, and security response headers. The REST routes in s.router still have these protections, but all ConnectRPC endpoints are now unprotected. This appears unintentional — the PR is about importing shared proto types, and the old code's comment explicitly noted these middleware were needed for parity with REST routes.
Reviewed by Cursor Bugbot for commit 15a5493. Configure here.
Remove local Organization, OrgMember, APIKey message definitions from tenant.proto and import canonical types from identity/v1. Update all converter functions, clients, and tests. Closes #110 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swap hand-written Entry struct for auditv1.Event from shared proto. Sink interface accepts []*auditv1.Event. Logger methods construct proto events with nested Actor/Resource. Metadata field overwrite prevented by setting dedicated fields last. CI updated with shared proto symlinks for buf lint and tenant.proto excluded from buf breaking during migration. Closes #108 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restore RealIP + rate limiter + body size + security headers on ConnectRPC path (lost during rebase from pre-#113 branch) - Replace authReq with controlplaneclient.ApplyAuth (dedup from #113) - Replace OutgoingHeaders with ApplyAuth (dedup from #115) - withAuth delegates to ApplyAuth Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
15a5493 to
d7f1c6c
Compare
|
Addressed all Bugbot feedback in d7f1c6c (rebased on main to pick up #113 and #115):
|


Summary
Replaces Gate-local proto definitions and hand-written structs with canonical types from
evalops/proto. Rebased cleanly on main after #111 (ConnectRPC migration).Identity types (Closes #110)
Organization,OrgMember,APIKeyfromtenant.protoidentity.v1.Organization,identity.v1.Member,identity.v1.APIKeyfrom shared protoconnect_admin.go,http_bridge.go,controlplaneclient)Audit types (Closes #108)
audit.Entrywithauditv1.Eventfrom shared protoSinkinterface accepts[]*auditv1.EventconvertEntriesguards nil Timestamp, excludes extracted keys from DetailsStdoutSinkuses protojson and logs marshal errorsLogResponsezerolog line for consistencyTestConvertEntrieswith 4 casesNote: #109 (buf adoption) was already completed by #111.
Test plan
go test ./internal/audit/... ./internal/sync/... ./internal/controlplane/... ./internal/controlplaneclient/...— all passgo build ./...— compiles clean🤖 Generated with Claude Code