{# Блок Распределение уязвимостей: HTML (flex) и PDF (table) #} {% macro stat_row(label, current, color_class, total, last=None, label_width='min-w-[168px]') %} {% set percent = (current / total * 100) | int if total > 0 else 0 %} {% set col_px = '236px' if '236' in label_width else '168px' %}

{{ label }}

{{ current }} {% if last is not none %} / {{ last }} {% endif %}

{% endmacro %} {% macro stat_row_pdf(label, current, color_class, total, last=None) %} {% set percent = (current / total * 100) | int if total > 0 else 0 %} {{ label }} {{ current }}{% if last is not none %} / {{ last }}{% endif %}
{% endmacro %} {% macro render_vulnerability_distribution(statistic, statistic_last_scan, is_pdf, title='Распределение уязвимостей') %} {% set total = statistic.finding_count if statistic.finding_count > 0 else 1 %}

{{ title }}

{% if is_pdf %}

Кол-во оценок (за период/за последнее сканирование)

{{ stat_row_pdf('Критическая', statistic.critical, 'bg-red', total, last=statistic_last_scan.critical if statistic_last_scan is not none else none) }} {{ stat_row_pdf('Высокая', statistic.high, 'bg-orange', total, last=statistic_last_scan.high if statistic_last_scan is not none else none) }} {{ stat_row_pdf('Средняя', statistic.medium, 'bg-yellow', total, last=statistic_last_scan.medium if statistic_last_scan is not none else none) }} {{ stat_row_pdf('Низкая', statistic.low, 'bg-green', total, last=statistic_last_scan.low if statistic_last_scan is not none else none) }} {{ stat_row_pdf('Потенциальная', statistic.info, 'bg-brand', total, last=statistic_last_scan.info if statistic_last_scan is not none else none) }} {{ stat_row_pdf('Неизвестная', statistic.unknown, 'bg-gray-700', total, last=statistic_last_scan.unknown if statistic_last_scan is not none else none) }}

Типы дефектов выбранной области

{{ stat_row_pdf('SAST', statistic.SAST, 'bg-violet', total) }} {{ stat_row_pdf('DAST', statistic.DAST, 'bg-violet', total) }} {{ stat_row_pdf('IAC', statistic.IAC, 'bg-violet', total) }} {{ stat_row_pdf('Секрет', statistic.SECRET, 'bg-violet', total) }} {{ stat_row_pdf('Опубликованный ресурс', statistic.ENDPOINT, 'bg-violet', total) }} {{ stat_row_pdf('Компонент', statistic.COMPONENT, 'bg-violet', total) }} {{ stat_row_pdf('Web fuzzing', statistic.WEB_FUZZING, 'bg-violet', total) }}
{% else %}

Количество дефектов выбранной области

{{ stat_row('Критическая', statistic.critical, 'bg-red', total, last=statistic_last_scan.critical if statistic_last_scan is not none else none) }} {{ stat_row('Высокая', statistic.high, 'bg-orange', total, last=statistic_last_scan.high if statistic_last_scan is not none else none) }} {{ stat_row('Средняя', statistic.medium, 'bg-yellow', total, last=statistic_last_scan.medium if statistic_last_scan is not none else none) }} {{ stat_row('Низкая', statistic.low, 'bg-green', total, last=statistic_last_scan.low if statistic_last_scan is not none else none) }} {{ stat_row('Потенциальная', statistic.info, 'bg-brand', total, last=statistic_last_scan.info if statistic_last_scan is not none else none) }} {{ stat_row('Неизвестная', statistic.unknown, 'bg-gray-700', total, last=statistic_last_scan.unknown if statistic_last_scan is not none else none) }}

Типы дефектов выбранной области

{{ stat_row('SAST', statistic.SAST, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('DAST', statistic.DAST, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('IAC', statistic.IAC, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('Секрет', statistic.SECRET, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('Опубликованный ресурс', statistic.ENDPOINT, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('Компонент', statistic.COMPONENT, 'bg-violet', total, label_width='min-w-[236px]') }} {{ stat_row('Web fuzzing', statistic.WEB_FUZZING, 'bg-violet', total, label_width='min-w-[236px]') }}
{% endif %}
{% endmacro %}