// SPDX-License-Identifier: GPL-3.0-or-later package fleet import "strings" // flagWeights is a copy of SEVERITY_BY_FLAG in the Security Hub triage script. Unknown flags weigh 1 and // `backup_failed:` weighs 3 (see FlagWeight). var flagWeights = map[string]int{ "auto_updates_not_enabled": 2, "boot_kernel_missing_modules": 4, "backup_stale": 3, "ci_runner_down": 3, "ci_runner_probe_stale": 2, "ci_runner_restart_loop": 3, "ci_runner_unregistered": 2, "ci_runner_wrong_server": 3, "collector_failed": 3, "compose_privileged_container": 3, "compose_restart_loop": 2, "compose_service_missing": 3, "compose_service_unhealthy": 3, "compose_unexpected_port": 3, "ctf_auto_restart_suppressed": 4, "ctf_auto_restarted": 2, "ctf_cpu_sustained": 3, "ctf_outbound_connections": 3, "ctf_process_unexpected": 3, "ctf_watch_stale": 2, "disk_space_critical": 5, "dpkg_interrupted": 4, "disk_space_low": 2, "edr_backend_degraded": 2, "edr_daemon_down": 3, "edr_finding_critical": 4, "edr_finding_high": 3, "edr_rules_stale": 2, "extra_uid0_accounts_present": 5, "fail2ban_missing_or_inactive": 3, "firewall_not_detected": 4, "forgejo_snapshot_stale": 3, "forgejo_status_stale": 2, "forgejo_timer_disabled": 2, "forgejo_update_failed": 3, "kernel_held_for_module": 1, "known_exploited_vulnerable_package": 5, "nopasswd_sudo_present": 5, "reboot_deferred_long": 2, "security_updates_pending": 3, "ssh_password_auth_enabled": 4, "ssh_root_login_not_disabled": 4, "third_party_updates_pending": 3, "tls_cert_expiring": 3, "updates_kept_back": 2, "vulnerability_coverage_incomplete": 2, "vulnerable_package_detected": 4, } // FlagWeight returns the severity weight of a flag. func FlagWeight(flag string) int { if w, ok := flagWeights[flag]; ok { return w } if strings.HasPrefix(flag, "backup_failed:") { return 3 } return 1 }