Back to Checks
Prowlerprowler-provider-openai
OpenAI active mTLS certificates are not about to expire
organization_mtls_certificate_not_expiring
Service: organizationSeverity: low
OfficialVerifiedPrivate
Categories:gen-aiencryption
Resource Type:OpenAICertificate
Each uploaded mTLS client certificate that is active, at the organization level or in any project, is checked for an expiry more than certificate_expiry_warning_days (default 30) away. Inactive certificates are not reported.
Risk
When an active certificate expires, mutual TLS rejects every client presenting it. Teams under pressure to restore service often turn mTLS off rather than rotate.
Run this check with Prowler
Run in Prowler CloudRun
prowler openai --checks organization_mtls_certificate_not_expiringRecommendation
Upload and activate a renewed certificate, then deactivate the expiring one.
Check Code
import time
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,
)
from prowler_provider_openai.services.project.project_client import project_client
class organization_mtls_certificate_not_expiring(Check):
def execute(self):
certificates = organization_client.certificates
if certificates is None:
return []
days = organization_client.audit_config.get("certificate_expiry_warning_days", 30)
project_active = {
cert.get("id")
for items in (project_client.certificates or {}).values()
for cert in items
if cert.get("active")
}
now = time.time()
findings = []
for cert in certificates:
if not (cert.get("active") or cert.get("id") in project_active):
continue
expires_at = (cert.get("certificate_details") or {}).get("expires_at")
resource = {
"id": cert.get("id", ""),
"name": cert.get("name") or cert.get("id", ""),
"expires_at": expires_at,
}
if expires_at is None:
continue
left = (expires_at - now) / 86400
if left <= 0:
text = f"Certificate {resource['name']} is active and expired {int(-left)} days ago."
else:
text = f"Certificate {resource['name']} is active and expires in {int(left)} days."
findings.append(finding(self.metadata(), resource, left > days, text))
return findings