parser

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: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeGoComment = iota
	TypeGoVariable
	TypeGoOther

	TypeJSONVariable
	TypeJSONListVal

	TypeYamlVariable
	TypeYamlListVal

	TypeK8sEnvVariable
	TypeK8sSecret
	TypeK8sFlag

	TypePropertiesComment
	TypePropertiesValue

	TypePrivateKey

	TypeXMLElement
	TypeXMLAttribute

	TypePHPVariable
	TypePHPHeredoc
	TypePHPConstant
	TypePHPComment
	TypePHPOther

	TypeBashVariable

	TypeGenericCodeVariable
	TypeGenericCodeComment
	TypeGenericCodeOther

	TypeGeneric

	TypeJSVariable
	TypeJSComment
	TypeJSOther

	TypeTSVariable
	TypeTSComment
	TypeTSOther

	TypeHTMLScript
)

Types indicate the credential finding type

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {

	// Results is the list of findings
	Results    []Result
	Statistics Statistics
	// contains filtered or unexported fields
}

Parser searches the given files and maintains a list of hard-coded credentials stored in Results

func NewParser

func NewParser(conf *config.Config) *Parser

NewParser returns a new parser with the given configuration

func (*Parser) ParseFile

func (p *Parser) ParseFile(filepath string) bool

ParseFile parses the given file (if possible) and collects potential credentials. Returns true if file was scanned

func (*Parser) Scan added in v1.7.1

func (p *Parser) Scan(scanPath string) error

Scan initiates the recursive scan of all files/directories in the given path

type Result

type Result struct {
	File           string `json:"file"`
	Type           int    `json:"type"`
	Line           int    `json:"line"`
	Name           string `json:"name"`
	Value          string `json:"value"`
	CredentialType string `json:"credential_type,omitempty"`
}

Result is a hard-coded credential finding

type Statistics added in v1.10.1

type Statistics struct {
	FilesFound   int `json:"files_found"`
	FilesScanned int `json:"files_scanned"`
	ResultsFound int `json:"results_found"`
}

Statistics contains information about the findings

Jump to

Keyboard shortcuts

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