notifications

package
v0.0.0-...-fbc5fc4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TriggerNotifications

func TriggerNotifications(notificationPlatforms []NotificationPlatform, data NotificationData) error

Types

type ConfigMonitoredValues

type ConfigMonitoredValues struct {
	// CertificateIdentities contains a list of subjects and issuers
	CertificateIdentities []identity.CertIdentityValue `yaml:"certIdentities"`
	// Fingerprints contains a list of key fingerprints. Values are as follows:
	// For keys, certificates, and minisign, hex-encoded SHA-256 digest
	// of the DER-encoded PKIX public key or certificate
	// For SSH and PGP, the standard for each ecosystem:
	// For SSH, unpadded base-64 encoded SHA-256 digest of the key
	// For PGP, hex-encoded SHA-1 digest of a key, which can be either
	// a primary key or subkey
	Fingerprints []string `yaml:"fingerprints"`
	// Subjects contains a list of subjects that are not specified in a
	// certificate, such as a SSH key or PGP key email address
	Subjects []string `yaml:"subjects"`
	// OIDMatchers represents a list of OID extension fields and associated values,
	// which includes those constructed directly, those supported by Fulcio, and any constructed via dot notation.
	// These OIDMatchers are parsed into one list of OID extensions and matching values before being passed into MatchedIndices.
	OIDMatchers extensions.OIDMatchers `yaml:"oidMatchers"`
}

ConfigMonitoredValues holds a set of values to compare against a given entry. ConfigMonitoredValues holds Object Identifier extensions and associated values that can be constructed either directly from asn1.ObjectIdentifier, via OID extensions supported by Fulcio, or via dot notation.

func (ConfigMonitoredValues) ToMonitoredValues

func (c ConfigMonitoredValues) ToMonitoredValues() (identity.MonitoredValues, error)

ToMonitoredValues converts ConfigMonitoredValues to identity.MonitoredValues. It renders OID matchers internally.

type EmailNotificationInput

type EmailNotificationInput struct {
	RecipientEmailAddress string        `yaml:"recipientEmailAddress"`
	SenderEmailAddress    string        `yaml:"senderEmailAddress"`
	SenderSMTPUsername    string        `yaml:"senderSMTPUsername"`
	SenderSMTPPassword    string        `yaml:"senderSMTPPassword"`
	SMTPHostURL           string        `yaml:"SMTPHostURL"`
	SMTPCustomOptions     []mail.Option `yaml:"SMTPCustomOptions"`
}

EmailNotificationInput extends the NotificationPlatform interface to support found identity notification by sending emails to a specified user.

func (EmailNotificationInput) Send

func (emailNotificationInput EmailNotificationInput) Send(ctx context.Context, data NotificationData) error

Send implements the NotificationPlatform interface

type GitHubIssueInput

type GitHubIssueInput struct {
	AssigneeUsername string `yaml:"assigneeUsername"`
	RepositoryOwner  string `yaml:"repositoryOwner"`
	RepositoryName   string `yaml:"repositoryName"`
	// The PAT or other access token to authenticate creating an issue.
	// The authentication token requires repo write and push access.
	AuthenticationToken string `yaml:"authenticationToken"`
	// For users who want to pass in a custom client.
	// If nil, a default client with the given authentication token will be instantiated.
	GitHubClient *github.Client `yaml:"githubClient"`
}

GitHubIssueInput extends the NotificationPlatform interface to support found identity notification via creating new GitHub issues in a given repo.

func (GitHubIssueInput) Send

func (gitHubIssueInput GitHubIssueInput) Send(ctx context.Context, data NotificationData) error

Send implements the NotificationPlatform interface

type IdentityMonitorConfiguration

type IdentityMonitorConfiguration struct {
	StartIndex                *int64                     `yaml:"startIndex"`
	EndIndex                  *int64                     `yaml:"endIndex"`
	MonitoredValues           ConfigMonitoredValues      `yaml:"monitoredValues"`
	OutputIdentitiesFile      *string                    `yaml:"outputIdentities"`
	OutputIdentitiesFormat    *string                    `yaml:"outputIdentitiesFormat"`
	LogInfoFile               string                     `yaml:"logInfoFile"`
	IdentityMetadataFile      *string                    `yaml:"identityMetadataFile"`
	GitHubIssue               *GitHubIssueInput          `yaml:"githubIssue"`
	EmailNotificationSMTP     *EmailNotificationInput    `yaml:"emailNotificationSMTP"`
	EmailNotificationMailgun  *MailgunNotificationInput  `yaml:"emailNotificationMailgun"`
	EmailNotificationSendGrid *SendGridNotificationInput `yaml:"emailNotificationSendGrid"`
	CARootsFile               string                     `yaml:"caRootsFile"`
	CAIntermediatesFile       string                     `yaml:"caIntermediatesFile"`
	CTShards                  []string                   `yaml:"ctShards"`
}

IdentityMonitorConfiguration holds the configuration settings for an identity monitor workflow run.

func (*IdentityMonitorConfiguration) Validate

func (c *IdentityMonitorConfiguration) Validate() error

type MailgunNotificationInput

type MailgunNotificationInput struct {
	RecipientEmailAddress string `yaml:"recipientEmailAddress"`
	SenderEmailAddress    string `yaml:"senderEmailAddress"`
	MailgunAPIKey         string `yaml:"mailgunAPIKey"`
	MailgunDomainName     string `yaml:"mailgunDomainName"`
}

MailgunNotificationInput extends the NotificationPlatform interface to support found identity notification by sending emails to a specified user via Mailgun.

func (MailgunNotificationInput) Send

func (mailgunNotificationInput MailgunNotificationInput) Send(ctx context.Context, data NotificationData) error

Send implements the NotificationPlatform interface

type NotificationBodyConverter

type NotificationBodyConverter interface {
	ToNotificationBody() ([]byte, error)
	ToNotificationHeader() string
}

NotificationBodyConverter defines an interface for payloads that can convert themselves to a notification body string

type NotificationContext

type NotificationContext struct {
	MonitorType string `json:"monitorType"` // e.g., "rekor-monitor", "ct-monitor"
	Subject     string `json:"subject"`     // Custom subject line
}

NotificationContext provides context information for notifications

func CreateNotificationContext

func CreateNotificationContext(monitorType, subject string) NotificationContext

CreateNotificationContext creates a custom notification context

type NotificationContextNew

type NotificationContextNew func() NotificationContext

type NotificationData

type NotificationData struct {
	Context NotificationContext       `json:"context"`
	Payload NotificationBodyConverter `json:"payload"` // The actual data to notify about
}

NotificationData represents the data to be sent in a notification

type NotificationPlatform

type NotificationPlatform interface {
	Send(context.Context, NotificationData) error
}

NotificationPlatform provides the Send() method to handle alerting logic for the respective notification platform extending the interface.

func CreateNotificationPool

func CreateNotificationPool(config IdentityMonitorConfiguration) []NotificationPlatform

type SendGridNotificationInput

type SendGridNotificationInput struct {
	RecipientName         string `yaml:"recipientName"`
	RecipientEmailAddress string `yaml:"recipientEmailAddress"`
	SenderName            string `yaml:"senderName"`
	SenderEmailAddress    string `yaml:"senderEmailAddress"`
	SendGridAPIKey        string `yaml:"sendGridAPIKey"`
}

SendGrid extends the NotificationPlatform interface to support found identity notification by sending emails to a specified user via SendGrid.

func (SendGridNotificationInput) Send

func (sendGridNotificationInput SendGridNotificationInput) Send(ctx context.Context, data NotificationData) error

Send implements the NotificationPlatform interface

Jump to

Keyboard shortcuts

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