securityhub

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is the cloudmock implementation of the AWS securityhub service.

func New

func New(accountID, region string) *Service

New returns a new securityhub Service.

func (*Service) Actions

func (s *Service) Actions() []service.Action

Actions returns all supported API actions.

func (*Service) HandleRequest

func (s *Service) HandleRequest(ctx *service.RequestContext) (*service.Response, error)

HandleRequest routes a request to the appropriate handler.

func (*Service) HealthCheck

func (s *Service) HealthCheck() error

HealthCheck always returns nil.

func (*Service) Name

func (s *Service) Name() string

Name returns the AWS service name used for request routing.

type Store

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

Store is the in-memory data store for Security Hub.

func NewStore

func NewStore(accountID, region string) *Store

NewStore creates an empty Store.

func (*Store) AcceptAdministrator

func (s *Store) AcceptAdministrator(adminID string) *service.AWSError

AcceptAdministrator stores the administrator account.

func (*Store) AccountID

func (s *Store) AccountID() string

AccountID returns the configured account id.

func (*Store) AddInvitation

func (s *Store) AddInvitation(accountID, invitationID string)

AddInvitation records an inbound invitation for testing.

func (*Store) BatchGetConfigurationPolicyAssociations

func (s *Store) BatchGetConfigurationPolicyAssociations(targetIDs []string) (found []*StoredConfigurationPolicyAssociation, unprocessed []map[string]any)

BatchGetConfigurationPolicyAssociations returns multiple associations.

func (*Store) BatchUpdateFindings

func (s *Store) BatchUpdateFindings(identifiers []map[string]any, updates map[string]any) (processed []map[string]any, unprocessed []map[string]any)

BatchUpdateFindings updates specific fields by FindingIdentifier.

func (*Store) CreateActionTarget

func (s *Store) CreateActionTarget(name, description, identifier string) (*StoredActionTarget, *service.AWSError)

CreateActionTarget adds a new custom action target.

func (*Store) CreateAggregatorV2

func (s *Store) CreateAggregatorV2(linkingMode string, regions []string) (*StoredAggregatorV2, *service.AWSError)

CreateAggregatorV2 stores a V2 aggregator.

func (*Store) CreateAutomationRule

func (s *Store) CreateAutomationRule(name, description, status string, ruleOrder int, isTerminal bool, criteria map[string]any, actions []map[string]any) (*StoredAutomationRule, *service.AWSError)

CreateAutomationRule stores a V1 automation rule.

func (*Store) CreateAutomationRuleV2

func (s *Store) CreateAutomationRuleV2(name, description, status string, ruleOrder float64, criteria map[string]any, actions []map[string]any) (*StoredAutomationRuleV2, *service.AWSError)

CreateAutomationRuleV2 stores a V2 rule.

func (*Store) CreateConfigurationPolicy

func (s *Store) CreateConfigurationPolicy(name, description string, configurationPolicy map[string]any) (*StoredConfigurationPolicy, *service.AWSError)

CreateConfigurationPolicy stores a new policy.

func (*Store) CreateConnectorV2

func (s *Store) CreateConnectorV2(name, description, providerName, kmsKeyArn string, providerSummary map[string]any, tags map[string]string) (*StoredConnectorV2, *service.AWSError)

CreateConnectorV2 stores a connector.

func (*Store) CreateFindingAggregator

func (s *Store) CreateFindingAggregator(linkingMode string, regions []string) (*StoredFindingAggregator, *service.AWSError)

CreateFindingAggregator stores a cross-region aggregator.

func (*Store) CreateInsight

func (s *Store) CreateInsight(name string, filters map[string]any, groupBy string) (*StoredInsight, *service.AWSError)

CreateInsight stores a new insight.

func (*Store) CreateMembers

func (s *Store) CreateMembers(accounts []map[string]any) (created []map[string]any, unprocessed []map[string]any)

CreateMembers stores accounts as Security Hub members.

func (*Store) DeclineInvitations

func (s *Store) DeclineInvitations(accountIDs []string) (unprocessed []map[string]any)

DeclineInvitations removes invitations by account id.

func (*Store) DeleteActionTarget

func (s *Store) DeleteActionTarget(arn string) *service.AWSError

DeleteActionTarget removes an action target.

func (*Store) DeleteAggregatorV2

func (s *Store) DeleteAggregatorV2(id string) *service.AWSError

DeleteAggregatorV2 removes a V2 aggregator.

func (*Store) DeleteAutomationRuleV2

func (s *Store) DeleteAutomationRuleV2(id string) *service.AWSError

DeleteAutomationRuleV2 removes a V2 rule.

func (*Store) DeleteAutomationRules

func (s *Store) DeleteAutomationRules(arns []string) (processed []string, unprocessed []map[string]any)

DeleteAutomationRules removes rules by ARN.

func (*Store) DeleteConfigurationPolicy

func (s *Store) DeleteConfigurationPolicy(id string) *service.AWSError

DeleteConfigurationPolicy removes a policy and its associations.

func (*Store) DeleteConnectorV2

func (s *Store) DeleteConnectorV2(id string) *service.AWSError

DeleteConnectorV2 removes a connector.

func (*Store) DeleteFindingAggregator

func (s *Store) DeleteFindingAggregator(arn string) *service.AWSError

DeleteFindingAggregator removes an aggregator.

func (*Store) DeleteInsight

func (s *Store) DeleteInsight(arn string) *service.AWSError

DeleteInsight removes an insight by ARN.

func (*Store) DeleteMembers

func (s *Store) DeleteMembers(accountIDs []string) (unprocessed []map[string]any)

DeleteMembers removes member accounts.

func (*Store) DescribeActionTargets

func (s *Store) DescribeActionTargets(arns []string) []*StoredActionTarget

DescribeActionTargets returns matching action targets, or all if arns empty.

func (*Store) DisableHub

func (s *Store) DisableHub() *service.AWSError

DisableHub clears the hub enablement state and all dependent resources.

func (*Store) DisableHubV2

func (s *Store) DisableHubV2() *service.AWSError

DisableHubV2 disables Security Hub V2.

func (*Store) DisableImportFindingsForProduct

func (s *Store) DisableImportFindingsForProduct(subscriptionArn string) *service.AWSError

DisableImportFindingsForProduct removes a product subscription by subscription ARN.

func (*Store) DisableOrgAdmin

func (s *Store) DisableOrgAdmin() *service.AWSError

DisableOrgAdmin clears the delegated admin account.

func (*Store) DisableStandards

func (s *Store) DisableStandards(subscriptionArn string) *service.AWSError

DisableStandards removes a standards subscription.

func (*Store) DisassociateAdministrator

func (s *Store) DisassociateAdministrator()

DisassociateAdministrator clears the administrator binding.

func (*Store) DisassociateMembers

func (s *Store) DisassociateMembers(accountIDs []string) (unprocessed []map[string]any)

DisassociateMembers detaches a member without deleting.

func (*Store) EnableHub

func (s *Store) EnableHub(autoEnableControls bool, controlFindingGenerator string, tags map[string]string) (*StoredHub, *service.AWSError)

EnableHub enables Security Hub for the account.

func (*Store) EnableHubV2

func (s *Store) EnableHubV2(tags map[string]string) (*StoredHub, *service.AWSError)

EnableHubV2 enables Security Hub V2.

func (*Store) EnableImportFindingsForProduct

func (s *Store) EnableImportFindingsForProduct(productArn string) (*StoredProductSubscription, *service.AWSError)

EnableImportFindingsForProduct subscribes to a product.

func (*Store) EnableOrgAdmin

func (s *Store) EnableOrgAdmin(accountID string) *service.AWSError

EnableOrgAdmin sets the delegated admin account.

func (*Store) EnableStandards

func (s *Store) EnableStandards(standardsArn string, input map[string]string) (*StoredStandardsSubscription, *service.AWSError)

EnableStandards subscribes the account to a standard.

func (*Store) GetAdministrator

func (s *Store) GetAdministrator() (string, string)

GetAdministrator returns the active administrator.

func (*Store) GetAggregatorV2

func (s *Store) GetAggregatorV2(id string) (*StoredAggregatorV2, *service.AWSError)

GetAggregatorV2 returns a V2 aggregator.

func (*Store) GetAutomationRuleV2

func (s *Store) GetAutomationRuleV2(id string) (*StoredAutomationRuleV2, *service.AWSError)

GetAutomationRuleV2 returns a single V2 rule by id.

func (*Store) GetAutomationRules

func (s *Store) GetAutomationRules(arns []string) (rules []*StoredAutomationRule, unprocessed []map[string]any)

GetAutomationRules returns rules by ARN.

func (*Store) GetConfigurationPolicy

func (s *Store) GetConfigurationPolicy(id string) (*StoredConfigurationPolicy, *service.AWSError)

GetConfigurationPolicy returns a policy by id or arn.

func (*Store) GetConfigurationPolicyAssociation

func (s *Store) GetConfigurationPolicyAssociation(targetID string) (*StoredConfigurationPolicyAssociation, *service.AWSError)

GetConfigurationPolicyAssociation returns one association.

func (*Store) GetConnectorV2

func (s *Store) GetConnectorV2(id string) (*StoredConnectorV2, *service.AWSError)

GetConnectorV2 returns a connector by id.

func (*Store) GetFindingAggregator

func (s *Store) GetFindingAggregator(arn string) (*StoredFindingAggregator, *service.AWSError)

GetFindingAggregator returns a single aggregator by ARN.

func (*Store) GetFindings

func (s *Store) GetFindings(filters map[string]any) []*StoredFinding

GetFindings returns findings matching the filter criteria.

func (*Store) GetHub

func (s *Store) GetHub() (*StoredHub, *service.AWSError)

GetHub returns the active hub or an error if Security Hub is not enabled.

func (*Store) GetHubV2

func (s *Store) GetHubV2() (*StoredHub, *service.AWSError)

GetHubV2 returns the V2 hub or an error.

func (*Store) GetMembers

func (s *Store) GetMembers(accountIDs []string) (members []*StoredMember, unprocessed []map[string]any)

GetMembers returns the requested members.

func (*Store) GetOrgConfig

func (s *Store) GetOrgConfig() map[string]any

GetOrgConfig returns the current organization configuration.

func (*Store) ImportFindings

func (s *Store) ImportFindings(findings []map[string]any) (success int, failed []map[string]any)

ImportFindings persists ASFF findings.

func (*Store) InviteMembers

func (s *Store) InviteMembers(accountIDs []string) (unprocessed []map[string]any)

InviteMembers sends invitations to existing members.

func (*Store) ListAggregatorsV2

func (s *Store) ListAggregatorsV2() []*StoredAggregatorV2

ListAggregatorsV2 returns all V2 aggregators.

func (*Store) ListAutomationRules

func (s *Store) ListAutomationRules() []*StoredAutomationRule

ListAutomationRules returns all V1 rules.

func (*Store) ListAutomationRulesV2

func (s *Store) ListAutomationRulesV2() []*StoredAutomationRuleV2

ListAutomationRulesV2 returns all V2 rules.

func (*Store) ListConfigurationPolicies

func (s *Store) ListConfigurationPolicies() []*StoredConfigurationPolicy

ListConfigurationPolicies returns all stored policies.

func (*Store) ListConfigurationPolicyAssociations

func (s *Store) ListConfigurationPolicyAssociations() []*StoredConfigurationPolicyAssociation

ListConfigurationPolicyAssociations returns all associations.

func (*Store) ListConnectorsV2

func (s *Store) ListConnectorsV2() []*StoredConnectorV2

ListConnectorsV2 returns all connectors.

func (*Store) ListEnabledProducts

func (s *Store) ListEnabledProducts() []*StoredProductSubscription

ListEnabledProducts returns all enabled product subscriptions.

func (*Store) ListFindingAggregators

func (s *Store) ListFindingAggregators() []*StoredFindingAggregator

ListFindingAggregators returns all aggregators.

func (*Store) ListInsights

func (s *Store) ListInsights(arns []string) []*StoredInsight

ListInsights returns all insights, optionally filtered by ARN.

func (*Store) ListInvitations

func (s *Store) ListInvitations() []*StoredInvitation

ListInvitations returns all stored invitations.

func (*Store) ListMembers

func (s *Store) ListMembers() []*StoredMember

ListMembers returns all member records.

func (*Store) ListOrgAdmins

func (s *Store) ListOrgAdmins() []string

ListOrgAdmins returns the configured delegated admins.

func (*Store) ListStandardsSubscriptions

func (s *Store) ListStandardsSubscriptions() []*StoredStandardsSubscription

ListStandardsSubscriptions returns all enabled standards.

func (*Store) ListTags

func (s *Store) ListTags(arn string) map[string]string

ListTags returns tags for an ARN.

func (*Store) Region

func (s *Store) Region() string

Region returns the configured region.

func (*Store) Reset

func (s *Store) Reset()

Reset clears all in-memory state.

func (*Store) StartConfigurationPolicyAssociation

func (s *Store) StartConfigurationPolicyAssociation(policyID, targetID, targetType string) (*StoredConfigurationPolicyAssociation, *service.AWSError)

StartConfigurationPolicyAssociation binds a policy to a target.

func (*Store) StartConfigurationPolicyDisassociation

func (s *Store) StartConfigurationPolicyDisassociation(policyID, targetID string) *service.AWSError

StartConfigurationPolicyDisassociation removes a policy/target binding.

func (*Store) TagResource

func (s *Store) TagResource(arn string, tags map[string]string)

TagResource attaches tags to an ARN.

func (*Store) UntagResource

func (s *Store) UntagResource(arn string, keys []string)

UntagResource removes tag keys from an ARN.

func (*Store) UpdateActionTarget

func (s *Store) UpdateActionTarget(arn, name, description string) *service.AWSError

UpdateActionTarget changes fields on an existing action target.

func (*Store) UpdateAggregatorV2

func (s *Store) UpdateAggregatorV2(id, linkingMode string, regions []string) (*StoredAggregatorV2, *service.AWSError)

UpdateAggregatorV2 updates a V2 aggregator.

func (*Store) UpdateAutomationRuleV2

func (s *Store) UpdateAutomationRuleV2(id, name, description, status string, ruleOrder *float64, criteria map[string]any, actions []map[string]any) (*StoredAutomationRuleV2, *service.AWSError)

UpdateAutomationRuleV2 updates a V2 rule.

func (*Store) UpdateAutomationRules

func (s *Store) UpdateAutomationRules(updates []map[string]any) (processed []string, unprocessed []map[string]any)

UpdateAutomationRules applies updates to rules.

func (*Store) UpdateConfigurationPolicy

func (s *Store) UpdateConfigurationPolicy(id, name, description string, configurationPolicy map[string]any) (*StoredConfigurationPolicy, *service.AWSError)

UpdateConfigurationPolicy mutates fields on an existing policy.

func (*Store) UpdateConnectorV2

func (s *Store) UpdateConnectorV2(id, description string, providerSummary map[string]any) (*StoredConnectorV2, *service.AWSError)

UpdateConnectorV2 modifies a connector.

func (*Store) UpdateFindingAggregator

func (s *Store) UpdateFindingAggregator(arn, linkingMode string, regions []string) (*StoredFindingAggregator, *service.AWSError)

UpdateFindingAggregator updates linking mode and regions.

func (*Store) UpdateFindings

func (s *Store) UpdateFindings(filters map[string]any, updates map[string]any) (matched int)

UpdateFindings applies a batched update to matching findings. updates is a flat map of fields to set on every matched finding.

func (*Store) UpdateHubConfig

func (s *Store) UpdateHubConfig(autoEnableControls *bool, controlFindingGenerator string) *service.AWSError

UpdateHubConfig updates auto-enable settings.

func (*Store) UpdateInsight

func (s *Store) UpdateInsight(arn, name string, filters map[string]any, groupBy string) *service.AWSError

UpdateInsight modifies fields on an existing insight.

func (*Store) UpdateOrgConfig

func (s *Store) UpdateOrgConfig(updates map[string]any)

UpdateOrgConfig overwrites organization-config fields.

type StoredActionTarget

type StoredActionTarget struct {
	ActionTargetArn string
	Name            string
	Description     string
}

StoredActionTarget is a custom action used by Security Hub findings.

type StoredAggregatorV2

type StoredAggregatorV2 struct {
	AggregatorV2Arn   string
	AggregatorV2ID    string
	AggregationRegion string
	RegionLinkingMode string
	LinkedRegions     []string
}

StoredAggregatorV2 persists a V2 aggregator.

type StoredAutomationRule

type StoredAutomationRule struct {
	RuleArn     string
	RuleID      string
	RuleName    string
	RuleStatus  string
	RuleOrder   int
	Description string
	IsTerminal  bool
	Criteria    map[string]any
	Actions     []map[string]any
	CreatedAt   time.Time
	UpdatedAt   time.Time
	CreatedBy   string
}

StoredAutomationRule persists an automation rule (V1).

type StoredAutomationRuleV2

type StoredAutomationRuleV2 struct {
	RuleArn     string
	RuleID      string
	RuleName    string
	RuleStatus  string
	RuleOrder   float64
	Description string
	Criteria    map[string]any
	Actions     []map[string]any
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

StoredAutomationRuleV2 persists a V2 automation rule.

type StoredConfigurationPolicy

type StoredConfigurationPolicy struct {
	Arn                 string
	ID                  string
	Name                string
	Description         string
	UpdatedAt           time.Time
	CreatedAt           time.Time
	ConfigurationPolicy map[string]any
}

StoredConfigurationPolicy persists a configuration policy.

type StoredConfigurationPolicyAssociation

type StoredConfigurationPolicyAssociation struct {
	TargetID                 string
	TargetType               string
	ConfigurationPolicyID    string
	AssociationType          string
	AssociationStatus        string
	AssociationStatusMessage string
	UpdatedAt                time.Time
}

StoredConfigurationPolicyAssociation persists a target binding.

type StoredConnectorV2

type StoredConnectorV2 struct {
	ConnectorArn    string
	ConnectorID     string
	Name            string
	Description     string
	ProviderName    string
	HealthStatus    string
	HealthMessage   string
	ClientSecret    string
	KmsKeyArn       string
	CreatedAt       time.Time
	LastUpdatedAt   time.Time
	ProviderSummary map[string]any
	Tags            map[string]string
}

StoredConnectorV2 persists a V2 connector.

type StoredFinding

type StoredFinding struct {
	ID   string
	Data map[string]any
}

StoredFinding is an ASFF security finding.

type StoredFindingAggregator

type StoredFindingAggregator struct {
	FindingAggregatorArn     string
	FindingAggregationRegion string
	RegionLinkingMode        string
	Regions                  []string
}

StoredFindingAggregator persists a cross-region aggregator.

type StoredHub

type StoredHub struct {
	HubArn                  string
	SubscribedAt            time.Time
	AutoEnableControls      bool
	ControlFindingGenerator string
	Tags                    map[string]string
}

StoredHub represents the per-account Security Hub enablement state.

type StoredInsight

type StoredInsight struct {
	InsightArn       string
	Name             string
	Filters          map[string]any
	GroupByAttribute string
}

StoredInsight is a custom Security Hub insight.

type StoredInvitation

type StoredInvitation struct {
	AccountID    string
	InvitationID string
	InvitedAt    time.Time
	MemberStatus string
}

StoredInvitation models an inbound Security Hub member invitation.

type StoredMember

type StoredMember struct {
	AccountID       string
	Email           string
	MasterID        string
	AdministratorID string
	MemberStatus    string
	InvitedAt       time.Time
	UpdatedAt       time.Time
}

StoredMember models a Security Hub member account.

type StoredProductSubscription

type StoredProductSubscription struct {
	ProductSubscriptionArn string
	ProductArn             string
}

StoredProductSubscription tracks an enabled product import.

type StoredStandardsSubscription

type StoredStandardsSubscription struct {
	StandardsSubscriptionArn string
	StandardsArn             string
	StandardsInput           map[string]string
	StandardsStatus          string
	StandardsStatusReason    map[string]any
}

StoredStandardsSubscription tracks an enabled standard.

Jump to

Keyboard shortcuts

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