proto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0, BSD-3-Clause Imports: 91 Imported by: 1

Documentation

Overview

Package proto provides protobuf related utilities for the SCALIBR binary.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrAdvisoryMissing will be returned if the Advisory is not set on a finding.
	ErrAdvisoryMissing = errors.New("advisory missing in finding")

	// ErrAdvisoryIDMissing will be returned if the Advisory ID is not set on a finding.
	ErrAdvisoryIDMissing = errors.New("advisory ID missing in finding")
)
View Source
var (

	// ErrMultipleSecretLocations will be returned if multiple secret locations are set.
	ErrMultipleSecretLocations = errors.New("multiple secret locations are not supported")

	// ErrUnsupportedValidationType will be returned if the validation type is not supported.
	ErrUnsupportedValidationType = errors.New("validation type is not supported")

	// ErrUnsupportedSecretType will be returned if the secret type is not supported.
	ErrUnsupportedSecretType = errors.New("unsupported secret type")
)
View Source
var (

	// ErrVulnIdentifiersAndMatchsAllSet will be returned if both VulnIdentifiers and MatchesAllVulns are set.
	ErrVulnIdentifiersAndMatchsAllSet = errors.New("cannot set both VulnIdentifiers and MatchesAllVulns")
)

Functions

func FindingVEXToProto added in v0.3.2

FindingVEXToProto converts a struct FindingExploitabilitySignal to its proto representation.

func FindingVEXToStruct added in v0.3.2

FindingVEXToStruct converts a proto FindingExploitabilitySignal to its struct representation.

func GenericFindingToProto added in v0.3.2

func GenericFindingToProto(f *inventory.GenericFinding) (*spb.GenericFinding, error)

GenericFindingToProto converts a GenericFinding go struct into the equivalent proto.

func GenericFindingToStruct added in v0.3.2

func GenericFindingToStruct(f *spb.GenericFinding) (*inventory.GenericFinding, error)

GenericFindingToStruct converts a GenericFinding proto into the equivalent go struct.

func InventoryToProto added in v0.3.0

func InventoryToProto(inv *inventory.Inventory) (*spb.Inventory, error)

InventoryToProto converts a Inventory go struct into the equivalent proto.

func InventoryToStruct added in v0.3.0

func InventoryToStruct(invProto *spb.Inventory) *inventory.Inventory

InventoryToStruct converts a ScanResult proto into the equivalent go struct.

func PackageToProto added in v0.3.2

func PackageToProto(pkg *extractor.Package) (*spb.Package, error)

PackageToProto converts a Package struct to a Package proto.

func PackageToStruct added in v0.3.2

func PackageToStruct(pkgProto *spb.Package) (*extractor.Package, error)

PackageToStruct converts a Package proto to a Package struct.

func PackageVEXToProto added in v0.3.2

PackageVEXToProto converts a struct PackageExploitabilitySignal to its proto representation.

func PackageVEXToStruct added in v0.3.2

PackageVEXToStruct converts a proto PackageExploitabilitySignal to its struct representation.

func PluginStatusToProto added in v0.3.0

func PluginStatusToProto(s *plugin.Status) *spb.PluginStatus

PluginStatusToProto converts a plugin.Status go struct into the equivalent proto.

func PluginStatusToStruct added in v0.3.2

func PluginStatusToStruct(s *spb.PluginStatus) *plugin.Status

PluginStatusToStruct converts a plugin.Status proto into the equivalent go struct.

func ScanResultToProto

func ScanResultToProto(r *result.ScanResult) (*spb.ScanResult, error)

ScanResultToProto converts a ScanResult go struct into the equivalent proto.

func SecretToProto added in v0.3.2

func SecretToProto(s *inventory.Secret) (*spb.Secret, error)

SecretToProto converts a struct Secret to its proto representation.

func SecretToStruct added in v0.3.2

func SecretToStruct(s *spb.Secret) (*inventory.Secret, error)

SecretToStruct converts a proto Secret to its struct representation.

func ValidExtension

func ValidExtension(path string) error

ValidExtension returns an error if the file extension is not a proto file.

func Write

func Write(filePath string, outputProto proto.Message) error

Write writes a proto message to a .textproto or .binproto file, based on the file extension. If the file name additionally has the .gz suffix, it's zipped before writing.

func WriteWithFormat

func WriteWithFormat(filePath string, outputProto proto.Message, format string) error

WriteWithFormat writes a proto message to a .textproto or .binproto file, based on the value of the format parameter ("textproto" or "binproto")

Types

type MetadataProtoSetter added in v0.3.2

type MetadataProtoSetter interface {
	SetProto(p *spb.Package)
}

MetadataProtoSetter is an interface for metadata structs that can set themselves on a Package proto.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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