kubesec

package
v2.0.0-...-0283071 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeSecResults

type KubeSecResults []KubesecResult

KubeSecResults - holds a slice of scan results

func (KubeSecResults) Dump

func (r KubeSecResults) Dump(w io.Writer) error

Dump - calls upstream Dump function and returns an error if any scan object has non-empty error field

type KubesecClient

type KubesecClient struct {
	URL        string // URL to send the request for scanning
	TimeOutSec int    // Scan timeout in seconds
}

KubesecClient represent a client for kubesec.io

func NewClient

func NewClient(url string, timeOutSec int) *KubesecClient

NewClient returns a new client for kubesec.io.

func (*KubesecClient) ScanDefinition

func (kc *KubesecClient) ScanDefinition(def bytes.Buffer) (KubeSecResults, error)

ScanDefinition scans the provided resource definition.

type KubesecResult

type KubesecResult struct {
	Error   string `json:"error"`
	Score   int    `json:"score"`
	Scoring struct {
		Critical []struct {
			Selector string `json:"selector"`
			Reason   string `json:"reason"`
			Weight   int    `json:"weight"`
		} `json:"critical"`
		Advise []struct {
			Selector string `json:"selector"`
			Reason   string `json:"reason"`
			Href     string `json:"href,omitempty"`
		} `json:"advise"`
	} `json:"scoring"`
}

KubesecResult represents a result returned by kubesec.io.

func (*KubesecResult) Dump

func (r *KubesecResult) Dump(w io.Writer)

Dump writes the result in a human-readable format to the specified writer.

Jump to

Keyboard shortcuts

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