secretscan

package
v0.0.0-testrgm3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStatusCode = errors.New("invalid status code")
)
View Source
var ErrInvalidWebHookStatusCode = errors.New("invalid webhook status code")

Functions

This section is empty.

Types

type Checker

type Checker interface {
	CheckTokens(ctx context.Context) error
}

type CheckerClient

type CheckerClient interface {
	CheckTokens(ctx context.Context, keyHashes []string) ([]Token, error)
}

type MockSecretScanClient

type MockSecretScanClient struct {
	// contains filtered or unexported fields
}

func (*MockSecretScanClient) CheckTokens

func (m *MockSecretScanClient) CheckTokens(ctx context.Context, keyHashes []string) ([]Token, error)

type MockSecretScanNotifier

type MockSecretScanNotifier struct {
	// contains filtered or unexported fields
}

func (*MockSecretScanNotifier) Notify

func (m *MockSecretScanNotifier) Notify(ctx context.Context,
	token *Token, tokenName string, revoked bool,
) error

type MockSecretScaner

type MockSecretScaner struct{}

func (*MockSecretScaner) CheckTokens

func (m *MockSecretScaner) CheckTokens(ctx context.Context) error

type MockTokenRetriever

type MockTokenRetriever struct {
	// contains filtered or unexported fields
}

func (*MockTokenRetriever) ListTokens

func (*MockTokenRetriever) RevokeServiceAccountToken

func (m *MockTokenRetriever) RevokeServiceAccountToken(
	ctx context.Context, orgID, serviceAccountID, tokenID int64,
) error

type SATokenRetriever

type SATokenRetriever interface {
	ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
	RevokeServiceAccountToken(ctx context.Context, orgID, serviceAccountID, tokenID int64) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Secret Scan Service is grafana's service for checking leaked keys.

func NewService

func NewService(store SATokenRetriever, cfg *setting.Cfg) (*Service, error)

func (*Service) CheckTokens

func (s *Service) CheckTokens(ctx context.Context) error

CheckTokens checks for leaked tokens.

func (*Service) RetrieveActiveTokens

func (s *Service) RetrieveActiveTokens(ctx context.Context) ([]apikey.APIKey, error)

type Token

type Token struct {
	Type       string `json:"type"`
	URL        string `json:"url"`
	Hash       string `json:"hash"`
	ReportedAt string `json:"reported_at"` //nolint
}

type WebHookClient

type WebHookClient interface {
	Notify(ctx context.Context, token *Token, tokenName string, revoked bool) error
}

Jump to

Keyboard shortcuts

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