lwseverity

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

A package for Lacework severities

Index

Constants

View Source
const (
	// Unknown severity
	Unknown severity = iota
	// Critical severity
	Critical
	// High severity
	High
	// Medium severity
	Medium
	// Low severity
	Low
	// Informational severity
	Info
)

Variables

View Source
var ValidSeverities = validSeverities{Critical, High, Medium, Low, Info}

A list of valid Lacework severities (critical, high, medium, low, info)

Functions

func IsValid added in v1.0.0

func IsValid(s string) bool

Take a string representation of Lacework severity and return whether it properly maps to a valid severity (not unknown)

func NewSeverity

func NewSeverity(s string) severity

Initialize a severity from string

func Normalize

func Normalize(s string) (int, string)

Take a string representation of Lacework severity and return it's normalized integer and string values Critical Severity => 1, "Critical" High Severity => 2, "High" Medium Severity => 3, "Medium" Low Severity => 4, "Low" Informational Severity => 5, "Info" Unknown Severity => 0, "Unknown"

func NotAsCritical

func NotAsCritical(first, second string) bool

Returns true if the first severity not as critical as the second severity

For instance:

"info" is not as crtical as "low" (true) "medium" is as critical as "medium" (false) "high" is more critical than "medium" (false) "unknown" is more critical than "medium" (false) "medium" is not as critical as "unknown" (true)

func ShouldFilter

func ShouldFilter(severity, threshold string) bool

Returns true if the threshold is proper and the severity is greater than or equal to the threshold

For instance:

"medium" severity should be filtered for "high" threshold "critical" severity should NOT be filtered for "high" threshold "info" severity should NOT be filtered for "info" threshold invalid (unknown) severity should NOT be filtered for * threshold all severities should NOT be filtered for an invalid (unknown) threshold

func SortSlice

func SortSlice[S Severity](s []S)

Sort a slice of Severity interfaces from critical -> info

func SortSliceA

func SortSliceA[S Severity](s []S)

Sort a slice of Severity interfaces from info -> critical

Types

type Severity

type Severity interface {
	GetSeverity() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL