contracts

package
v0.0.0-...-e37d69e Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

******************************************************************************

  • Copyright 2021 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2021 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (
	// HttpRequestKey is the key used to reference the value within the incoming Context that corresponds to the request we need to validate.
	HttpRequestKey  string = "HttpRequestKey"
	ContentLength   string = "Content-Length"
	HttpContentType string = "Content-Type"
)
View Source
const TagEnvKey = "TAG"

TagEnvKey is an environment key used to associate annotations with specific metadata, aiding in the linkage of scores across different layers of the stack. For instance, in the "app" layer, it is utilized to retrieve the commit SHA of the workload where the application is running, which is instrumental in tracing the impact on the current layer's score from the lower layers.

Variables

This section is empty.

Functions

func NewULID

func NewULID() ulid.ULID

NewULID is a convenience function for generating ULIDs where necessary. It is based on the example showing the "quick" method for initializing the algorithm's entropy parameter. https://github.com/oklog/ulid/blob/c6bb9e1d94a82e71dfd7ff279aa6cea7c52779bb/cmd/ulid/main.go#L67 As described on that page, quick means "when generating, use non-crypto-grade entropy".

Types

type Annotation

type Annotation struct {
	Id          ulid.ULID      `json:"id,omitempty"`        // Id should probably be a ULID -- uniquely identifies the annotation itself
	Key         string         `json:"key,omitempty"`       // Key is the hash value of the data being annotated
	Hash        HashType       `json:"hash,omitempty"`      // Hash identifies which algorithm was used to construct the hash
	Host        string         `json:"host,omitempty"`      // Host is the hostname of the node making the annotation
	Tag         string         `json:"tag,omitempty"`       // Tag is the link between the current layer and the below layer
	Layer       LayerType      `json:"layer,omitempty"`     // Layer is the layer where the annotation was produced
	Kind        AnnotationType `json:"kind,omitempty"`      // Kind indicates what kind of annotation this is
	Signature   string         `json:"signature,omitempty"` // Signature contains the signature of the party making the annotation
	IsSatisfied bool           `json:"isSatisfied"`         // IsSatisfied indicates whether the criteria defining the annotation were fulfilled
	Timestamp   time.Time      `json:"timestamp,omitempty"` // Timestamp indicates when the annotation was created
}

Annotation represents an individual criterion of evaluation in regard to a piece of data

func NewAnnotation

func NewAnnotation(key string, hash HashType, host string, layer LayerType, kind AnnotationType, satisfied bool) Annotation

NewAnnotation is the constructor for an Annotation instance.

func (*Annotation) UnmarshalJSON

func (a *Annotation) UnmarshalJSON(data []byte) (err error)

type AnnotationList

type AnnotationList struct {
	Items []Annotation `json:"items,omitempty"` // Items contains 0-many annotations
}

AnnotationList is an envelope for zero to many annotations

type AnnotationType

type AnnotationType string
const (
	AnnotationPKI     AnnotationType = "pki"
	AnnotationPKIHttp AnnotationType = "pki-http"
	AnnotationSource  AnnotationType = "src"
	AnnotationTLS     AnnotationType = "tls"
	AnnotationTPM     AnnotationType = "tpm"
	// The AnnotationSourceCode, AnnotationChecksum, and AnnotationVulnerability values are used by the scoring apps, they are for CI/CD annotators defined in alvarium-sdk-java project.
	AnnotationSourceCode    AnnotationType = "source-code"
	AnnotationChecksum      AnnotationType = "checksum"
	AnnotationVulnerability AnnotationType = "vulnerability"
	AnnotationSBOM          AnnotationType = "sbom"
)

func (AnnotationType) Validate

func (t AnnotationType) Validate() bool

type ContentType

type ContentType string
const (
	ContentTypeJSON ContentType = "application/json"
)

type DerivedComponent

type DerivedComponent string
const (
	Method      DerivedComponent = "@method"
	TargetURI   DerivedComponent = "@target-uri"
	Authority   DerivedComponent = "@authority"
	Scheme      DerivedComponent = "@scheme"
	Path        DerivedComponent = "@path"
	Query       DerivedComponent = "@query"
	QueryParams DerivedComponent = "@query-params"
)

func (DerivedComponent) Validate

func (d DerivedComponent) Validate() bool

type HashType

type HashType string
const (
	MD5Hash    HashType = "md5"
	SHA256Hash HashType = "sha256"
	NoHash     HashType = "none"
)

func (HashType) Validate

func (t HashType) Validate() bool

type KeyAlgorithm

type KeyAlgorithm string
const (
	KeyEd25519        KeyAlgorithm = "ed25519"
	KeyEcdsaX509      KeyAlgorithm = "ecdsa-x509"
	KeyEcdsaSecp256k1 KeyAlgorithm = "ecdsa-secp256k1"
)

func (KeyAlgorithm) Validate

func (k KeyAlgorithm) Validate() bool

type LayerType

type LayerType string
const (
	Application LayerType = "app"
	CiCd        LayerType = "cicd"
	Os          LayerType = "os"
	Host        LayerType = "host"
)

func (LayerType) Validate

func (l LayerType) Validate() bool

type NetType

type NetType string
const (
	Mainnet    NetType = "mainnet"
	Testnet    NetType = "testnet"
	Previewnet NetType = "previewnet"
	Local      NetType = "local"
)

func (NetType) Validate

func (t NetType) Validate() bool

type StreamType

type StreamType string
const (
	ConsoleStream StreamType = "console"
	MockStream    StreamType = "mock"
	MqttStream    StreamType = "mqtt"
	PravegaStream StreamType = "pravega" // Currently unsupported but indicating extension point
	HederaStream  StreamType = "hedera"
)

func (StreamType) Validate

func (t StreamType) Validate() bool

Jump to

Keyboard shortcuts

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