Back to Checks
Prowlerprowler-provider-chatgpt
Disabled ChatGPT service accounts have no unrevoked credentials
serviceaccount_disabled_has_no_active_credentials
Service: serviceaccountSeverity: medium
OfficialVerifiedPrivate
Categories:gen-aisecretsidentity-access
Resource Type:OpenAIServiceAccount
Each disabled service account is checked for credentials that are neither revoked nor expired.
Risk
Credentials left on a disabled account are forgotten secrets: if the account is enabled again, by mistake or by an attacker with admin rights, they work immediately.
Run this check with Prowler
Run in Prowler CloudRun
prowler chatgpt --checks serviceaccount_disabled_has_no_active_credentialsRecommendation
Revoke every credential of a service account when disabling it.
Check Code
from prowler.lib.check.models import Check
from prowler_provider_chatgpt.check_report import finding
from prowler_provider_chatgpt.services.serviceaccount.serviceaccount_client import serviceaccount_client
class serviceaccount_disabled_has_no_active_credentials(Check):
def execute(self):
findings = []
for account in serviceaccount_client.service_accounts or []:
if account["enabled"] or account["active_credentials"] is None:
continue
names = [c["name"] for c in account["active_credentials"]]
if names:
text = f"Disabled service account {account['name']} keeps unrevoked credentials: {', '.join(names)}."
else:
text = f"Disabled service account {account['name']} has no unrevoked credentials."
findings.append(finding(self.metadata(), account, not names, text))
return findings