Back to Checks
Prowlerprowler-provider-claude
All active Claude Compliance API keys carry only approved scopes
audit_compliance_key_least_privilege
Service: auditSeverity: medium
OfficialVerifiedPrivate
Categories:gen-ailoggingforensics-ready
Resource Type:ClaudeOrganizationSettings
Compliance API keys carry only approved scopes. The content and session scopes read conversations and transcripts, so a reporting key that carries them reads far more than it needs.
Risk
The content and session scopes read conversations and transcripts, so a reporting key that carries them reads far more than it needs.
Run this check with Prowler
Run in Prowler CloudRun
prowler claude --checks audit_compliance_key_least_privilegeRecommendation
Recreate keys with the narrowest scope set, and list the scopes you permit in claude_allowed_compliance_scopes.
Remediation
Other
1Recreate keys with the narrowest scope set, and list the scopes you permit in claude_allowed_compliance_scopes.
Check Code
from prowler.lib.check.models import Check
from prowler_provider_claude.lib.report import CheckReportClaude
from prowler_provider_claude.services.audit.audit_client import audit_client
DEFAULT_ALLOWED_SCOPES = [
"read:compliance_activities",
"read:compliance_org_data",
"read:compliance_user_data",
]
class audit_compliance_key_least_privilege(Check):
"""Compliance API keys carry only approved scopes."""
def execute(self) -> list[CheckReportClaude]:
allowed = set(
audit_client.audit_config.get(
"claude_allowed_compliance_scopes", DEFAULT_ALLOWED_SCOPES
)
)
findings = []
for settings in audit_client.settings:
active = [k for k in settings.compliance_api_keys if k.is_active]
if not active:
continue
org = settings.name.removesuffix(" effective settings")
offenders = []
for key in active:
extra = sorted(set(key.scopes) - allowed)
if extra:
offenders.append(f"{key.name or key.id} ({', '.join(extra)})")
report = CheckReportClaude(metadata=self.metadata(), resource=settings)
if offenders:
report.status = "FAIL"
report.status_extended = (
f"Organization {org} has Compliance API key(s) carrying scopes beyond the "
f"approved set: {'; '.join(offenders)}."
)
else:
report.status = "PASS"
report.status_extended = (
f"All {len(active)} active Compliance API key(s) for organization {org} "
"carry only approved scopes."
)
findings.append(report)
return findings