analyzers

package
v3.80.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	READ       PermissionType = "Read"
	WRITE      PermissionType = "Write"
	READ_WRITE PermissionType = "Read & Write"
	NONE       PermissionType = "None"
	ERROR      PermissionType = "Error"

	FullAccess string = "full_access"
)

Variables

View Source
var DefaultWriter = color.New().SprintFunc()
View Source
var GreenWriter = color.New(color.FgGreen).SprintFunc()
View Source
var RedWriter = color.New(color.FgRed).SprintFunc()
View Source
var YellowWriter = color.New(color.FgYellow).SprintFunc()

Functions

func CreateLogFileName

func CreateLogFileName(baseName string) string

func GetWriterFromStatus

func GetWriterFromStatus(status PermissionType) func(a ...interface{}) string

func NewAnalyzeClient

func NewAnalyzeClient(cfg *config.Config) *http.Client

func StatusContains

func StatusContains(status int, vals []int) bool

Types

type AnalyzeClient

type AnalyzeClient struct {
	http.Client
	LoggingEnabled bool
	LogFile        string
}

type Analyzer

type Analyzer interface {
	Type() analyzerpb.AnalyzerType
	Analyze(ctx context.Context, credentialInfo map[string]string) (*AnalyzerResult, error)
}

type AnalyzerResult

type AnalyzerResult struct {
	AnalyzerType       analyzerpb.AnalyzerType
	Bindings           []Binding
	UnboundedResources []Resource
	Metadata           map[string]any
}

AnalyzerResult is the output of analysis.

type Binding

type Binding struct {
	Resource   Resource
	Permission Permission
}

type HttpStatusTest

type HttpStatusTest struct {
	URL     string
	Method  string
	Payload map[string]interface{}
	Params  map[string]string
	Valid   []int
	Invalid []int
	Type    PermissionType
	Status  PermissionStatus
	Risk    string
}

func (*HttpStatusTest) RunTest

func (h *HttpStatusTest) RunTest(headers map[string]string) error

type LoggingRoundTripper

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

func (LoggingRoundTripper) RoundTrip

func (r LoggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Permission

type Permission struct {
	Value       string
	AccessLevel string
	Parent      *Permission
}

type PermissionStatus

type PermissionStatus struct {
	Value   bool
	IsError bool
}

type PermissionType

type PermissionType string

type Resource

type Resource struct {
	Name               string
	FullyQualifiedName string
	Type               string
	Metadata           map[string]any
	Parent             *Resource
}

type Scope

type Scope struct {
	Name  string
	Tests []interface{}
}

Jump to

Keyboard shortcuts

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