model

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllScanTypes lists every supported scan type in display order.

Functions

func GenerateID

func GenerateID() string

Types

type ConfigEditorData

type ConfigEditorData struct {
	// Replace fields — effective value (override wins, then defaults)
	VariableNameExclusionPattern     string
	XMLAttributeNameExclusionPattern string
	MinPasswordLength                int
	ExcludeTests                     bool
	ExcludeComments                  bool
	Verbose                          bool
	ScanTypes                        []string

	// Append fields — only the user's overrides (empty if none saved)
	ExtraVariableNamePatterns         []string
	ExtraValueMatchPatterns           []config.ValueMatchPattern
	ExtraVariableValueExcludePatterns []string
	ExtraFullTextValueExcludePatterns []string
	ExtraTestDirectories              []string
	ExtraIgnoreFiles                  []string
	ExtraGenericFileExtensions        []string
	ExtraGenericCodeFileExtensions    []string

	// Reference: the base defaults shown collapsed for context
	Defaults     *config.Config
	AllScanTypes []string

	// Whether a custom config is currently active
	HasOverride bool
}

ConfigEditorData is the template data for the config editor partial.

func BuildEditorData

func BuildEditorData(defaults, override *config.Config) ConfigEditorData

BuildEditorData constructs the ConfigEditorData for the template, applying any override values on top of the defaults.

type ExportData added in v1.18.0

type ExportData struct {
	Version    int               `json:"version"`
	ExportedAt time.Time         `json:"exported_at"`
	Request    ScanRequest       `json:"request"`
	Results    []parser.Result   `json:"results"`
	Stats      parser.Statistics `json:"stats"`
	Dismissed  map[int]bool      `json:"dismissed,omitempty"`
}

ExportData is the JSON-serializable format for saving and loading scan results.

type IndexedResult

type IndexedResult struct {
	Index  int
	Result parser.Result
}

IndexedResult pairs a result with its original index for dismiss operations

type OrgFilter

type OrgFilter struct {
	ActiveOnly  bool   `json:"active_only,omitempty"`
	RepoPattern string `json:"repo_pattern,omitempty"`
}

OrgFilter holds filtering options for GitHub org scans

type ResultRowData

type ResultRowData struct {
	SessionID string
	Index     int
	Result    parser.Result
}

ResultRowData is passed into the result_row template

type ResultsPageData

type ResultsPageData struct {
	SessionID   string
	Results     []IndexedResult
	Stats       parser.Statistics
	Status      ScanStatus
	Error       string
	Target      string
	ActiveCount int
	TotalCount  int
	Page        int
	PageSize    int
	HasMore     bool
}

ResultsPageData is passed into the results template

type ScanDepth

type ScanDepth string

ScanDepth indicates how deep the scan should go

const (
	ScanDepthHead ScanDepth = "head"
	ScanDepthDeep ScanDepth = "deep"
)

type ScanMode

type ScanMode string

ScanMode indicates what kind of scan to perform

const (
	ScanModeRepo  ScanMode = "repo"
	ScanModeOrg   ScanMode = "org"
	ScanModeLocal ScanMode = "local"
)

type ScanRequest

type ScanRequest struct {
	Mode      ScanMode  `json:"mode"`
	Target    string    `json:"target"`
	Depth     ScanDepth `json:"depth"`
	OrgFilter OrgFilter `json:"org_filter,omitempty"`
}

ScanRequest represents a user-submitted scan form

type ScanSession

type ScanSession struct {
	ID             string
	Request        ScanRequest
	Status         ScanStatus
	Error          string
	Results        []parser.Result
	Stats          parser.Statistics
	Progress       chan string
	CreatedAt      time.Time
	ConfigOverride *config.Config // optional per-session config additions

	Mu        sync.Mutex
	Dismissed map[int]bool
}

ScanSession holds the state of an in-progress or completed scan

func (*ScanSession) ActiveResults

func (s *ScanSession) ActiveResults() []IndexedResult

ActiveResults returns non-dismissed results with their original indices

func (*ScanSession) Dismiss

func (s *ScanSession) Dismiss(index int)

Dismiss marks a result index as dismissed

func (*ScanSession) DismissFile

func (s *ScanSession) DismissFile(file string)

DismissFile marks all results for a given file as dismissed

func (*ScanSession) DismissValue

func (s *ScanSession) DismissValue(value string)

DismissValue marks all results with the given value as dismissed

func (*ScanSession) IsDismissed

func (s *ScanSession) IsDismissed(index int) bool

IsDismissed checks whether a result has been dismissed

type ScanStatus

type ScanStatus string

ScanStatus tracks the lifecycle of a scan

const (
	ScanStatusRunning  ScanStatus = "running"
	ScanStatusComplete ScanStatus = "complete"
	ScanStatusFailed   ScanStatus = "failed"
)

type SessionStore

type SessionStore struct {
	Mu       sync.RWMutex
	Sessions map[string]*ScanSession
}

SessionStore holds active scan sessions in memory

func NewSessionStore

func NewSessionStore() *SessionStore

NewSessionStore creates a new session store and starts a cleanup goroutine

func (*SessionStore) Create

func (s *SessionStore) Create(req ScanRequest) *ScanSession

Create allocates a new scan session and returns it

func (*SessionStore) Delete

func (s *SessionStore) Delete(id string)

Delete removes a session from the store

func (*SessionStore) Get

func (s *SessionStore) Get(id string) (*ScanSession, bool)

Get retrieves a session by ID

Jump to

Keyboard shortcuts

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