fix(authz): reserve role inheritance namespace
This commit is contained in:
@@ -16,6 +16,11 @@ export function defineAuthz<Subject = any, Resource = any>(
|
||||
const bindings = module.bindings ?? {};
|
||||
|
||||
for (const id of Object.keys(permissions)) {
|
||||
if (id.startsWith("role:")) {
|
||||
throw new Error(
|
||||
`WRN-AUTHZ-DECL: permission id '${id}' uses the reserved 'role:' prefix; role grants use 'role:<name>' for inheritance.`,
|
||||
);
|
||||
}
|
||||
if (id.includes("*")) {
|
||||
throw new Error(
|
||||
`WRN-AUTHZ-DECL: permission id '${id}' must not contain a wildcard; wildcards belong in roles.`,
|
||||
|
||||
Reference in New Issue
Block a user