|
Server : LiteSpeed System : Linux srv107862549.host 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 User : malam2778 ( 1069) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /lib/python3/dist-packages/uaclient/api/u/pro/security/fix/_common/ |
Upload File : |
from typing import Optional
from uaclient import messages
from uaclient.security import FixStatus
def status_message(status, pocket_source: Optional[str] = None):
if status == "needed":
return messages.SECURITY_CVE_STATUS_NEEDED
elif status == "needs-triage":
return messages.SECURITY_CVE_STATUS_TRIAGE
elif status == "pending":
return messages.SECURITY_CVE_STATUS_PENDING
elif status in ("ignored", "deferred"):
return messages.SECURITY_CVE_STATUS_IGNORED
elif status == "DNE":
return messages.SECURITY_CVE_STATUS_DNE
elif status == "not-affected":
return messages.SECURITY_CVE_STATUS_NOT_AFFECTED
elif status == "released" and pocket_source:
return messages.SECURITY_FIX_RELEASE_STREAM.format(
fix_stream=pocket_source
)
return messages.SECURITY_CVE_STATUS_UNKNOWN.format(status=status)
def get_expected_overall_status(
current_fix_status: str, fix_status: str
) -> str:
if not current_fix_status:
return fix_status
if fix_status in (
FixStatus.SYSTEM_NON_VULNERABLE.value.msg,
FixStatus.SYSTEM_NOT_AFFECTED.value.msg,
):
if (
current_fix_status == FixStatus.SYSTEM_NOT_AFFECTED.value.msg
and current_fix_status != fix_status
):
return fix_status
else:
return current_fix_status
else:
# This means the system is still affected and we must
# priotize this as the global state
return fix_status