Skip to main content

check_privileges

Validates the current process's user and group IDs to prevent privilege escalation, specifically checking for root access or membership in high-risk groups like 'sudo' or 'wheel'. It may raise a SecurityError or issue a warning if unsafe conditions are detected, especially when specific serialization formats are present in the accept_content parameter.

def check_privileges(
accept_content: string
) - > null

Validates the current process's user and group identities to prevent privilege escalation risks, especially when handling serialized data.

Parameters

NameTypeDescription
accept_contentstringA string containing the accepted content types, used to determine if potentially unsafe serialization formats like 'pickle' are being used.

Returns

TypeDescription
nullNothing; the function either returns silently if checks pass or triggers a security warning/exception if risks are detected.