Replies: 1 comment
-
Sounds good to me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
According to #5301
In order to better expand the permission management capabilities of Apollo Portal in the future, the existing Namespace-related permission management has been sorted out and integrated.
Describe the solution you'd like
Namespace权限模型梳理
前三个字段是限定了一个权限scope,范围从App到Env再到Cluster三级维度。
因为是针对Namespace的权限,所以Namespace字段是比较不同的,为空时代表指向当前scope下所有Namespace,否则指向所有名为传入值的Namespace。
考虑到向前兼容,兼容原有的 PermissionType ,原有的
AppId → Namespace
和AppId + Env → Namespace
两种权限模型的 PermissionType 都为ModifyNamespace/ReleaseNamespace
,包括原有的TargetId格式,都是不能修改的。Apollo的权限校验方式是这样的:
原有的两种权限模型的PermissionType是一样的,而在匹配需要的Permission的时候是要用Type+TargetId的,TargetId在Apollo中是用字符串拼接的方式生成的,中间用“+”号隔开,举个例子:
ModifyNamespace
-test20251228+application
ModifyNamespace
-test20251228+application+LOCAL
因为参数数量分别是两个和三个,当Type相同,TargetId不会起歧义,指向错误的目标。
但是后续的权限模型的Type不能再继续沿用这个TypeName了,因为还有其他三个参数的权限模型存在,比如说
AppId + Env + Cluster → *
这个模型。TargetId可能是
test20251228+LOCAL+PRO
,也就是**“LOCAL环境下的PRO集群”,这种情况下就会和“PRO环境下所有名为LOCAL的Namespace”**产生二义性,这在权限系统中是危险的,可能会出现越权行为。因此除了现有的两种存量权限模型,后续新增的Namespace权限模型,都需要有自己独特的PermissionType,以避免TargetId出现二义性问题。
整体架构
改动点
1. Annotation 入口
全部改为四个入参的方法
2. Api 入口
同步Namespace能力接口
原本逻辑:
改动逻辑:
思考 & 风险点 & 改进点
这样每次进行一次权限校验,可能会涉及到多次数据库IO,可能会成为性能瓶颈,后续可以改为一次查询,或引入一些缓存方案来解决。
Beta Was this translation helpful? Give feedback.
All reactions