Split IPRulesService into IPRulesEnforcer and IPRulesService#11555
Split IPRulesService into IPRulesEnforcer and IPRulesService#11555iain-macdonald merged 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR splits the previous IPRulesService responsibilities into two components: an IPRulesEnforcer used on request/auth paths, and an IPRulesService used for IP rule CRUD/config management APIs.
Changes:
- Introduces
interfaces.IPRulesEnforcerand wires it into gRPC/HTTP interceptors and other auth-adjacent callsites. - Adds new enterprise packages
ip_rules_enforcer(enforcement + caching) andip_rules_service(CRUD/config + validation), with corresponding tests and BUILD targets. - Updates the enterprise server startup registration to register both components.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/rpc/interceptors/interceptors.go | Switches unary/stream IP auth interceptor to use GetIPRulesEnforcer() |
| server/http/interceptors/interceptors.go | Switches HTTP IP authorization middleware to use GetIPRulesEnforcer() |
| server/real_environment/real_environment.go | Adds storage + getters/setters for IPRulesEnforcer on RealEnv |
| server/interfaces/interfaces.go | Splits IPRulesService into IPRulesEnforcer + IPRulesService interfaces |
| server/environment/environment.go | Extends Env interface with GetIPRulesEnforcer() |
| server/buildbuddy_server/buildbuddy_server.go | Updates GetUser to consult IPRulesEnforcer for selected-group access |
| server/build_event_protocol/build_event_handler/build_event_handler.go | Uses IPRulesEnforcer for authenticated BEP requests |
| enterprise/server/ip_rules_enforcer/ip_rules_enforcer.go | New enforcement implementation (formerly part of iprules) |
| enterprise/server/ip_rules_enforcer/ip_rules_enforcer_test.go | New enforcer test coverage |
| enterprise/server/ip_rules_enforcer/BUILD | Bazel targets for enforcer |
| enterprise/server/ip_rules_service/ip_rules_service.go | New CRUD/config service which delegates lockout-checks to enforcer |
| enterprise/server/ip_rules_service/ip_rules_service_test.go | New service test coverage |
| enterprise/server/ip_rules_service/BUILD | Bazel targets for service |
| enterprise/server/cmd/server/main.go | Registers ip_rules_enforcer then ip_rules_service |
| enterprise/server/cmd/server/BUILD | Updates deps to new packages |
| enterprise/server/iprules/iprules.go | Removed (logic moved to the two new packages) |
| enterprise/server/iprules/iprules_test.go | Removed (tests moved/split accordingly) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
332700d to
1c43479
Compare
1c43479 to
149a156
Compare
|
Do they need to be split into separate packages? Can they co-exist in the |
149a156 to
eed2b8d
Compare
They could coexist in the |
eed2b8d to
2c022cf
Compare
Related issues: https://github.com/buildbuddy-io/buildbuddy-internal/issues/6797