controller

package
v0.0.0-...-f44e450 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: BSD-3-Clause Imports: 40 Imported by: 0

Documentation

Overview

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2023 Meta Platforms, Inc. and affiliates.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHostnameFromCtx

func ExtractHostnameFromCtx(ctx context.Context) (hostname string, isVerified bool)

ExtractHostnameFromCtx extracts hostname from provided thrift context

Types

type AnalyzerFirmwareAccessor

type AnalyzerFirmwareAccessor = controllertypes.AnalyzerFirmwareAccessor

AnalyzerFirmwareAccessor implements analysis.Blob, but it is serialized with the ImageID instead of the image content.

type AnalyzerFirmwaresAccessor

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

AnalyzerFirmwaresAccessor implements analyzerinput.FirmwaresAccessor for a Controller

func NewAnalyzerFirmwaresAccessor

func NewAnalyzerFirmwaresAccessor(
	storage Storage,
	originalFirmwareStorage originalFWImageRepository,
	imageSaverAsync imageSaverAsync,
	targetModelID *int64,
) *AnalyzerFirmwaresAccessor

NewAnalyzerFirmwaresAccessor creates a new instance of AnalyzerFirmwaresAccessor. It provides firmware images as serializable analysis.Blob-s. Serialized analysis.Blob will contain only ImageID to an image, which is saved to the BlobStorage storage. Thus any of these analysis.Blob-s could be saved to MySQL (as part of an Analyze report), deserialized back and reused.

TODO: try to polish-up function signature (for example, consider merging rtpFW and firmwareEvaluationStatus)

func (*AnalyzerFirmwaresAccessor) GetByBlob

func (a *AnalyzerFirmwaresAccessor) GetByBlob(ctx context.Context, image []byte) (analysis.Blob, error)

GetByBlob implements analyzerinput.FirmwaresAccessor (see the description of AnalyzerFirmwaresAccessor).

func (*AnalyzerFirmwaresAccessor) GetByID

GetByID implements analyzerinput.FirmwaresAccessor (see the description of AnalyzerFirmwaresAccessor).

func (*AnalyzerFirmwaresAccessor) GetByVersion

func (a *AnalyzerFirmwaresAccessor) GetByVersion(
	ctx context.Context,
	firmwareVersion string,
) (analysis.Blob, error)

GetByVersionAndDate implements analyzerinput.FirmwaresAccessor (see the description of AnalyzerFirmwaresAccessor).

type Controller

type Controller struct {
	Context                   context.Context
	ContextCancel             context.CancelFunc
	FirmwareStorage           Storage
	DeviceGetter              DeviceGetter
	OriginalFWDB              firmwaredb.DB
	OriginalFWImageRepository originalFWImageRepository
	// contains filtered or unexported fields
}

Controller implement the high-level logic of the firmware-analysis service.

func New

func New(
	ctx context.Context,
	firmwareStorage Storage,
	origFirmwareDB firmwaredb.DB,
	origFirmwareRepo originalFWImageRepository,
	analysisDataCalculator analysisDataCalculatorInterface,
	deviceGetter DeviceGetter,
	apiCachePurgeTimeout time.Duration,
) (*Controller, error)

func (*Controller) Analyze

func (ctrl *Controller) Analyze(
	ctx context.Context,
	hostInfo *afas.HostInfo,
	artifacts []afas.Artifact,
	analyzers []afas.AnalyzerInput,
) (*afas.AnalyzeResult_, error)

Analyze provides firmware analysis by specified algorithms

func (*Controller) CheckFirmwareVersion

func (ctrl *Controller) CheckFirmwareVersion(
	ctx context.Context,
	checkedVersions []afas.FirmwareVersion,
) ([]bool, error)

CheckFirmwareVersion checks

func (*Controller) Close

func (ctrl *Controller) Close() error

Close stops the Controller and blocks until all goroutines from launchAsync rejoin.

Invariants:

  1. Close will wait for goroutines to rejoin before invalidating any state
  2. After Close has been called, launchAsync will fail with context.Canceled
  3. Goroutines MUST NOT call Close
  4. Goroutines MUST return promptly when their context is cancelled

func (*Controller) SearchFirmware

func (ctrl *Controller) SearchFirmware(
	ctx context.Context,
	filters []*afas.SearchFirmwareFilters,
	shouldFetchContent bool,
) (*SearchFirmwareResult, error)

SearchFirmware returns metadata information about firmwares which fits into requested select/search filters.

func (*Controller) SearchReport

func (ctrl *Controller) SearchReport(
	ctx context.Context,
	requestFilters []*afas.SearchReportFilters,
	limit uint64,
) (*SearchReportResult, error)

SearchReport a previously saved report (it is extracted from scuba).

type DeviceGetter

type DeviceGetter interface {
	GetDeviceByHostname(hostname string) (*device.Device, error)
	GetDeviceByAssetID(assetID int64) (*device.Device, error)
}

type ErrDecompressReceived

type ErrDecompressReceived struct {
	Err error
}

ErrDecompressReceived implements "error", for the description see Error.

func (ErrDecompressReceived) Error

func (err ErrDecompressReceived) Error() string

func (ErrDecompressReceived) Unwrap

func (err ErrDecompressReceived) Unwrap() error

type ErrFetchOrigFirmware

type ErrFetchOrigFirmware struct {
	Version string
	Err     error
}

ErrFetchOrigFirmware implements "error", for the description see Error.

func NewErrFetchOrigFirmware

func NewErrFetchOrigFirmware(biosVersion string, err error) ErrFetchOrigFirmware

NewErrFetchOrigFirmware creates a new ErrFetchOrigFirmware object

func (ErrFetchOrigFirmware) Error

func (err ErrFetchOrigFirmware) Error() string

func (ErrFetchOrigFirmware) ThriftException

func (err ErrFetchOrigFirmware) ThriftException() error

ThriftException converts the error into a thrift format

func (ErrFetchOrigFirmware) Unwrap

func (err ErrFetchOrigFirmware) Unwrap() error

type ErrGetFirmwarePair

type ErrGetFirmwarePair struct {
	Err error
}

ErrGetFirmwarePair implements "error", for the description see Error.

func (ErrGetFirmwarePair) Error

func (err ErrGetFirmwarePair) Error() string

func (ErrGetFirmwarePair) Unwrap

func (err ErrGetFirmwarePair) Unwrap() error

type ErrGetTagStore

type ErrGetTagStore struct {
	// Err is the initialization error
	Err error
}

ErrGetTagStore implements "error", for the description see Error.

func (ErrGetTagStore) Error

func (err ErrGetTagStore) Error() string

func (ErrGetTagStore) Unwrap

func (err ErrGetTagStore) Unwrap() error

type ErrInitAnalysisExecutor

type ErrInitAnalysisExecutor struct {
	// Err is the initialization error
	Err error
}

ErrInitAnalysisExecutor implements "error", for the description see Error.

func (ErrInitAnalysisExecutor) Error

func (err ErrInitAnalysisExecutor) Error() string

func (ErrInitAnalysisExecutor) Unwrap

func (err ErrInitAnalysisExecutor) Unwrap() error

type ErrInitCache

type ErrInitCache struct {
	// For describes the purpose of the cache, which initialization have failed.
	For string

	// Err is the initialization error
	Err error
}

ErrInitCache implements "error", for the description see Error.

func (ErrInitCache) Error

func (err ErrInitCache) Error() string

func (ErrInitCache) Unwrap

func (err ErrInitCache) Unwrap() error

type ErrInitDataCalculator

type ErrInitDataCalculator struct {
	// Err is the initialization error
	Err error
}

ErrInitDataCalculator implements "error", for the description see Error.

func (ErrInitDataCalculator) Error

func (err ErrInitDataCalculator) Error() string

func (ErrInitDataCalculator) Unwrap

func (err ErrInitDataCalculator) Unwrap() error

type ErrInitStorage

type ErrInitStorage struct {
	Err error
}

ErrInitStorage implements "error", for the description see Error.

func (ErrInitStorage) Error

func (err ErrInitStorage) Error() string

func (ErrInitStorage) Unwrap

func (err ErrInitStorage) Unwrap() error

type ErrInvalidDataSource

type ErrInvalidDataSource struct{}

ErrInvalidDataSource means the provided DataSource value is not supported.

func (ErrInvalidDataSource) Error

func (err ErrInvalidDataSource) Error() string

type ErrInvalidHostConfiguration

type ErrInvalidHostConfiguration struct {
	Err error
}

ErrInvalidHostConfiguration describes a situation when host configuration is invalid For example due to broken registers

func NewErrInvalidHostConfiguration

func NewErrInvalidHostConfiguration(err error) ErrInvalidHostConfiguration

NewErrInvalidHostConfiguration creates a new ErrInvalidHostConfiguration object

func (ErrInvalidHostConfiguration) Error

func (err ErrInvalidHostConfiguration) Error() string

func (ErrInvalidHostConfiguration) ThriftException

func (err ErrInvalidHostConfiguration) ThriftException() error

ThriftException converts a Go err type into a Thrift Exception type

func (ErrInvalidHostConfiguration) Unwrap

func (err ErrInvalidHostConfiguration) Unwrap() error

type ErrInvalidImageID

type ErrInvalidImageID struct {
	Err error
}

ErrInvalidImageID means the provided image ID could not be used, for example there is no image with such ID in BlobStorage.

func (ErrInvalidImageID) Error

func (err ErrInvalidImageID) Error() string

func (ErrInvalidImageID) Unwrap

func (err ErrInvalidImageID) Unwrap() error

type ErrInvalidMeasurementFlow

type ErrInvalidMeasurementFlow struct {
	Err error
}

ErrInvalidMeasurementFlow means input PCR measurements flow is unknown.

func (ErrInvalidMeasurementFlow) Error

func (err ErrInvalidMeasurementFlow) Error() string

func (ErrInvalidMeasurementFlow) Unwrap

func (err ErrInvalidMeasurementFlow) Unwrap() error

type ErrInvalidTPMType

type ErrInvalidTPMType struct {
	Err error
}

ErrInvalidTPMType means input TPM type is unknown.

func (ErrInvalidTPMType) Error

func (err ErrInvalidTPMType) Error() string

func (ErrInvalidTPMType) Unwrap

func (err ErrInvalidTPMType) Unwrap() error

type ErrNoImage

type ErrNoImage struct{}

ErrNoImage is a generic error to specify a case, where an action could not be performed, because no image was specified.

func (ErrNoImage) Error

func (err ErrNoImage) Error() string

type ErrNoOrigImageToCompareWith

type ErrNoOrigImageToCompareWith = helpers.ErrNoOrigImageToCompareWith

type ErrParseFirmware

type ErrParseFirmware struct {
	Err error
}

ErrParseFirmware implements "error", for the description see Error.

func (ErrParseFirmware) Error

func (err ErrParseFirmware) Error() string

func (ErrParseFirmware) Unwrap

func (err ErrParseFirmware) Unwrap() error

type ErrParseOrigFirmware

type ErrParseOrigFirmware struct {
	Version string
	Err     error
}

ErrParseOrigFirmware implements "error", for the description see Error.

func NewErrParseOrigFirmware

func NewErrParseOrigFirmware(version string, err error) ErrParseOrigFirmware

NewErrParseOrigFirmware creates a new ErrParseOrigFirmware object

func (ErrParseOrigFirmware) Error

func (err ErrParseOrigFirmware) Error() string

func (ErrParseOrigFirmware) ThriftException

func (err ErrParseOrigFirmware) ThriftException() error

ThriftException converts a Go err type into a Thrift Exception type

func (ErrParseOrigFirmware) Unwrap

func (err ErrParseOrigFirmware) Unwrap() error

type ErrParseReceivedFirmware

type ErrParseReceivedFirmware struct {
	Err error
}

ErrParseReceivedFirmware implements "error", for the description see Error.

func (ErrParseReceivedFirmware) Error

func (err ErrParseReceivedFirmware) Error() string

func (ErrParseReceivedFirmware) Unwrap

func (err ErrParseReceivedFirmware) Unwrap() error

type ErrSameImage

type ErrSameImage struct{}

ErrSameImage means the image was not saved because it is the same as the original imaged, and therefore to avoid double-saving the same image, this image was skipped.

func (ErrSameImage) Error

func (err ErrSameImage) Error() string

type ErrUnableToGetDiffReport

type ErrUnableToGetDiffReport struct {
	Err error
}

ErrUnableToGetDiffReport is returned when it was unable to get a diff report for selected images.

func (ErrUnableToGetDiffReport) Error

func (err ErrUnableToGetDiffReport) Error() string

func (ErrUnableToGetDiffReport) Unwrap

func (err ErrUnableToGetDiffReport) Unwrap() error

type FirmwareAccessor

type FirmwareAccessor struct {
	ImageID types.ImageID
	// contains filtered or unexported fields
}

FirmwareAccessor implements analysis.Blob given

func (*FirmwareAccessor) Bytes

func (fw *FirmwareAccessor) Bytes() []byte

Bytes implements analysis.Blob

func (*FirmwareAccessor) Init

func (fw *FirmwareAccessor) Init(ctx context.Context, storage Storage) error

Init initializes the FirmwareAccessor after it was deserialized.

type SearchFirmwareResult

type SearchFirmwareResult = afas.SearchFirmwareResult_

SearchFirmwareResult is the metadata information about firmwares which fits // into requested select/search filters.

type SearchReportResult

type SearchReportResult = afas.SearchReportResult_

type Storage

type Storage interface {
	io.Closer

	// Image
	InsertFirmware(ctx context.Context, imageMeta models.FirmwareImageMetadata, imageData []byte) error
	GetFirmware(ctx context.Context, imageID types.ImageID) ([]byte, *models.FirmwareImageMetadata, error)
	GetFirmwareBytes(ctx context.Context, imageID types.ImageID) (firmwareImage []byte, err error)
	FindFirmware(ctx context.Context, filters storage.FindFirmwareFilter) (imageMetas []*models.FirmwareImageMetadata, unlockFn context.CancelFunc, err error)
	FindFirmwareOne(ctx context.Context, filters storage.FindFirmwareFilter) (*models.FirmwareImageMetadata, context.CancelFunc, error)

	// ReproducedPCRs
	UpsertReproducedPCRs(ctx context.Context, reproducedPCRs models.ReproducedPCRs) error

	// AnalyzeReport
	InsertAnalyzeReport(ctx context.Context, report *models.AnalyzeReport) error
	FindAnalyzeReports(ctx context.Context, filterInput storage.AnalyzeReportFindFilter, tx *sqlx.Tx, limit uint) ([]*models.AnalyzeReport, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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