notifications

package
v0.0.371 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationBeforeUpdateContainerScanEvent = "beforeUpdateContainerScan"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedVulnerability added in v0.0.227

type AggregatedVulnerability struct {
	GUID             string           `json:"guid,omitempty" bson:"guid,omitempty"`
	NotificationType NotificationType `json:"notificationType,omitempty" bson:"notificationType,omitempty"`
	CVEID            string           `json:"cveID,omitempty" bson:"cveID,omitempty"`
	Severity         int              `json:"severity,omitempty" bson:"severity,omitempty"`
	SeverityName     string           `json:"severityName,omitempty" bson:"severityName,omitempty"`
	Cluster          string           `json:"cluster,omitempty" bson:"cluster,omitempty"`
	ClusterShortName string           `json:"clusterShortName,omitempty" bson:"clusterShortName,omitempty"`
	Namespace        string           `json:"namespace,omitempty" bson:"namespace,omitempty"`
	Workloads        []string         `json:"workloads,omitempty" bson:"workloads,omitempty"`
	Images           []string         `json:"images,omitempty" bson:"images,omitempty"`
	WLIDS            []string         `json:"wlids,omitempty" bson:"wlids,omitempty"`
	CVELink          string           `json:"cveLink,omitempty" bson:"cveLink,omitempty"`
	Fixable          bool             `json:"fixable" bson:"fixable"`
	Package          string           `json:"package,omitempty" bson:"package,omitempty"`
	FixVersion       string           `json:"fixVersion,omitempty" bson:"fixVersion,omitempty"`
	CreationTime     string           `json:"creationTime,omitempty" bson:"creationTime,omitempty"`
	UpdatedTime      string           `json:"updatedTime,omitempty" bson:"updatedTime,omitempty"`
}

AggregatedVulnerability represent a vulnerability event (new vulnerability or new fix) in a namespace

type AlertChannel

type AlertChannel struct {
	ChannelType             ChannelProvider `json:"channelType,omitempty" bson:"channelType,omitempty"`
	Scope                   []AlertScope    `json:"scope,omitempty" bson:"scope,omitempty"`
	CollaborationConfigGUID string          `json:"collaborationConfigId,omitempty" bson:"collaborationConfigId,omitempty"`
	Alerts                  []AlertConfig   `json:"notifications,omitempty" bson:"notifications,omitempty"`
}

func (*AlertChannel) AddAlertConfig

func (ac *AlertChannel) AddAlertConfig(config AlertConfig) error

func (*AlertChannel) GetAlertConfig

func (ac *AlertChannel) GetAlertConfig(notificationType NotificationType) *AlertConfig

func (*AlertChannel) IsEqualOrGreaterThanMinSeverity added in v0.0.355

func (ac *AlertChannel) IsEqualOrGreaterThanMinSeverity(severity int, notificationType NotificationType) bool

func (*AlertChannel) IsInScope

func (ac *AlertChannel) IsInScope(cluster, namespace string) bool

func (*AlertChannel) IsNotificationTypeEnabled added in v0.0.230

func (ac *AlertChannel) IsNotificationTypeEnabled(notificationType NotificationType) bool

type AlertChannelAPI added in v0.0.213

type AlertChannelAPI struct {
	// Channel connection definition
	// Example: webhook connection
	Channel CollaborationConfig `json:"channel"`

	// Notifications configurations
	// Example: new cluster admin
	Notifications []AlertConfig `json:"notifications"`

	// Scope selected clusters/namespaces
	// Example cluster123, [nspace1, nspace2]
	Scope []EnrichedScope `json:"scope"`
}

AlertChannelAPI An Alerting Channel configuration swagger:model AlertChannelAPI

func (*AlertChannelAPI) GetDomainScope added in v0.0.245

func (ac *AlertChannelAPI) GetDomainScope() []AlertScope

type AlertConfig

type AlertConfig struct {
	NotificationConfigIdentifier `json:",inline" bson:",inline"`
	Parameters                   NotificationParams `json:"parameters,omitempty" bson:"parameters,omitempty"`
	Disabled                     *bool              `json:"disabled,omitempty" bson:"disabled,omitempty"`
}

func (*AlertConfig) IsEnabled

func (ac *AlertConfig) IsEnabled() bool

type AlertScope

type AlertScope struct {
	Cluster    string   `json:"cluster,omitempty" bson:"cluster,omitempty"`
	Namespaces []string `json:"namespaces,omitempty" bson:"namespaces,omitempty"`
}

func (*AlertScope) IsInScope

func (ac *AlertScope) IsInScope(cluster, namespace string) bool

type ChannelProvider

type ChannelProvider string
const (
	CollaborationTypeJira  ChannelProvider = "jira"
	CollaborationTypeSlack ChannelProvider = "slack"
	CollaborationTypeTeams ChannelProvider = "teams"
	CollaborationTypeEmail ChannelProvider = "email"
)

type ClusterResourceScanned

type ClusterResourceScanned struct {
	ShortName       string          `json:"shortName" bson:"shortName"`
	Cluster         ResourceScanned `json:"cluster" bson:"cluster"`
	ReportGUID      string          `json:"reportGUID" bson:"reportGUID"`
	FailedResources uint64          `json:"failedResources" bson:"failedResources"`
}

type CollabAssignee

type CollabAssignee struct {

	//example: can be channelID(slack) "C02HD5MU9G8" and etc.
	AssgineeID string `json:"assigneeID"`

	//example: #abuse(slack)
	AssigneeName string `json:"assigneeName"`

	//put here properties of the assignee, ad
	AdditionalInfo []identifiers.ArmoContext `json:"additionalInfo"`
}

type CollaborationConfig

type CollaborationConfig struct {
	armotypes.PortalBase `json:",inline" bson:",inline"`

	// Provider name
	// Example: jira
	Provider ChannelProvider `json:"provider,omitempty" bson:"provider,omitempty"`

	// Host name for private hosting
	// Example: http://example.com
	HostName string `json:"hostName,omitempty" bson:"hostName,omitempty"`

	// The context of sharing (for example in jira it will be cloud, project, etc)
	Context map[string]CollaborationConfigOption `json:"context" bson:"context,omitempty"`

	// Icon url for the option. Optional
	// Example: https://site-admin-avatar-cdn.prod.public.atl-paas.net/avatars/240/triangle.png
	IconURL string `json:"iconURL,omitempty" bson:"iconURL,omitempty"`

	// Icon for the option encoded in base64. Optional
	IconBase64 string `json:"iconBase64,omitempty" bson:"iconBase64,omitempty"`

	CreationTime string `json:"creationTime,omitempty" bson:"creationTime,omitempty"`
}

swagger:model CollaborationConfig

type CollaborationConfigOption

type CollaborationConfigOption struct {
	// Type of the option
	// Example: Project
	Type *CollaborationConfigOptionType `json:"type,omitempty" bson:"type,omitempty"`

	// Name of the option
	// Example: jira-main-project
	Name string `json:"name" bson:"name,omitempty"`

	// ID of the option
	// Example: 8313c5a0-bee1-4a3c-8f4f-71ce698259876 or https://teams/mywebhook
	ID string `json:"id" bson:"id,omitempty"`

	// Icon url for the option. Optional
	// Example: https://site-admin-avatar-cdn.prod.public.atl-paas.net/avatars/240/triangle.png
	IconURL string `json:"iconURL,omitempty" bson:"iconURL,omitempty"`

	// Icon for the option encoded in base64. Optional
	IconBase64 string `json:"iconBase64,omitempty" bson:"iconBase64,omitempty"`
}

Collaboration provider config option swagger:model CollaborationConfigOption

type CollaborationConfigOptionType

type CollaborationConfigOptionType struct {
	// Name of the type
	// Example: project
	Name string `json:"name" bson:"name,omitempty"`

	// Indicates if this option is a mandatory for collaboration configuration
	// Example: false
	ConfigRequired bool `json:"required" bson:"required"`

	// Indicates if this option is a mandatory for sharing
	// Example: true
	ShareRequired bool `json:"-"`

	// Custom input available or not
	// Example: false
	CustomInput bool `json:"customInput" bson:"customInput"`
}

Config option type swagger:model CollaborationConfigOptionType

type EnrichedScope added in v0.0.245

type EnrichedScope struct {
	AlertScope       `json:",inline"`
	ClusterShortName string `json:"clusterShortName,omitempty"`
}

type EntitiesIdentifiers added in v0.0.371

type EntitiesIdentifiers []EntityIdentifiers

func (*EntitiesIdentifiers) ToMap added in v0.0.371

func (e *EntitiesIdentifiers) ToMap() []map[string]string

type EntityIdentifiers added in v0.0.371

type EntityIdentifiers struct {
	Type EntityType `json:"type,omitempty" bson:"type,omitempty"`

	Cluster  string `json:"cluster,omitempty" bson:"cluster,omitempty"`
	RepoHash string `json:"repoHash,omitempty" bson:"repoHash,omitempty"`

	Namespace    string `json:"namespace,omitempty" bson:"namespace,omitempty"`
	Name         string `json:"name,omitempty" bson:"name,omitempty"`
	Kind         string `json:"kind,omitempty" bson:"kind,omitempty"`
	ResourceHash string `json:"resourceHash,omitempty" bson:"resourceHash,omitempty"`
	ResourceID   string `json:"resourceID,omitempty" bson:"resourceID,omitempty"`

	CVEName          string `json:"cveName,omitempty" bson:"cveName,omitempty"`
	CVEID            string `json:"cveID,omitempty" bson:"cveID,omitempty"`
	Severity         string `json:"severity,omitempty" bson:"severity,omitempty"`
	SeverityScore    int    `json:"severityScore,omitempty" bson:"severityScore,omitempty"`
	Component        string `json:"component,omitempty" bson:"component,omitempty"`
	ComponentVersion string `json:"componentVersion,omitempty" bson:"componentVersion,omitempty"`

	ImageReposiotry string `json:"imageRepository,omitempty" bson:"imageRepository,omitempty"`
	LayerHash       string `json:"layerHash,omitempty" bson:"layerHash,omitempty"`

	ControlID string  `json:"controlID,omitempty" bson:"controlID,omitempty"`
	BaseScore float32 `json:"baseScore,omitempty" bson:"baseScore,omitempty"`
}

func (*EntityIdentifiers) ToMap added in v0.0.371

func (e *EntityIdentifiers) ToMap() map[string]string

func (*EntityIdentifiers) Validate added in v0.0.371

func (e *EntityIdentifiers) Validate() error

type EntityType added in v0.0.371

type EntityType string

EntityIdentifiers is a struct that holds the identifiers of an entity (hard typed designators)

const (
	EntityTypePostureResource       EntityType = "postureResource"
	EntityTypeRepositoryResource    EntityType = "repositoryResource"
	EntityTypeContainerScanWorkload EntityType = "containerScanWorkload"
	EntityTypeImage                 EntityType = "image"
	EntityTypeImageLayer            EntityType = "imageLayer"
	EntityTypeVulanrability         EntityType = "vulnerability"
	EntityTypeControl               EntityType = "control"
)

type IntegrationConnectionStatus added in v0.0.271

type IntegrationConnectionStatus string
const (
	Connected    IntegrationConnectionStatus = "connected"
	Disconnected IntegrationConnectionStatus = "disconnected"
)

type IntegrationReference added in v0.0.371

type IntegrationReference struct {
	armotypes.PortalBase `json:",inline" bson:"inline"`
	Provider             ChannelProvider     `json:"provider,omitempty" bson:"provider,omitempty"`             //integration provider (e.g jira, slack, teams)
	ProviderData         interface{}         `json:"providerData,omitempty" bson:"providerData,omitempty"`     //integration provider data (e.g jira ticket data)
	Type                 ReferenceType       `json:"type,omitempty" bson:"type,omitempty"`                     //type of the reference (e.g cve-ticket, slack-message etc)
	Owner                *EntityIdentifiers  `json:"owner,omitempty" bson:"owner,omitempty"`                   //owner identifiers of this reference (e.g resourceHash, wlid)
	RelatedObjects       EntitiesIdentifiers `json:"relatedObjects,omitempty" bson:"relatedObjects,omitempty"` //related entities identifiers of this reference (e.g cves, controls)
	CreationTime         time.Time           `json:"creationTime" bson:"creationTime"`                         //creation time of the reference
}

Referance to external integration (e.g link to jira ticket)

type IntegrationsConnectionStatus added in v0.0.271

type IntegrationsConnectionStatus struct {
	Provider ChannelProvider             `json:"provider"`
	Status   IntegrationConnectionStatus `json:"status"`
}

type Misconfiguration

type Misconfiguration struct {
	Name                      string
	FullName                  string
	Type                      ScanType
	Link                      string
	PercentageIncrease        uint64
	FrameworksComplianceDrift map[string]int
	PercentageThreshold       uint8
}

type Misconfigurations

type Misconfigurations []Misconfiguration

type NewClusterAdmin

type NewClusterAdmin struct {
	Resource          string
	Link              string
	ClusterName       string
	ClusterFullName   string
	ResourceName      string
	ResourceKind      string
	ResourceNamespace string
}

type NewClusterAdmins

type NewClusterAdmins []NewClusterAdmin

type NewSecurityIssue added in v0.0.353

type NewSecurityIssue struct {
	CustomerGUID         string                         `json:"customerGUID"`
	SecurityRiskID       string                         `json:"securityRiskID"`
	SecurityRiskName     string                         `json:"securityRiskName"`
	SecurityRiskSeverity string                         `json:"securityRiskSeverity"`
	SecurityRiskCategory string                         `json:"securityRiskCategory"`
	Resources            []identifiers.PortalDesignator `json:"resources"`
}

type NewSecurityIssues added in v0.0.353

type NewSecurityIssues []NewSecurityIssue

type NotificationConfigIdentifier

type NotificationConfigIdentifier struct {
	NotificationType NotificationType `json:"notificationType,omitempty" bson:"notificationType,omitempty"`
}

func (*NotificationConfigIdentifier) Validate

func (nci *NotificationConfigIdentifier) Validate() error

type NotificationParams

type NotificationParams struct {
	DriftPercentage *int `json:"driftPercentage,omitempty" bson:"driftPercentage,omitempty"`
	MinSeverity     *int `json:"minSeverity,omitempty" bson:"minSeverity,omitempty"`
}

func (*NotificationParams) SetDriftPercentage

func (ap *NotificationParams) SetDriftPercentage(percentage int)

func (*NotificationParams) SetMinSeverity

func (ap *NotificationParams) SetMinSeverity(severity int)

type NotificationPushEvent

type NotificationPushEvent struct {
	EventName   string                       `json:"eventName"`
	EventTime   time.Time                    `json:"eventTime"`
	Designators identifiers.PortalDesignator `json:"designators,omitempty"`
}

type NotificationType

type NotificationType string
const (
	NotificationTypeWeekly           NotificationType = "weekly"            //weekly report
	NotificationTypePush             NotificationType = "push"              //posture scan
	NotificationTypeContainerPush    NotificationType = "containerScanPush" //container scan
	NotificationTypeSecurityRiskPush NotificationType = "securityRiskPush"  //security risk

	NotificationTypeComplianceDrift     NotificationType = NotificationTypePush + ":complianceDrift"
	NotificationTypeNewClusterAdmin     NotificationType = NotificationTypePush + ":newClusterAdmin"
	NotificationTypeNewVulnerability    NotificationType = NotificationTypeContainerPush + ":newVulnerability"
	NotificationTypeVulnerabilityNewFix NotificationType = NotificationTypeContainerPush + ":vulnerabilityNewFix"

	NotificationTypeSecurityRiskNew NotificationType = NotificationTypeSecurityRiskPush + ":newSecurityRisk"
)

type NotificationsConfig

type NotificationsConfig struct {
	//Map of unsubscribed user id to notification config identifier
	UnsubscribedUsers  map[string][]NotificationConfigIdentifier `json:"unsubscribedUsers,omitempty" bson:"unsubscribedUsers,omitempty"`
	LatestWeeklyReport *WeeklyReport                             `json:"latestWeeklyReport,omitempty" bson:"latestWeeklyReport,omitempty"`
	LatestPushReports  map[string]*PushReport                    `json:"latestPushReports,omitempty" bson:"latestPushReports,omitempty"`
	AlertChannels      map[ChannelProvider][]AlertChannel        `json:"alertChannels,omitempty" bson:"alertChannels,omitempty"`
}

func (*NotificationsConfig) AddLatestPushReport

func (nc *NotificationsConfig) AddLatestPushReport(report *PushReport)

func (*NotificationsConfig) GetAlertChannelByCollaborationID added in v0.0.213

func (nc *NotificationsConfig) GetAlertChannelByCollaborationID(collaborationId string) (*AlertChannel, error)

func (*NotificationsConfig) GetAlertConfigurations

func (nc *NotificationsConfig) GetAlertConfigurations(notificationType NotificationType) []AlertConfig

func (*NotificationsConfig) GetAllChannels added in v0.0.228

func (nc *NotificationsConfig) GetAllChannels() []AlertChannel

func (*NotificationsConfig) GetLatestPushReport

func (nc *NotificationsConfig) GetLatestPushReport(cluster string, scanType ScanType) *PushReport

func (*NotificationsConfig) GetProviderChannels

func (nc *NotificationsConfig) GetProviderChannels(provider ChannelProvider) []AlertChannel

func (*NotificationsConfig) IsInScope

func (nc *NotificationsConfig) IsInScope(cluster, namespace string) bool

func (*NotificationsConfig) RemoveAlertChannel added in v0.0.213

func (nc *NotificationsConfig) RemoveAlertChannel(collaborationId string) error

func (*NotificationsConfig) RemoveProviderConfig added in v0.0.272

func (nc *NotificationsConfig) RemoveProviderConfig(provider ChannelProvider) error

type PushNotification

type PushNotification struct {
	Misconfigurations Misconfigurations
	NewClusterAdmins  NewClusterAdmins
}

type PushReport

type PushReport struct {
	Cluster                   string             `json:"custer,omitempty" bson:"custer,omitempty"`
	ReportGUID                string             `json:"reportGUID,omitempty" bson:"reportGUID,omitempty"`
	ScanType                  ScanType           `json:"scanType" bson:"scanType"`
	Timestamp                 time.Time          `json:"timestamp,omitempty" bson:"timestamp,omitempty"`
	FailedResources           uint64             `json:"failedResources,omitempty" bson:"failedResources,omitempty"`
	FrameworksComplianceScore map[string]float32 `json:"frameworksComplianceScore,omitempty" bson:"frameworksComplianceScore,omitempty"`
}

type ReferenceType added in v0.0.371

type ReferenceType string //type of the reference (e.g cve-ticket, slack-message etc)
const (
	//tickets types
	ReferenceTypeClusterControlTicket    ReferenceType = "ticket:cluster:control"
	ReferenceTypeRepositoryControlTicket ReferenceType = "ticket:repository:control"
	ReferenceTypeImageTicket             ReferenceType = "ticket:image"
	ReferenceTypeVulnerabilityTicket     ReferenceType = "ticket:vulnerability"
)

type RegistryScanned

type RegistryScanned struct {
	Registry ResourceScanned `json:"registry" bson:"registry"`
}

type RepositoryScanned

type RepositoryScanned struct {
	ReportGUID string          `json:"reportGUID" bson:"reportGUID"`
	Repository ResourceScanned `json:"repository" bson:"repository"`
}

type ResourceScanned

type ResourceScanned struct {
	Kind                         string                     `json:"kind" bson:"kind"`
	Name                         string                     `json:"name" bson:"name"`
	MapSeverityToSeverityDetails map[string]SeverityDetails `json:"mapSeverityToSeverityDetails" bson:"mapSeverityToSeverityDetails"`
}

type ScanType

type ScanType string
const (
	ScanTypePosture      ScanType = "posture"
	ScanTypeRepositories ScanType = "repository"
)

type SecurityIssuePushNotification added in v0.0.353

type SecurityIssuePushNotification struct {
	NewSecurityIssues NewSecurityIssues
}

type SeverityDetails

type SeverityDetails struct {
	Severity              string `json:"severity" bson:"severity"`
	FailedResourcesNumber int    `json:"failedResourcesNumber" bson:"failedResourcesNumber"`
}

type TopCtrlCluster

type TopCtrlCluster struct {
	Name               string `json:"name" bson:"name"`
	ResourcesCount     int64  `json:"resourcesCount" bson:"resourcesCount"`
	ReportGUID         string `json:"reportGUID" bson:"reportGUID"`
	TopFailedFramework string `json:"topFailedFramework" bson:"topFailedFramework"`
}

type TopCtrlItem

type TopCtrlItem struct {
	ControlID            string           `json:"id" bson:"id"`
	ControlGUID          string           `json:"guid" bson:"guid"`
	Name                 string           `json:"name" bson:"name"`
	Remediation          string           `json:"remediation" bson:"remediation"`
	Description          string           `json:"description" bson:"description"`
	ClustersCount        int64            `json:"clustersCount" bson:"clustersCount"`
	SeverityOverall      int64            `json:"severityOverall" bson:"severityOverall"`
	BaseScore            int64            `json:"baseScore" bson:"baseScore"`
	Clusters             []TopCtrlCluster `json:"clusters" bson:"clusters"`
	TotalFailedResources int64            `json:"-"`
}

func (*TopCtrlItem) GetTotalFailedResources

func (t *TopCtrlItem) GetTotalFailedResources() int64

func (*TopCtrlItem) NKeys added in v0.0.238

func (ert *TopCtrlItem) NKeys() int

NKeys --

func (*TopCtrlItem) UnmarshalJSONObject added in v0.0.238

func (ert *TopCtrlItem) UnmarshalJSONObject(dec *gojay.Decoder, key string) error

UnmarshalJSONObject --

type WeeklyReport

type WeeklyReport struct {
	ClustersScannedThisWeek             int                        `json:"clustersScannedThisWeek" bson:"clustersScannedThisWeek"`
	ClustersScannedPrevWeek             int                        `json:"clustersScannedPrevWeek" bson:"clustersScannedPrevWeek"`
	LinkToConfigurationScanningFiltered string                     `json:"linkToConfigurationScanningFiltered" bson:"linkToConfigurationScanningFiltered"`
	RepositoriesScannedThisWeek         int                        `json:"repositoriesScannedThisWeek" bson:"repositoriesScannedThisWeek"`
	RepositoriesScannedPrevWeek         int                        `json:"repositoriesScannedPrevWeek" bson:"repositoriesScannedPrevWeek"`
	LinkToRepositoriesScanningFiltered  string                     `json:"linkToRepositoriesScanningFiltered" bson:"linkToRepositoriesScanningFiltered"`
	RegistriesScannedThisWeek           int                        `json:"registriesScannedThisWeek" bson:"registriesScannedThisWeek"`
	RegistriesScannedPrevWeek           int                        `json:"registriesScannedPrevWeek" bson:"registriesScannedPrevWeek"`
	LinkToRegistriesScanningFiltered    string                     `json:"linkToRegistriesScanningFiltered" bson:"linkToRegistriesScanningFiltered"`
	Top5FailedControls                  []TopCtrlItem              `json:"top5FailedControls" bson:"top5FailedControls"`
	Top5FailedCVEs                      []containerscan.TopVulItem `json:"top5FailedCVEs" bson:"top5FailedCVEs"`
	ClustersScanned                     []ClusterResourceScanned   `json:"clustersScanned" bson:"clustersScanned"`
	RepositoriesScanned                 []RepositoryScanned        `json:"repositoriesScanned" bson:"repositoriesScanned"`
	RegistriesScanned                   []RegistryScanned          `json:"registriesScanned" bson:"registriesScanned"`
}

Jump to

Keyboard shortcuts

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