Back to Checks
Prowlerprowler-provider-openai
OpenAI organization roles match the reviewed baseline
organization_rbac_roles_match_baseline
Service: organizationSeverity: high
OfficialVerifiedPrivate
Categories:gen-aiidentity-access
Resource Type:OpenAIRole
Each organization role is checked: predefined OpenAI roles pass, and custom roles pass only when listed by name in allowed_custom_roles.
Risk
A custom role nobody reviewed can grant write or admin permissions that were never meant to exist.
Run this check with Prowler
Run in Prowler CloudRun
prowler openai --checks organization_rbac_roles_match_baselineRecommendation
Review each custom role's permissions, delete the ones not needed and list the approved ones in allowed_custom_roles.
Check Code
from prowler.lib.check.models import Check
from prowler_provider_openai.check_report import finding
from prowler_provider_openai.services.organization.organization_client import (
organization_client,
)
class organization_rbac_roles_match_baseline(Check):
def execute(self):
allowed = set(organization_client.audit_config.get("allowed_custom_roles") or [])
findings = []
for role in organization_client.roles or []:
resource = {
"id": role.get("id", ""),
"name": role.get("name") or role.get("id", ""),
"predefined_role": bool(role.get("predefined_role")),
"permissions": role.get("permissions") or [],
}
if resource["predefined_role"]:
text = f"Role {resource['name']} is a predefined OpenAI role."
findings.append(finding(self.metadata(), resource, True, text))
elif resource["name"] in allowed:
text = f"Custom role {resource['name']} is in the reviewed baseline."
findings.append(finding(self.metadata(), resource, True, text))
else:
text = (
f"Custom role {resource['name']} grants {len(resource['permissions'])} "
"permissions and is not in allowed_custom_roles."
)
findings.append(finding(self.metadata(), resource, False, text))
return findings