util

package
v0.0.0-...-15ee26c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFieldToValueFieldSetMap

func AddFieldToValueFieldSetMap(m map[ssa.Value]*FieldSet, v ssa.Value, f *Field) bool

func CalleeSet

func CalleeSet(callGraph *callgraph.Graph, callSite ssa.CallInstruction) (calleeSet []*ssa.Function)

returns all the possible callees at the callSite in the callGraph

func FindSeedType

func FindSeedType(prog *ssa.Program, seedStr *string, pkgPath *string) *ssa.Type

func FindSeedValues

func FindSeedValues(prog *ssa.Program, seedType *string, pkgPath *string) []ssa.Value

func GetAllTypes

func GetAllTypes(prog *ssa.Program) []*ssa.Type

get all the types from program

func GetCalleeParamIndex

func GetCalleeParamIndex(value ssa.Value, callee *ssa.Function) int

func GetCallsiteArgIndices

func GetCallsiteArgIndices(value ssa.Value, call *ssa.CallCommon) []int

returns the list of parameter indices of the taint source

func GetFieldNameFromJsonTag

func GetFieldNameFromJsonTag(tag string) string

func GetReturnIndices

func GetReturnIndices(taintSource ssa.Value, returnInst *ssa.Return) []int

returns the list of return indices of the taint source

func IsK8sUpdateCall

func IsK8sUpdateCall(call *ssa.CallCommon) bool

func IsPointerType

func IsPointerType(value ssa.Value) bool

returns if the value represent any pass by reference type

func MergeMaps

func MergeMaps(m1 map[ssa.Value]*FieldSet, m2 map[ssa.Value]*FieldSet)

func TaintInvokeCallSiteArgFromCallee

func TaintInvokeCallSiteArgFromCallee(callSite ssa.CallInstruction, calleeParamIndex int, taintedSet map[ssa.Value]bool) bool

This function taints the invoke callsite's arguments using the parameter index from a concrete callee This needs to be carefully handled because the concrete callee's parameter list would contain the receiver, but the invoke callsite's argument list does not contain the receiver

Types

type Field

type Field struct {
	Path []string
}

func FieldFromString

func FieldFromString(s string) *Field

func NewIndexField

func NewIndexField(parentField Field) *Field

func NewSubField

func NewSubField(parentStruct *types.Struct, parentField Field, fieldIndex int) *Field

func (*Field) Clone

func (f *Field) Clone() *Field

func (*Field) Equal

func (f *Field) Equal(v Field) bool

func (*Field) String

func (f *Field) String() string

type FieldSet

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

func MergeFieldSets

func MergeFieldSets(sets ...FieldSet) *FieldSet

func NewFieldSet

func NewFieldSet() *FieldSet

func (*FieldSet) Add

func (fs *FieldSet) Add(f *Field) bool

func (*FieldSet) Contain

func (fs *FieldSet) Contain(f Field) bool

func (*FieldSet) Delete

func (fs *FieldSet) Delete(f *Field)

func (*FieldSet) Extend

func (fs *FieldSet) Extend(otherFs *FieldSet)

merge otherFs into this FieldSet

func (*FieldSet) Fields

func (fs *FieldSet) Fields() []Field

func (*FieldSet) IsMetadata

func (fs *FieldSet) IsMetadata() bool

func (*FieldSet) IsStatus

func (fs *FieldSet) IsStatus() bool

func (*FieldSet) IsTypeMeta

func (fs *FieldSet) IsTypeMeta() bool

func (*FieldSet) String

func (fs *FieldSet) String() string

type IndexField

type IndexField []int

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func FromSlice

func FromSlice[T comparable](slice []T) *Set[T]

FromSlice returns a new Set with all the items of the slice.

func NewSet

func NewSet[T comparable](items ...T) *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(items ...T)

Add adds item(s) to the Set

func (*Set[T]) Contains

func (s *Set[T]) Contains(item T) bool

Contains returns whether an item is in the Set

func (*Set[T]) Copy

func (s *Set[T]) Copy() *Set[T]

Copy returns a new Set with the same items as the current Set

func (*Set[T]) Difference

func (s *Set[T]) Difference(others ...*Set[T]) *Set[T]

Difference returns a new Set of all the items in the current Set that are not in any of the others

func (*Set[T]) Discard

func (s *Set[T]) Discard(items ...T)

Discard removes item(s) from the Set if exist See also: Remove()

func (*Set[T]) Equal

func (s *Set[T]) Equal(other *Set[T]) bool

Equal returns whether the current Set contains the same items as the other one

func (*Set[T]) Intersection

func (s *Set[T]) Intersection(others ...*Set[T]) *Set[T]

Intersection returns a new Set with the common items of the current set and all others.

func (*Set[T]) IsDisjoint

func (s *Set[T]) IsDisjoint(other *Set[T]) bool

IsDisjoint returns whether the two Sets have no item in common

func (*Set[T]) IsEmpty

func (s *Set[T]) IsEmpty() bool

IsEmpty returns true if there are no items in the Set

func (*Set[T]) IsSubset

func (s *Set[T]) IsSubset(other *Set[T]) bool

IsSubset returns whether all the items of the current set exist in the other one

func (*Set[T]) IsSuperset

func (s *Set[T]) IsSuperset(other *Set[T]) bool

IsSuperset returns whether all the items of the other set exist in the current one

func (*Set[T]) Items

func (s *Set[T]) Items() []T

Items returns a slice of all the Set items

func (*Set[T]) Len

func (s *Set[T]) Len() int

Len returns the number of items in the Set

func (*Set[T]) Pop

func (s *Set[T]) Pop() (T, error)

Pop removes an arbitrary item from the Set and returns it. Returns error if the Set is empty

func (*Set[T]) Remove

func (s *Set[T]) Remove(item T) error

Remove removes a single item from the Set. Returns error if the item is not in the Set See also: Discard()

func (*Set[T]) String

func (s *Set[T]) String() string

String returns a string that represents the Set

func (*Set[T]) SymmetricDifference

func (s *Set[T]) SymmetricDifference(other *Set[T]) *Set[T]

SymmetricDifference returns all the items that exist in only one of the Sets

func (*Set[T]) Union

func (s *Set[T]) Union(others ...*Set[T]) *Set[T]

Union returns a new Set of the items from the current set and all others

func (*Set[T]) Update

func (s *Set[T]) Update(others ...*Set[T])

Update adds all the items from the other Sets to the current Set

Jump to

Keyboard shortcuts

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