securityhub

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 17 Imported by: 0

README

Security Hub

Parity grade: A · SDK aws-sdk-go-v2/service/securityhub@v1.71.2 · last audited 2026-07-12 (5845d0e3)

Coverage

Metric Value
Operations audited 109 (106 ok, 3 gap)
Feature families 2 (2 ok)
Known gaps 5
Deferred items 1
Resource leaks clean
Known gaps
  • GetFindings/GetFindingsV2 accept SortCriteria but never apply it (results return in map-iteration order)
  • BatchImportFindings re-import overwrites Note/UserDefinedFields/VerificationState/Workflow instead of preserving them per AWS's documented BatchImportFindings semantics
  • GetFindingHistory always returns empty Records; no finding-update history is recorded anywhere in the backend
  • ListMembers(onlyAssociated=true) can never return members: filters on MemberStatus=="Enabled", but nothing transitions a member to Enabled because member-invitation acceptance is a cross-account action this single-account in-memory backend doesn't model (the member's own account would call AcceptInvitation against ITS OWN backend instance, not the administrator's)
  • Findings V2 / Resources V2 family (GetFindingsV2, BatchUpdateFindingsV2, GetFindingStatisticsV2/TrendsV2, GetResourcesV2/StatisticsV2/TrendsV2) reuses the V1 ASFF finding store and V1 filter DSL instead of real OCSF wire shapes (types.OcsfFindingFilters, types.OcsfFindingIdentifier). BatchUpdateFindingsV2's handler additionally reads a nonexistent "FindingFieldsUpdate" wrapper key -- the real wire fields are flat (Comment, SeverityId, StatusId, FindingIdentifiers, MetadataUids). Even after correcting that read, V1's ProductArn/Id lookup key can never match a real V2 client's OcsfFindingIdentifier (CloudAccountUid/FindingInfoUid), so BatchUpdateFindingsV2 always returns everything unprocessed today. Properly fixing this needs an ASFF<->OCSF identifier/filter mapping layer -- a scoped follow-up, not a one-line fix (bd: file follow-up issue).
Deferred
  • Findings V2 / Resources V2 OCSF wire-format rebuild (see gaps above) -- flagged, not attempted this pass; too large for a bug-fix sweep and risks introducing new bugs without a clear OCSF<->ASFF field-mapping spec to verify against

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHubNotEnabled    = errors.New("SecurityHub is not enabled")
	ErrHubAlreadyExists = errors.New("SecurityHub is already enabled")
	ErrNotFound         = errors.New("not found")
	ErrInvalidInput     = errors.New("invalid input")
	ErrAlreadyExists    = errors.New("resource already exists")
)
View Source
var ErrNilAppContext = errors.New("securityhub: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type ActionTarget

type ActionTarget struct {
	ActionTargetArn string `json:"ActionTargetArn"`
	Name            string `json:"Name"`
	Description     string `json:"Description"`
}

ActionTarget represents a custom action target.

type AdminAccount

type AdminAccount struct {
	AccountId          string `json:"AccountId"`    //nolint:revive,staticcheck // existing issue.
	InvitationId       string `json:"InvitationId"` //nolint:revive,staticcheck // existing issue.
	InvitedAt          string `json:"InvitedAt"`
	RelationshipStatus string `json:"RelationshipStatus"`
}

AdminAccount represents the administrator account relationship.

type AggregatorV2

type AggregatorV2 struct {
	AggregatorV2Arn   string   `json:"AggregatorV2Arn"`
	AggregationRegion string   `json:"AggregationRegion"`
	RegionLinkingMode string   `json:"RegionLinkingMode"`
	CreatedAt         string   `json:"CreatedAt"`
	UpdatedAt         string   `json:"UpdatedAt"`
	Regions           []string `json:"Regions"`
}

AggregatorV2 represents a Security Hub V2 cross-region aggregator.

type AutomationRule

type AutomationRule struct {
	Criteria    map[string]any   `json:"Criteria"`
	RuleArn     string           `json:"RuleArn"`
	RuleStatus  string           `json:"RuleStatus"`
	RuleName    string           `json:"RuleName"`
	Description string           `json:"Description"`
	CreatedAt   string           `json:"CreatedAt"`
	UpdatedAt   string           `json:"UpdatedAt"`
	CreatedBy   string           `json:"CreatedBy"`
	Actions     []map[string]any `json:"Actions"`
	RuleOrder   int32            `json:"RuleOrder"`
	IsTerminal  bool             `json:"IsTerminal"`
}

AutomationRule is the full rule returned by BatchGetAutomationRules.

type AutomationRuleMetadata

type AutomationRuleMetadata struct {
	RuleArn     string
	RuleStatus  string
	RuleName    string
	Description string
	CreatedAt   string
	UpdatedAt   string
	CreatedBy   string
	RuleOrder   int32
	IsTerminal  bool
}

AutomationRuleMetadata is the summary view returned by ListAutomationRules.

type AutomationRuleV2

type AutomationRuleV2 struct {
	Identifier  string           `json:"Identifier"`
	RuleArn     string           `json:"RuleArn"`
	RuleName    string           `json:"RuleName"`
	RuleStatus  string           `json:"RuleStatus"`
	Description string           `json:"Description"`
	CreatedAt   string           `json:"CreatedAt"`
	UpdatedAt   string           `json:"UpdatedAt"`
	Criteria    map[string]any   `json:"Criteria"`
	Actions     []map[string]any `json:"Actions"`
	RuleOrder   float64          `json:"RuleOrder"`
	IsTerminal  bool             `json:"IsTerminal"`
}

AutomationRuleV2 represents a Security Hub V2 automation rule.

type ConfigurationPolicy

type ConfigurationPolicy struct {
	ConfigurationPolicy map[string]any    `json:"ConfigurationPolicy"`
	Tags                map[string]string `json:"Tags"`
	Arn                 string            `json:"Arn"`
	Id                  string            `json:"Id"` //nolint:revive,staticcheck // existing issue.
	Name                string            `json:"Name"`
	Description         string            `json:"Description"`
	CreatedAt           string            `json:"CreatedAt"`
	UpdatedAt           string            `json:"UpdatedAt"`
}

ConfigurationPolicy represents a Security Hub central configuration policy.

type ConfigurationPolicyAssociation

type ConfigurationPolicyAssociation struct {
	ConfigurationPolicyId    string `json:"ConfigurationPolicyId"` //nolint:revive,staticcheck // existing issue.
	TargetId                 string `json:"TargetId"`              //nolint:revive,staticcheck // existing issue.
	TargetType               string `json:"TargetType"`
	AssociationType          string `json:"AssociationType"`
	UpdatedAt                string `json:"UpdatedAt"`
	AssociationStatus        string `json:"AssociationStatus"`
	AssociationStatusMessage string `json:"AssociationStatusMessage"`
}

ConfigurationPolicyAssociation represents an association between a policy and a target.

type ConnectorV2

type ConnectorV2 struct {
	Provider        map[string]any    `json:"Provider"`
	Tags            map[string]string `json:"Tags"`
	ConnectorId     string            `json:"ConnectorId"` //nolint:revive,staticcheck // existing issue.
	ConnectorArn    string            `json:"ConnectorArn"`
	Name            string            `json:"Name"`
	Description     string            `json:"Description"`
	CreatedAt       string            `json:"CreatedAt"`
	UpdatedAt       string            `json:"UpdatedAt"`
	ConnectorStatus string            `json:"ConnectorStatus"`
}

ConnectorV2 represents a Security Hub V2 connector.

type FindingAggregator

type FindingAggregator struct {
	FindingAggregatorArn     string   `json:"FindingAggregatorArn"`
	FindingAggregationRegion string   `json:"FindingAggregationRegion"`
	RegionLinkingMode        string   `json:"RegionLinkingMode"`
	Regions                  []string `json:"Regions"`
}

FindingAggregator represents a Security Hub finding aggregator for cross-region aggregation.

type Handler

type Handler struct {
	Backend StorageBackend
}

Handler handles SecurityHub HTTP requests.

func NewHandler

func NewHandler(b StorageBackend) *Handler

NewHandler constructs a new Handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns the operations for chaos engineering.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns the regions for chaos engineering.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the service name for chaos engineering.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation classifies the request into an operation name.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the resource identifier from the request.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns every operation name this handler routes.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset resets the backend.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches SecurityHub requests by path. For /findings and /tags paths, uses the Authorization header to disambiguate from other services (e.g. Macie2) that share those path prefixes.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type Hub

type Hub struct {
	HubArn                  string `json:"HubArn"`
	SubscribedAt            string `json:"SubscribedAt"`
	AutoEnableStandards     string `json:"AutoEnableStandards"`
	ControlFindingGenerator string `json:"ControlFindingGenerator"`
	AutoEnableControls      bool   `json:"AutoEnableControls"`
}

Hub represents the SecurityHub configuration.

type HubV2

type HubV2 struct {
	HubV2Arn  string `json:"HubV2Arn"`
	CreatedAt string `json:"CreatedAt"`
	UpdatedAt string `json:"UpdatedAt"`
}

HubV2 represents the Security Hub V2 configuration.

type InMemoryBackend

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

InMemoryBackend is the in-memory implementation of StorageBackend.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory backend.

func (*InMemoryBackend) AcceptAdministratorInvitation

func (b *InMemoryBackend) AcceptAdministratorInvitation(administratorID, invitationID string) error

func (*InMemoryBackend) AcceptInvitation

func (b *InMemoryBackend) AcceptInvitation(masterID, invitationID string) error

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

func (*InMemoryBackend) BatchDeleteAutomationRules

func (b *InMemoryBackend) BatchDeleteAutomationRules(automationRulesArns []string) ([]string, []map[string]any)

func (*InMemoryBackend) BatchDisableStandards

func (b *InMemoryBackend) BatchDisableStandards(
	subscriptionArns []string,
) ([]*StandardsSubscription, []map[string]any)

func (*InMemoryBackend) BatchEnableStandards

func (b *InMemoryBackend) BatchEnableStandards(requests []map[string]any) ([]*StandardsSubscription, []map[string]any)

func (*InMemoryBackend) BatchGetAutomationRules

func (b *InMemoryBackend) BatchGetAutomationRules(automationRulesArns []string) ([]*AutomationRule, []map[string]any)

func (*InMemoryBackend) BatchGetConfigurationPolicyAssociations

func (b *InMemoryBackend) BatchGetConfigurationPolicyAssociations(
	requests []map[string]any,
) ([]*ConfigurationPolicyAssociation, []map[string]any)

func (*InMemoryBackend) BatchGetSecurityControls

func (b *InMemoryBackend) BatchGetSecurityControls(securityControlIDs []string) ([]*SecurityControl, []map[string]any)

func (*InMemoryBackend) BatchGetStandardsControlAssociations

func (b *InMemoryBackend) BatchGetStandardsControlAssociations(
	requests []map[string]any,
) ([]*StandardsControlAssociation, []map[string]any)

func (*InMemoryBackend) BatchUpdateAutomationRules

func (b *InMemoryBackend) BatchUpdateAutomationRules(updates []map[string]any) ([]string, []map[string]any)

func (*InMemoryBackend) BatchUpdateFindings

func (b *InMemoryBackend) BatchUpdateFindings(
	findingIdentifiers []map[string]any,
	updates map[string]any,
) ([]map[string]any, []map[string]any)

func (*InMemoryBackend) BatchUpdateFindingsV2

func (b *InMemoryBackend) BatchUpdateFindingsV2(
	findingIdentifiers []map[string]any,
	updates map[string]any,
) ([]map[string]any, []map[string]any)

func (*InMemoryBackend) BatchUpdateStandardsControlAssociations

func (b *InMemoryBackend) BatchUpdateStandardsControlAssociations(updates []map[string]any) ([]map[string]any, error)

func (*InMemoryBackend) CreateActionTarget

func (b *InMemoryBackend) CreateActionTarget(name, description, id string) (string, error)

func (*InMemoryBackend) CreateAggregatorV2

func (b *InMemoryBackend) CreateAggregatorV2(regionLinkingMode string, regions []string) (*AggregatorV2, error)

func (*InMemoryBackend) CreateAutomationRule

func (b *InMemoryBackend) CreateAutomationRule(rule map[string]any) (string, string)

func (*InMemoryBackend) CreateAutomationRuleV2

func (b *InMemoryBackend) CreateAutomationRuleV2(
	ruleName, ruleStatus, description string,
	criteria map[string]any,
	actions []map[string]any,
	ruleOrder float64,
	isTerminal bool,
	tags map[string]string,
) (*AutomationRuleV2, error)

func (*InMemoryBackend) CreateConfigurationPolicy

func (b *InMemoryBackend) CreateConfigurationPolicy(
	name, description string,
	policy map[string]any,
	tags map[string]string,
) (*ConfigurationPolicy, error)

func (*InMemoryBackend) CreateConnectorV2

func (b *InMemoryBackend) CreateConnectorV2(
	name, description string,
	provider map[string]any,
	tags map[string]string,
) (*ConnectorV2, error)

func (*InMemoryBackend) CreateFindingAggregator

func (b *InMemoryBackend) CreateFindingAggregator(
	regionLinkingMode string,
	regions []string,
) (*FindingAggregator, error)

func (*InMemoryBackend) CreateInsight

func (b *InMemoryBackend) CreateInsight(name, groupByAttribute string, filters map[string]any) (string, error)

func (*InMemoryBackend) CreateMembers

func (b *InMemoryBackend) CreateMembers(accounts []map[string]any) ([]*Member, []map[string]any)

func (*InMemoryBackend) CreateTicketV2

func (b *InMemoryBackend) CreateTicketV2(
	ticketConfig map[string]any,
	tags map[string]string,
) (*TicketV2, error)

func (*InMemoryBackend) DeclineInvitations

func (b *InMemoryBackend) DeclineInvitations(accountIDs []string) ([]map[string]any, []map[string]any)

func (*InMemoryBackend) DeleteActionTarget

func (b *InMemoryBackend) DeleteActionTarget(actionTargetArn string) (string, error)

func (*InMemoryBackend) DeleteAggregatorV2

func (b *InMemoryBackend) DeleteAggregatorV2(arn string) error

func (*InMemoryBackend) DeleteAutomationRuleV2

func (b *InMemoryBackend) DeleteAutomationRuleV2(identifier string) error

func (*InMemoryBackend) DeleteConfigurationPolicy

func (b *InMemoryBackend) DeleteConfigurationPolicy(identifier string) error

func (*InMemoryBackend) DeleteConnectorV2

func (b *InMemoryBackend) DeleteConnectorV2(connectorID string) error

func (*InMemoryBackend) DeleteFindingAggregator

func (b *InMemoryBackend) DeleteFindingAggregator(arn string) error

func (*InMemoryBackend) DeleteInsight

func (b *InMemoryBackend) DeleteInsight(insightArn string) (string, error)

func (*InMemoryBackend) DeleteInvitations

func (b *InMemoryBackend) DeleteInvitations(accountIDs []string) ([]map[string]any, []map[string]any)

func (*InMemoryBackend) DeleteMembers

func (b *InMemoryBackend) DeleteMembers(accountIDs []string) ([]string, []map[string]any)

func (*InMemoryBackend) DescribeActionTargets

func (b *InMemoryBackend) DescribeActionTargets(
	actionTargetArns []string,
	nextToken string,
	maxResults int,
) ([]*ActionTarget, string)

func (*InMemoryBackend) DescribeHub

func (b *InMemoryBackend) DescribeHub() (*Hub, error)

func (*InMemoryBackend) DescribeOrganizationConfiguration

func (b *InMemoryBackend) DescribeOrganizationConfiguration() *OrgConfig

func (*InMemoryBackend) DescribeProducts

func (b *InMemoryBackend) DescribeProducts(productArn, nextToken string, maxResults int) ([]*Product, string)

func (*InMemoryBackend) DescribeProductsV2

func (b *InMemoryBackend) DescribeProductsV2(nextToken string, maxResults int) ([]*Product, string)

func (*InMemoryBackend) DescribeSecurityHubV2

func (b *InMemoryBackend) DescribeSecurityHubV2() (*HubV2, error)

func (*InMemoryBackend) DescribeStandards

func (b *InMemoryBackend) DescribeStandards(nextToken string, maxResults int) ([]*Standard, string)

func (*InMemoryBackend) DescribeStandardsControls

func (b *InMemoryBackend) DescribeStandardsControls(
	subscriptionArn, nextToken string,
	maxResults int,
) ([]*StandardsControl, string)

func (*InMemoryBackend) DisableHub

func (b *InMemoryBackend) DisableHub() error

func (*InMemoryBackend) DisableImportFindingsForProduct

func (b *InMemoryBackend) DisableImportFindingsForProduct(productSubscriptionArn string) error

func (*InMemoryBackend) DisableOrganizationAdminAccount

func (b *InMemoryBackend) DisableOrganizationAdminAccount(accountID string) error

func (*InMemoryBackend) DisableSecurityHubV2

func (b *InMemoryBackend) DisableSecurityHubV2() error

func (*InMemoryBackend) DisassociateFromAdministratorAccount

func (b *InMemoryBackend) DisassociateFromAdministratorAccount() error

func (*InMemoryBackend) DisassociateFromMasterAccount

func (b *InMemoryBackend) DisassociateFromMasterAccount() error

func (*InMemoryBackend) DisassociateMembers

func (b *InMemoryBackend) DisassociateMembers(accountIDs []string) error

func (*InMemoryBackend) EnableHub

func (b *InMemoryBackend) EnableHub(enableDefaultStandards bool, tags map[string]string) error

func (*InMemoryBackend) EnableImportFindingsForProduct

func (b *InMemoryBackend) EnableImportFindingsForProduct(productArn string) (string, error)

func (*InMemoryBackend) EnableOrganizationAdminAccount

func (b *InMemoryBackend) EnableOrganizationAdminAccount(accountID string) error

func (*InMemoryBackend) EnableSecurityHubV2

func (b *InMemoryBackend) EnableSecurityHubV2(tags map[string]string) error

func (*InMemoryBackend) GenerateRecommendedPolicyV2

func (b *InMemoryBackend) GenerateRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)

func (*InMemoryBackend) GetAdministratorAccount

func (b *InMemoryBackend) GetAdministratorAccount() (*AdminAccount, error)

func (*InMemoryBackend) GetAggregatorV2

func (b *InMemoryBackend) GetAggregatorV2(arn string) (*AggregatorV2, error)

func (*InMemoryBackend) GetAutomationRuleV2

func (b *InMemoryBackend) GetAutomationRuleV2(identifier string) (*AutomationRuleV2, error)

func (*InMemoryBackend) GetConfigurationPolicy

func (b *InMemoryBackend) GetConfigurationPolicy(identifier string) (*ConfigurationPolicy, error)

func (*InMemoryBackend) GetConfigurationPolicyAssociation

func (b *InMemoryBackend) GetConfigurationPolicyAssociation(
	targetID, targetType string,
) (*ConfigurationPolicyAssociation, error)

func (*InMemoryBackend) GetConnectorV2

func (b *InMemoryBackend) GetConnectorV2(connectorID string) (*ConnectorV2, error)

func (*InMemoryBackend) GetEnabledStandards

func (b *InMemoryBackend) GetEnabledStandards(
	subscriptionArns []string,
	nextToken string,
	maxResults int,
) ([]*StandardsSubscription, string)

func (*InMemoryBackend) GetFindingAggregator

func (b *InMemoryBackend) GetFindingAggregator(arn string) (*FindingAggregator, error)

func (*InMemoryBackend) GetFindingHistory

func (b *InMemoryBackend) GetFindingHistory(
	_ map[string]any,
	_, _ string,
	_ string,
	_ int,
) ([]map[string]any, string)

func (*InMemoryBackend) GetFindingStatisticsV2

func (b *InMemoryBackend) GetFindingStatisticsV2(groupByAttributes []string) []map[string]any

func (*InMemoryBackend) GetFindings

func (b *InMemoryBackend) GetFindings(
	filters map[string]any,
	_ []map[string]any,
	nextToken string,
	maxResults int,
) ([]map[string]any, string)

func (*InMemoryBackend) GetFindingsTrendsV2

func (b *InMemoryBackend) GetFindingsTrendsV2(
	groupByAttribute string,
	startTime, endTime string,
) []map[string]any

func (*InMemoryBackend) GetFindingsV2

func (b *InMemoryBackend) GetFindingsV2(
	filters map[string]any,
	sortCriteria []map[string]any,
	nextToken string,
	maxResults int,
) ([]map[string]any, string)

func (*InMemoryBackend) GetInsightResults

func (b *InMemoryBackend) GetInsightResults(insightArn string) (*InsightResults, error)

func (*InMemoryBackend) GetInsights

func (b *InMemoryBackend) GetInsights(
	insightArns []string,
	nextToken string,
	maxResults int,
) ([]*Insight, string, error)

func (*InMemoryBackend) GetInvitationsCount

func (b *InMemoryBackend) GetInvitationsCount() int

func (*InMemoryBackend) GetMasterAccount

func (b *InMemoryBackend) GetMasterAccount() (*AdminAccount, error)

func (*InMemoryBackend) GetMembers

func (b *InMemoryBackend) GetMembers(accountIDs []string) ([]*Member, []map[string]any)

func (*InMemoryBackend) GetRecommendedPolicyV2

func (b *InMemoryBackend) GetRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)

func (*InMemoryBackend) GetResourcesStatisticsV2

func (b *InMemoryBackend) GetResourcesStatisticsV2(groupByAttributes []string) []map[string]any

func (*InMemoryBackend) GetResourcesTrendsV2

func (b *InMemoryBackend) GetResourcesTrendsV2(
	groupByAttribute string,
	startTime, endTime string,
) []map[string]any

func (*InMemoryBackend) GetResourcesV2

func (b *InMemoryBackend) GetResourcesV2(
	filters map[string]any,
	nextToken string,
	maxResults int,
) ([]map[string]any, string)

func (*InMemoryBackend) GetSecurityControlDefinition

func (b *InMemoryBackend) GetSecurityControlDefinition(securityControlID string) (*SecurityControlDefinition, error)

func (*InMemoryBackend) ImportFindings

func (b *InMemoryBackend) ImportFindings(findings []map[string]any) (int, int, []map[string]any)

func (*InMemoryBackend) InviteMembers

func (b *InMemoryBackend) InviteMembers(accountIDs []string) []map[string]any

func (*InMemoryBackend) ListAggregatorsV2

func (b *InMemoryBackend) ListAggregatorsV2(nextToken string, maxResults int) ([]*AggregatorV2, string)

func (*InMemoryBackend) ListAutomationRules

func (b *InMemoryBackend) ListAutomationRules(nextToken string, maxResults int) ([]*AutomationRuleMetadata, string)

func (*InMemoryBackend) ListAutomationRulesV2

func (b *InMemoryBackend) ListAutomationRulesV2(nextToken string, maxResults int) ([]*AutomationRuleV2, string)

func (*InMemoryBackend) ListConfigurationPolicies

func (b *InMemoryBackend) ListConfigurationPolicies(nextToken string, maxResults int) ([]*ConfigurationPolicy, string)

func (*InMemoryBackend) ListConfigurationPolicyAssociations

func (b *InMemoryBackend) ListConfigurationPolicyAssociations(
	filterPolicyID, filterType, nextToken string,
	maxResults int,
) ([]*ConfigurationPolicyAssociation, string)

func (*InMemoryBackend) ListConnectorsV2

func (b *InMemoryBackend) ListConnectorsV2(nextToken string, maxResults int) ([]*ConnectorV2, string)

func (*InMemoryBackend) ListEnabledProductsForImport

func (b *InMemoryBackend) ListEnabledProductsForImport(nextToken string, maxResults int) ([]string, string)

func (*InMemoryBackend) ListFindingAggregators

func (b *InMemoryBackend) ListFindingAggregators(nextToken string, maxResults int) ([]*FindingAggregator, string)

func (*InMemoryBackend) ListInvitations

func (b *InMemoryBackend) ListInvitations(nextToken string, maxResults int) ([]*Invitation, string)

func (*InMemoryBackend) ListMembers

func (b *InMemoryBackend) ListMembers(onlyAssociated bool, nextToken string, maxResults int) ([]*Member, string)

func (*InMemoryBackend) ListOrganizationAdminAccounts

func (b *InMemoryBackend) ListOrganizationAdminAccounts(nextToken string, maxResults int) ([]*OrgAdminAccount, string)

func (*InMemoryBackend) ListSecurityControlDefinitions

func (b *InMemoryBackend) ListSecurityControlDefinitions(
	_, nextToken string,
	maxResults int,
) ([]*SecurityControlDefinition, string)

func (*InMemoryBackend) ListStandardsControlAssociations

func (b *InMemoryBackend) ListStandardsControlAssociations(
	securityControlID, nextToken string,
	maxResults int,
) ([]*StandardsControlAssociation, string)

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

func (*InMemoryBackend) RegisterConnectorV2

func (b *InMemoryBackend) RegisterConnectorV2(connectorID string, provider map[string]any) (*ConnectorV2, error)

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

func (*InMemoryBackend) StartConfigurationPolicyAssociation

func (b *InMemoryBackend) StartConfigurationPolicyAssociation(
	configPolicyIdentifier, targetID, targetType string,
) (*ConfigurationPolicyAssociation, error)

func (*InMemoryBackend) StartConfigurationPolicyDisassociation

func (b *InMemoryBackend) StartConfigurationPolicyDisassociation(
	configPolicyIdentifier, targetID, targetType string,
) error

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error

func (*InMemoryBackend) UpdateActionTarget

func (b *InMemoryBackend) UpdateActionTarget(actionTargetArn, name, description string) error

func (*InMemoryBackend) UpdateAggregatorV2

func (b *InMemoryBackend) UpdateAggregatorV2(arn, regionLinkingMode string, regions []string) (*AggregatorV2, error)

func (*InMemoryBackend) UpdateAutomationRuleV2

func (b *InMemoryBackend) UpdateAutomationRuleV2(
	identifier string,
	updates map[string]any,
) (*AutomationRuleV2, error)

func (*InMemoryBackend) UpdateConfigurationPolicy

func (b *InMemoryBackend) UpdateConfigurationPolicy(
	identifier, name, description string,
	policy map[string]any,
) (*ConfigurationPolicy, error)

func (*InMemoryBackend) UpdateConnectorV2

func (b *InMemoryBackend) UpdateConnectorV2(
	connectorID, name, description string,
	provider map[string]any,
) (*ConnectorV2, error)

func (*InMemoryBackend) UpdateFindingAggregator

func (b *InMemoryBackend) UpdateFindingAggregator(
	arn, regionLinkingMode string,
	regions []string,
) (*FindingAggregator, error)

func (*InMemoryBackend) UpdateFindings

func (b *InMemoryBackend) UpdateFindings(filters map[string]any, note map[string]any, recordState string) error

func (*InMemoryBackend) UpdateHubConfiguration

func (b *InMemoryBackend) UpdateHubConfiguration(
	autoEnableControls *bool,
	autoEnableStandards *string,
	controlFindingGenerator *string,
) error

func (*InMemoryBackend) UpdateInsight

func (b *InMemoryBackend) UpdateInsight(insightArn, name, groupByAttribute string, filters map[string]any) error

func (*InMemoryBackend) UpdateOrganizationConfiguration

func (b *InMemoryBackend) UpdateOrganizationConfiguration(
	autoEnable bool,
	autoEnableStandards string,
	orgConfigType string,
) error

func (*InMemoryBackend) UpdateSecurityControl

func (b *InMemoryBackend) UpdateSecurityControl(
	securityControlID string,
	parameters map[string]any,
	_ string,
) error

func (*InMemoryBackend) UpdateStandardsControl

func (b *InMemoryBackend) UpdateStandardsControl(controlArn, controlStatus, disabledReason string) error

type Insight

type Insight struct {
	Filters          map[string]any `json:"Filters"`
	InsightArn       string         `json:"InsightArn"`
	Name             string         `json:"Name"`
	GroupByAttribute string         `json:"GroupByAttribute"`
}

Insight represents a SecurityHub insight.

type InsightResults

type InsightResults struct {
	InsightArn       string
	GroupByAttribute string
	ResultValues     []map[string]any
}

InsightResults holds GetInsightResults response data.

type Invitation

type Invitation struct {
	AccountId    string `json:"AccountId"`    //nolint:revive,staticcheck // existing issue.
	InvitationId string `json:"InvitationId"` //nolint:revive,staticcheck // existing issue.
	InvitedAt    string `json:"InvitedAt"`
	MemberStatus string `json:"MemberStatus"`
}

Invitation represents a pending invitation.

type Member

type Member struct {
	AccountId       string `json:"AccountId"`       //nolint:revive,staticcheck // existing issue.
	AdministratorId string `json:"AdministratorId"` //nolint:revive,staticcheck // existing issue.
	MasterId        string `json:"MasterId"`        // deprecated alias //nolint:revive,staticcheck // existing issue.
	Email           string `json:"Email"`
	MemberStatus    string `json:"MemberStatus"`
	InvitedAt       string `json:"InvitedAt"`
	UpdatedAt       string `json:"UpdatedAt"`
}

Member represents a Security Hub member account.

type OrgAdminAccount

type OrgAdminAccount struct {
	AccountId string `json:"AccountId"` //nolint:revive,staticcheck // existing issue.
	Status    string `json:"Status"`
}

OrgAdminAccount represents an organization admin account.

type OrgConfig

type OrgConfig struct {
	AutoEnableStandards           string `json:"AutoEnableStandards"`
	OrganizationConfigurationType string `json:"OrganizationConfigurationType"`
	AutoEnable                    bool   `json:"AutoEnable"`
	MemberAccountLimitReached     bool   `json:"MemberAccountLimitReached"`
}

OrgConfig represents the organization configuration.

type Product

type Product struct {
	ProductArn                        string
	ProductName                       string
	CompanyName                       string
	Description                       string
	MarketplaceURL                    string
	ActivationURL                     string
	ProductSubscriptionResourcePolicy string
	Categories                        []string
	IntegrationTypes                  []string
}

Product represents an integration product.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS SecurityHub.

func (*Provider) Init

Init initializes the SecurityHub service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RecommendedPolicyV2

type RecommendedPolicyV2 struct {
	MetadataUid    string `json:"MetadataUid"` //nolint:revive,staticcheck // existing issue.
	Policy         string `json:"Policy"`
	GenerationTime string `json:"GenerationTime"`
}

RecommendedPolicyV2 represents a recommended IAM policy.

type SecurityControl

type SecurityControl struct {
	SecurityControlID     string
	SecurityControlArn    string
	Title                 string
	Description           string
	RemediationURL        string
	SeverityRating        string
	SecurityControlStatus string
	UpdateStatus          string
	Parameters            map[string]any
	LastUpdateReason      string
}

SecurityControl represents the current state of a security control.

type SecurityControlDefinition

type SecurityControlDefinition struct {
	ParameterDefinitions      map[string]any
	SecurityControlID         string
	Title                     string
	Description               string
	RemediationURL            string
	SeverityRating            string
	CurrentRegionAvailability string
	CustomizableProperties    []string
}

SecurityControlDefinition represents a security control definition.

type Standard

type Standard struct {
	StandardsManagedBy map[string]any
	StandardsArn       string
	Name               string
	Description        string
	EnabledByDefault   bool
}

Standard represents an available standard.

type StandardsControl

type StandardsControl struct {
	StandardsControlArn    string   `json:"StandardsControlArn"`
	ControlStatus          string   `json:"ControlStatus"`
	DisabledReason         string   `json:"DisabledReason"`
	ControlStatusUpdatedAt string   `json:"ControlStatusUpdatedAt"`
	ControlID              string   `json:"ControlId"`
	Title                  string   `json:"Title"`
	Description            string   `json:"Description"`
	RemediationURL         string   `json:"RemediationUrl"`
	SeverityRating         string   `json:"SeverityRating"`
	RelatedRequirements    []string `json:"RelatedRequirements"`
}

StandardsControl represents a control in an enabled standard.

type StandardsControlAssociation

type StandardsControlAssociation struct {
	SecurityControlID           string
	StandardsArn                string
	AssociationStatus           string
	RelatedRequirements         []string
	UpdatedAt                   string
	UpdatedReason               string
	StandardsControlTitle       string
	StandardsControlDescription string
	StandardsControlArns        []string
}

StandardsControlAssociation represents association between security control and standard.

type StandardsSubscription

type StandardsSubscription struct {
	StandardsInput           map[string]string `json:"StandardsInput"`
	StatusReason             map[string]any    `json:"StatusReason"`
	StandardsSubscriptionArn string            `json:"StandardsSubscriptionArn"`
	StandardsArn             string            `json:"StandardsArn"`
	StandardsStatus          string            `json:"StandardsStatus"`
}

StandardsSubscription represents an enabled standard.

type StorageBackend

type StorageBackend interface {
	// Hub management
	EnableHub(enableDefaultStandards bool, tags map[string]string) error
	DisableHub() error
	DescribeHub() (*Hub, error)
	UpdateHubConfiguration(autoEnableControls *bool, autoEnableStandards *string, controlFindingGenerator *string) error

	// Findings
	ImportFindings(findings []map[string]any) (int, int, []map[string]any)
	GetFindings(
		filters map[string]any,
		sortCriteria []map[string]any,
		nextToken string,
		maxResults int,
	) ([]map[string]any, string)
	UpdateFindings(filters map[string]any, note map[string]any, recordState string) error
	BatchUpdateFindings(
		findingIdentifiers []map[string]any,
		updates map[string]any,
	) ([]map[string]any, []map[string]any)
	GetFindingHistory(
		findingIdentifier map[string]any,
		startTime, endTime string,
		nextToken string,
		maxResults int,
	) ([]map[string]any, string)

	// Insights
	CreateInsight(name, groupByAttribute string, filters map[string]any) (string, error)
	GetInsights(insightArns []string, nextToken string, maxResults int) ([]*Insight, string, error)
	UpdateInsight(insightArn, name, groupByAttribute string, filters map[string]any) error
	DeleteInsight(insightArn string) (string, error)
	GetInsightResults(insightArn string) (*InsightResults, error)

	// Standards
	BatchEnableStandards(requests []map[string]any) ([]*StandardsSubscription, []map[string]any)
	BatchDisableStandards(subscriptionArns []string) ([]*StandardsSubscription, []map[string]any)
	GetEnabledStandards(subscriptionArns []string, nextToken string, maxResults int) ([]*StandardsSubscription, string)
	DescribeStandards(nextToken string, maxResults int) ([]*Standard, string)
	DescribeStandardsControls(subscriptionArn, nextToken string, maxResults int) ([]*StandardsControl, string)
	UpdateStandardsControl(controlArn, controlStatus, disabledReason string) error
	ListStandardsControlAssociations(
		securityControlID, nextToken string,
		maxResults int,
	) ([]*StandardsControlAssociation, string)
	BatchGetStandardsControlAssociations(requests []map[string]any) ([]*StandardsControlAssociation, []map[string]any)
	BatchUpdateStandardsControlAssociations(updates []map[string]any) ([]map[string]any, error)

	// Action Targets
	CreateActionTarget(name, description, id string) (string, error)
	DescribeActionTargets(actionTargetArns []string, nextToken string, maxResults int) ([]*ActionTarget, string)
	UpdateActionTarget(actionTargetArn, name, description string) error
	DeleteActionTarget(actionTargetArn string) (string, error)

	// Products
	DescribeProducts(productArn, nextToken string, maxResults int) ([]*Product, string)
	EnableImportFindingsForProduct(productArn string) (string, error)
	DisableImportFindingsForProduct(productSubscriptionArn string) error
	ListEnabledProductsForImport(nextToken string, maxResults int) ([]string, string)

	// Security Controls
	GetSecurityControlDefinition(securityControlID string) (*SecurityControlDefinition, error)
	ListSecurityControlDefinitions(
		standardsArn, nextToken string,
		maxResults int,
	) ([]*SecurityControlDefinition, string)
	BatchGetSecurityControls(securityControlIDs []string) ([]*SecurityControl, []map[string]any)
	UpdateSecurityControl(securityControlID string, parameters map[string]any, lastUpdateReason string) error

	// Automation Rules
	CreateAutomationRule(rule map[string]any) (string, string)
	ListAutomationRules(nextToken string, maxResults int) ([]*AutomationRuleMetadata, string)
	BatchGetAutomationRules(automationRulesArns []string) ([]*AutomationRule, []map[string]any)
	BatchDeleteAutomationRules(automationRulesArns []string) ([]string, []map[string]any)
	BatchUpdateAutomationRules(updates []map[string]any) ([]string, []map[string]any)

	// Tags
	TagResource(resourceArn string, tags map[string]string) error
	UntagResource(resourceArn string, tagKeys []string) error
	ListTagsForResource(resourceArn string) (map[string]string, error)

	// Members
	CreateMembers(accounts []map[string]any) ([]*Member, []map[string]any)
	DeleteMembers(accountIDs []string) ([]string, []map[string]any)
	GetMembers(accountIDs []string) ([]*Member, []map[string]any)
	InviteMembers(accountIDs []string) []map[string]any
	ListMembers(onlyAssociated bool, nextToken string, maxResults int) ([]*Member, string)
	DisassociateMembers(accountIDs []string) error

	// Invitations / Admin
	AcceptAdministratorInvitation(administratorID, invitationID string) error
	AcceptInvitation(masterID, invitationID string) error
	DeclineInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
	DeleteInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
	GetInvitationsCount() int
	ListInvitations(nextToken string, maxResults int) ([]*Invitation, string)
	GetAdministratorAccount() (*AdminAccount, error)
	GetMasterAccount() (*AdminAccount, error)
	DisassociateFromAdministratorAccount() error
	DisassociateFromMasterAccount() error

	// Organization
	DescribeOrganizationConfiguration() *OrgConfig
	UpdateOrganizationConfiguration(autoEnable bool, autoEnableStandards string, orgConfigType string) error
	EnableOrganizationAdminAccount(accountID string) error
	DisableOrganizationAdminAccount(accountID string) error
	ListOrganizationAdminAccounts(nextToken string, maxResults int) ([]*OrgAdminAccount, string)

	// Finding Aggregator
	CreateFindingAggregator(regionLinkingMode string, regions []string) (*FindingAggregator, error)
	GetFindingAggregator(arn string) (*FindingAggregator, error)
	ListFindingAggregators(nextToken string, maxResults int) ([]*FindingAggregator, string)
	UpdateFindingAggregator(arn, regionLinkingMode string, regions []string) (*FindingAggregator, error)
	DeleteFindingAggregator(arn string) error

	// Configuration Policy
	CreateConfigurationPolicy(
		name, description string,
		policy map[string]any,
		tags map[string]string,
	) (*ConfigurationPolicy, error)
	GetConfigurationPolicy(identifier string) (*ConfigurationPolicy, error)
	UpdateConfigurationPolicy(identifier, name, description string, policy map[string]any) (*ConfigurationPolicy, error)
	DeleteConfigurationPolicy(identifier string) error
	ListConfigurationPolicies(nextToken string, maxResults int) ([]*ConfigurationPolicy, string)
	StartConfigurationPolicyAssociation(
		configPolicyIdentifier, targetID, targetType string,
	) (*ConfigurationPolicyAssociation, error)
	StartConfigurationPolicyDisassociation(configPolicyIdentifier, targetID, targetType string) error
	GetConfigurationPolicyAssociation(targetID, targetType string) (*ConfigurationPolicyAssociation, error)
	ListConfigurationPolicyAssociations(
		filterPolicyID, filterType, nextToken string,
		maxResults int,
	) ([]*ConfigurationPolicyAssociation, string)
	BatchGetConfigurationPolicyAssociations(
		requests []map[string]any,
	) ([]*ConfigurationPolicyAssociation, []map[string]any)

	// Hub V2
	EnableSecurityHubV2(tags map[string]string) error
	DisableSecurityHubV2() error
	DescribeSecurityHubV2() (*HubV2, error)

	// Aggregator V2
	CreateAggregatorV2(regionLinkingMode string, regions []string) (*AggregatorV2, error)
	GetAggregatorV2(arn string) (*AggregatorV2, error)
	ListAggregatorsV2(nextToken string, maxResults int) ([]*AggregatorV2, string)
	UpdateAggregatorV2(arn, regionLinkingMode string, regions []string) (*AggregatorV2, error)
	DeleteAggregatorV2(arn string) error

	// Automation Rules V2
	CreateAutomationRuleV2(
		ruleName, ruleStatus, description string,
		criteria map[string]any,
		actions []map[string]any,
		ruleOrder float64,
		isTerminal bool,
		tags map[string]string,
	) (*AutomationRuleV2, error)
	GetAutomationRuleV2(identifier string) (*AutomationRuleV2, error)
	ListAutomationRulesV2(nextToken string, maxResults int) ([]*AutomationRuleV2, string)
	UpdateAutomationRuleV2(identifier string, updates map[string]any) (*AutomationRuleV2, error)
	DeleteAutomationRuleV2(identifier string) error

	// Connectors V2
	CreateConnectorV2(name, description string, provider map[string]any, tags map[string]string) (*ConnectorV2, error)
	GetConnectorV2(connectorID string) (*ConnectorV2, error)
	ListConnectorsV2(nextToken string, maxResults int) ([]*ConnectorV2, string)
	UpdateConnectorV2(connectorID, name, description string, provider map[string]any) (*ConnectorV2, error)
	DeleteConnectorV2(connectorID string) error
	RegisterConnectorV2(connectorID string, provider map[string]any) (*ConnectorV2, error)

	// Tickets V2
	CreateTicketV2(ticketConfig map[string]any, tags map[string]string) (*TicketV2, error)

	// Findings V2
	GetFindingsV2(
		filters map[string]any,
		sortCriteria []map[string]any,
		nextToken string,
		maxResults int,
	) ([]map[string]any, string)
	BatchUpdateFindingsV2(
		findingIdentifiers []map[string]any,
		updates map[string]any,
	) ([]map[string]any, []map[string]any)
	GetFindingStatisticsV2(groupByAttributes []string) []map[string]any
	GetFindingsTrendsV2(groupByAttribute string, startTime, endTime string) []map[string]any

	// Resources V2
	GetResourcesV2(filters map[string]any, nextToken string, maxResults int) ([]map[string]any, string)
	GetResourcesStatisticsV2(groupByAttributes []string) []map[string]any
	GetResourcesTrendsV2(groupByAttribute string, startTime, endTime string) []map[string]any

	// Products V2
	DescribeProductsV2(nextToken string, maxResults int) ([]*Product, string)

	// Recommended Policy V2
	GenerateRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
	GetRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)

	// Metadata
	AccountID() string
	Region() string
	Reset()
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for SecurityHub storage operations.

type TicketV2

type TicketV2 struct {
	TicketConfigurationArn string `json:"TicketConfigurationArn"`
	CreatedAt              string `json:"CreatedAt"`
}

TicketV2 represents a Security Hub V2 ticket configuration.

Jump to

Keyboard shortcuts

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