Documentation
¶
Overview ¶
Package filter предоставляет функциональность для фильтрации компонентов SBOM на основе шаблонов игнорирования и правил исключения.
Index ¶
- type Component
- type IgnoreFilter
- func (f *IgnoreFilter) AddPattern(pattern string)
- func (f *IgnoreFilter) Clear()
- func (f *IgnoreFilter) ClearRemoved()
- func (f *IgnoreFilter) FilterComponents(components []Component) []Component
- func (f *IgnoreFilter) GetPatterns() []string
- func (f *IgnoreFilter) GetRemovedComponents() []RemovedComponent
- func (f *IgnoreFilter) GetRemovedCount() int
- func (f *IgnoreFilter) GetStatistics() map[string]any
- func (f *IgnoreFilter) IsEnabled() bool
- func (f *IgnoreFilter) LoadFromFile(filename string) error
- func (f *IgnoreFilter) LoadPatterns(patterns []string)
- func (f *IgnoreFilter) SaveRemovedPURLs(filename string) error
- func (f *IgnoreFilter) SaveRemovedReport(filename string) error
- func (f *IgnoreFilter) SetEnabled(enabled bool)
- func (f *IgnoreFilter) ShouldIgnore(purl string) bool
- func (f *IgnoreFilter) ShouldIgnoreComponent(purl, name, version string) bool
- func (f *IgnoreFilter) ShouldIgnoreCycloneDXComponent(component *cyclonedx.Component) bool
- type RemovedComponent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
PURL string `json:"purl"`
Name string `json:"name"`
Version string `json:"version"`
}
Component представляет минимальную структуру компонента для фильтрации.
type IgnoreFilter ¶
type IgnoreFilter struct {
// contains filtered or unexported fields
}
IgnoreFilter обрабатывает фильтрацию компонентов на основе шаблонов игнорирования.
func NewIgnoreFilter ¶
func NewIgnoreFilter() *IgnoreFilter
NewIgnoreFilter создает новый фильтр игнорирования.
func (*IgnoreFilter) AddPattern ¶
func (f *IgnoreFilter) AddPattern(pattern string)
AddPattern добавляет один шаблон в фильтр.
func (*IgnoreFilter) Clear ¶
func (f *IgnoreFilter) Clear()
Clear удаляет все шаблоны и сбрасывает список удаленных.
func (*IgnoreFilter) ClearRemoved ¶
func (f *IgnoreFilter) ClearRemoved()
ClearRemoved очищает только список удаленных компонентов.
func (*IgnoreFilter) FilterComponents ¶
func (f *IgnoreFilter) FilterComponents(components []Component) []Component
FilterComponents фильтрует список компонентов на основе шаблонов игнорирования Возвращает отфильтрованный список и обновляет отслеживание удаленных компонентов.
func (*IgnoreFilter) GetPatterns ¶
func (f *IgnoreFilter) GetPatterns() []string
GetPatterns возвращает текущий список шаблонов.
func (*IgnoreFilter) GetRemovedComponents ¶
func (f *IgnoreFilter) GetRemovedComponents() []RemovedComponent
GetRemovedComponents возвращает список всех удаленных компонентов.
func (*IgnoreFilter) GetRemovedCount ¶
func (f *IgnoreFilter) GetRemovedCount() int
GetRemovedCount возвращает количество удаленных компонентов.
func (*IgnoreFilter) GetStatistics ¶
func (f *IgnoreFilter) GetStatistics() map[string]any
GetStatistics возвращает статистику о фильтре.
func (*IgnoreFilter) IsEnabled ¶
func (f *IgnoreFilter) IsEnabled() bool
IsEnabled возвращает, включен ли фильтр.
func (*IgnoreFilter) LoadFromFile ¶
func (f *IgnoreFilter) LoadFromFile(filename string) error
LoadFromFile загружает шаблоны игнорирования из файла (например, .sbomignore).
func (*IgnoreFilter) LoadPatterns ¶
func (f *IgnoreFilter) LoadPatterns(patterns []string)
LoadPatterns загружает шаблоны из среза строк.
func (*IgnoreFilter) SaveRemovedPURLs ¶
func (f *IgnoreFilter) SaveRemovedPURLs(filename string) error
SaveRemovedPURLs сохраняет только PURL удаленных компонентов (простой формат).
func (*IgnoreFilter) SaveRemovedReport ¶
func (f *IgnoreFilter) SaveRemovedReport(filename string) error
SaveRemovedReport сохраняет отчет об удаленных компонентах в файл.
func (*IgnoreFilter) SetEnabled ¶
func (f *IgnoreFilter) SetEnabled(enabled bool)
SetEnabled включает или отключает фильтр.
func (*IgnoreFilter) ShouldIgnore ¶
func (f *IgnoreFilter) ShouldIgnore(purl string) bool
ShouldIgnore проверяет, следует ли игнорировать компонент на основе его PURL Использует точное совпадение подстроки, как указано техническим руководителем.
func (*IgnoreFilter) ShouldIgnoreComponent ¶
func (f *IgnoreFilter) ShouldIgnoreComponent(purl, name, version string) bool
ShouldIgnoreComponent проверяет, следует ли игнорировать компонент и отслеживает его.
func (*IgnoreFilter) ShouldIgnoreCycloneDXComponent ¶ added in v0.3.0
func (f *IgnoreFilter) ShouldIgnoreCycloneDXComponent(component *cyclonedx.Component) bool
ShouldIgnoreCycloneDXComponent проверяет, следует ли игнорировать компонент CycloneDX на основе фильтра. Получатель может быть nil — в этом случае компонент не игнорируется.
Source Files
¶
- ignore_filter.go