cockroachdb / cockroachdb/cockroach
ua: Fix AuthZ in mixed mode setup during UA migration
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Is your feature request related to a problem? Please describe.**
While running UA migration experiments, we noticed AuthZ issues in mixed mode setup. Mixed mode setup here refers to some node treating tenant {1} as system tenant while other nodes in the cluster treating tenant {2} as system tenant.
We see two modes of failures:
1. When a node N1 running with tenant {1} as a system tenant makes an RPC call to other node N2 in the cluster that is running with tenant {2} as system tenant, N2 thinks tenant {1} is an application tenant and applies the access policies that apply to an application tenant.
2. When a node N1 running with tenant {2} as a system tenant makes an RPC call to other node N2 in the cluster that is running with tenant {1} as system tenant, N2 thinks tenant {2} is an application tenant and applies the access policies that apply to an application tenant.
**Describe the solution you'd like**
During migration we could use additional gRPC metadata to indicate the caller's view of system tenant. The serving node can use this metadata to determine if the calling tenant must be treated as system tenant or not. Upon receiving a signal that the migration is complete, the AuthZ will stop honoring additional metadata as part of the request.
**Describe alternatives you've considered**
Migration experiment currently uses an environment variable to signal using tenant {2} as system tenant. During migration we can treat both tenant {1} and tenant {2} as system tenants w.r.t AuthZ and fallback to normal behavior once the migration is complete. Without removing the use of environment variable, this would require a restart.
EPIC: https://cockroachlabs.atlassian.net/browse/CRDB-45181
Jira issue: CRDB-45182
Contributor guide
Assessment
This issue has not been assessed yet.