php

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package php provides PHP database-related patterns

Package php - frameworks.go provides PHP framework pattern registry and string-based patterns String-based pattern lists are derived dynamically from registered framework patterns

Package php provides PHP function patterns for input source detection

Package php provides PHP-specific source type inference

Package php provides centralized PHP patterns for semantic analysis All PHP-specific regex patterns should be defined here to avoid duplication

Package php provides PHP-specific patterns for input tracing.

Index

Constants

View Source
const PHPConstructorName = "__construct"

PHPConstructorName is the name of PHP constructor methods

View Source
const PHPFileExtension = ".php"

PHPFileExtension is the file extension for PHP files

View Source
const PHPInputConstant = "php://input"

PHPInputConstant is the php://input constant value

Variables

View Source
var (
	// InputMethodPattern matches method names that ALWAYS indicate user input
	// Pattern matches:
	// - Explicit input getters: input, get_input, getInput, get_var, variable
	// - HTTP method getters: getPost, getQuery, getCookie, getHeader, etc.
	// - PSR-7 methods: getQueryParams, getParsedBody, getCookieParams, etc.
	// - All input: all()
	InputMethodPattern = regexp.MustCompile(`(?i)^(get_?)?(input|var|variable|query_?params?|parsed_?body|cookie_?params?|server_?params?|uploaded_?files?|headers?|all)$|^(get_?)?(post|cookie|param)s?$`)

	// InputPropertyPattern matches property names that typically hold user input
	// (for array access patterns like ->input['key'])
	// Matches: input, request, params, query, cookies, headers, body, data, args, post, get, files, server
	InputPropertyPattern = regexp.MustCompile(`(?i)^(input|request|params?|query|cookies?|headers?|body|data|args?|post|get|files?|server|attributes?|payload)s?$`)

	// InputObjectPattern matches object/variable names that suggest the object is an input carrier
	// Also matches chain calls like "->getRequest()" or "Factory::getApplication()->getInput()"
	InputObjectPattern = regexp.MustCompile(`(?i)(request|input|req|params?|http|ctx|context|getRequest\(\)|getApplication\(\))`)

	// ExcludeMethodPattern matches method names to EXCLUDE from input detection (false positive prevention)
	// These are methods that might match patterns but aren't typically user input
	ExcludeMethodPattern = regexp.MustCompile(`(?i)^(getData|getBody|getContent|fetch|find|load|read)$`)

	// ContextDependentMethodPattern matches methods like getVal, getText, getInt, getBool
	// used in MediaWiki on request objects but also on many other objects
	// Only detect these when the object looks like a request
	ContextDependentMethodPattern = regexp.MustCompile(`(?i)^(get_?)?(val|text|int|bool|array|raw_?val|check)$`)
)
View Source
var (
	// SQLCurlyBracePattern matches '{$var->prop['key']}' - curly brace interpolation in SQL
	SQLCurlyBracePattern = regexp.MustCompile(`\{\s*\$(\w+)->(\w+)\s*\[\s*['"]([^'"]+)['"]\s*\]\s*\}`)

	// SQLSimpleCurlyPattern matches simple property in curly braces {$var->prop}
	SQLSimpleCurlyPattern = regexp.MustCompile(`\{\s*\$(\w+)->(\w+)\s*\}`)

	// SQLNoCurlyPattern matches "...$var->prop..." without curly braces in strings
	SQLNoCurlyPattern = regexp.MustCompile(`"\s*[^"]*\$(\w+)->(\w+)\s*\[\s*['"]([^'"]+)['"]\s*\]`)
)
View Source
var (
	// ConcatPattern matches "' . $var->prop['key'] . '" or similar concatenations
	ConcatPattern = regexp.MustCompile(`\.\s*\$(\w+)->(\w+)\s*\[\s*['"]([^'"]+)['"]\s*\]\s*\.`)

	// SimpleConcatPattern matches simple property concatenation '. $var->prop .'
	SimpleConcatPattern = regexp.MustCompile(`\.\s*\$(\w+)->(\w+)\s*\.`)
)
View Source
var (
	// EscapeWithPropArrayPattern matches escape_string($var->prop['key']) or $db->escape_string($var->prop['key'])
	EscapeWithPropArrayPattern = regexp.MustCompile(`(\w*escape\w*)\s*\(\s*\$(\w+)->(\w+)\s*\[\s*['"]([^'"]+)['"]\s*\]\s*\)`)

	// EscapeSimplePropPattern matches escape functions with simple property
	EscapeSimplePropPattern = regexp.MustCompile(`(\w*escape\w*)\s*\(\s*\$(\w+)->(\w+)\s*\)`)

	// EscapeVarPattern matches escape with variable
	EscapeVarPattern = regexp.MustCompile(`(\w*escape\w*)\s*\(\s*\$(\w+)\s*\)`)
)
View Source
var (
	// GlobalsPattern matches $GLOBALS['varname'] or $GLOBALS["varname"]
	GlobalsPattern = regexp.MustCompile(`\$GLOBALS\[['"](\w+)['"]\]`)

	// DIContainerPattern matches DI container pattern: $var->get('service')
	DIContainerPattern = regexp.MustCompile(`\$\w+->get\(['"]([^'"]+)['"]\)`)
)
View Source
var (
	// ThisMethodCallPattern matches $this->methodName($arg)
	ThisMethodCallPattern = regexp.MustCompile(`\$this->(\w+)\(([^)]*)\)`)

	// PropertyAssignLoopPattern builds a pattern for $this->property[$key] = $val
	// Use BuildPropertyAssignLoopPattern for dynamic keys
	PropertyAssignLoopPatternTemplate = `\$this->(%s)\[\$%s\]\s*=\s*\$%s`

	// ForeachPattern matches foreach($array as $key => $val)
	ForeachPattern = regexp.MustCompile(`foreach\s*\(\s*\$(\w+)\s+as\s+\$(\w+)\s*=>\s*\$(\w+)\s*\)`)

	// DirectAssignPatternTemplate for $this->property = $something
	// Use BuildDirectAssignPattern for specific properties
	DirectAssignPatternTemplate = `\$this->%s\s*=\s*([^;]+)`

	// ConditionalPatternTemplate for if($_SUPERGLOBAL[anything])
	// Use BuildConditionalPattern for specific superglobals
	ConditionalPatternTemplate = `if\s*\(\s*%s\[['"]?(\w+)['"]?\]`
)
View Source
var (
	// ThisPropertyAssignPattern matches $this->property = ...
	// Used to detect constructor/method parameter flow to properties
	ThisPropertyAssignPattern = regexp.MustCompile(`\$this->(\w+)\s*=`)

	// ThisArrayPropertyAssignPattern matches $this->property[...] = ...
	// Used to detect array property assignments
	ThisArrayPropertyAssignPattern = regexp.MustCompile(`\$this->(\w+)\[.*\]\s*=`)

	// ArrayKeyAccessPattern matches ['key'] or ["key"]
	// Used to extract array keys from expressions
	ArrayKeyAccessPattern = regexp.MustCompile(`\[['"](\w+)['"]\]`)

	// VariableKeyAccessPattern matches [$variable]
	// Used to extract variable-based array access
	VariableKeyAccessPattern = regexp.MustCompile(`\[(\$\w+)\]`)

	// ReturnThisPropertyPrefix is the static prefix for return $this->property patterns
	// Use BuildReturnPropertyPattern for dynamic patterns with specific property names
	ReturnThisPropertyPrefix = `return\s+\$this->`

	// MethodCallSuffix is the suffix pattern for method calls
	MethodCallSuffix = `\(`
)
View Source
var AllDatabaseFetchMethods = map[string]bool{

	"fetch":       true,
	"fetchAll":    true,
	"fetchColumn": true,
	"fetchObject": true,

	"fetch_array":  true,
	"fetch_assoc":  true,
	"fetch_row":    true,
	"fetch_object": true,
	"fetch_all":    true,
}

AllDatabaseFetchMethods combines all database fetch method names

View Source
var DatabaseQueryMethods = map[string]bool{

	"query":   true,
	"exec":    true,
	"prepare": true,
	"execute": true,

	"real_query":         true,
	"multi_query":        true,
	"send_query":         true,
	"real_escape_string": true,
}

DatabaseQueryMethods are methods that execute database queries (sinks)

View Source
var DatabaseResultObjectPatterns = []string{
	"result",
	"stmt",
	"statement",
	"query",
	"res",
	"row",
	"rows",
}

DatabaseResultObjectPatterns matches object names that are likely database results

View Source
var DeserializationFunctions = []string{
	"unserialize",
	"json_decode",
	"simplexml_load_string",
	"simplexml_load_file",
	"yaml_parse",
	"yaml_parse_file",
	"yaml_parse_url",
	"msgpack_unpack",
	"igbinary_unserialize",
	"parse_str",
	"mb_parse_str",
}

DeserializationFunctions are functions that deserialize external data The data being deserialized may come from untrusted sources

View Source
var DeserializationFunctionsMap = func() map[string]bool {
	m := make(map[string]bool)
	for _, fn := range DeserializationFunctions {
		m[fn] = true
	}
	return m
}()

DeserializationFunctionsMap provides O(1) lookup

View Source
var FrameworkDetectionPatterns = map[string]FrameworkDetection{
	"laravel": {
		ImportPatterns: []string{"illuminate", "laravel"},
		SourcePatterns: []string{"Illuminate\\", "Laravel\\"},
	},
	"symfony": {
		ImportPatterns: []string{"symfony"},
		SourcePatterns: []string{"Symfony\\"},
	},
}

FrameworkDetectionPatterns maps framework names to detection patterns Each framework has patterns to match in imports and source code Note: Only Laravel and Symfony are supported

View Source
var InputFunctions = []string{

	"file_get_contents",
	"fgets",
	"fread",
	"fgetc",
	"fgetss",
	"fgetcsv",
	"file",
	"readfile",
	"stream_get_contents",

	"getenv",
	"getallheaders",
	"apache_request_headers",

	"readline",
	"fscanf",
	"fpassthru",
}

InputFunctions are functions that read external data These are sources of potentially untrusted data

View Source
var InputFunctionsMap = func() map[string]bool {
	m := make(map[string]bool)
	for _, fn := range InputFunctions {
		m[fn] = true
	}
	return m
}()

InputFunctionsMap provides O(1) lookup

MethodNamePatterns maps patterns in method names to their source types

View Source
var MySQLiFetchMethods = map[string]bool{
	"fetch_array":  true,
	"fetch_assoc":  true,
	"fetch_row":    true,
	"fetch_object": true,
	"fetch_all":    true,
}

MySQLiFetchMethods contains MySQLi result fetch methods

View Source
var NetworkFunctions = []string{

	"curl_exec",
	"curl_multi_getcontent",
	"curl_multi_exec",

	"file_get_contents",
	"fopen",
	"fsockopen",
	"pfsockopen",

	"http_get",
	"http_post",
	"http_request",

	"socket_read",
	"socket_recv",
	"socket_recvfrom",

	"stream_socket_recvfrom",
	"stream_get_contents",
}

NetworkFunctions are functions that fetch external network data

View Source
var NetworkFunctionsMap = func() map[string]bool {
	m := make(map[string]bool)
	for _, fn := range NetworkFunctions {
		m[fn] = true
	}
	return m
}()

NetworkFunctionsMap provides O(1) lookup

View Source
var PDOFetchMethods = map[string]bool{
	"fetch":       true,
	"fetchAll":    true,
	"fetchColumn": true,
	"fetchObject": true,
}

PDOFetchMethods contains PDO statement fetch methods These are object methods called on PDOStatement objects

View Source
var PHPFileExtensions = []string{".php", ".php5", ".php7", ".phtml"}

PHPFileExtensions contains all PHP file extensions

View Source
var PHPInputFunctions = []string{
	"file_get_contents",
	"fread",
	"fgets",
	"fgetc",
	"stream_get_contents",
	"readfile",
}

PHPInputFunctions contains common PHP functions that read input

View Source
var PHPInputProperties = []string{"input", "cookies", "query", "request", "files", "server", "headers"}

PHPInputProperties contains common PHP input carrier property names

View Source
var PHPNodeTypes = struct {
	// Class and function nodes
	ClassDeclaration    string
	MethodDeclaration   string
	FunctionDefinition  string
	PropertyDeclaration string
	DeclarationList     string

	// Variable and expression nodes
	VariableName            string
	SubscriptExpression     string
	MemberAccessExpression  string
	MemberCallExpression    string
	FunctionCallExpression  string
	ScopedCallExpression    string
	AssignmentExpression    string
	BinaryExpression        string
	ParenthesizedExpression string
	EncapsedString          string

	// Parameter types
	SimpleParameter            string
	VariadicParameter          string
	PropertyPromotionParameter string

	// Statement nodes
	ForeachStatement string
	ReturnStatement  string

	// Field names
	FieldName       string
	FieldBaseClause string
	FieldBody       string
	FieldObject     string
	FieldIndex      string
	FieldLeft       string
	FieldRight      string
	FieldFunction   string

	// Modifier types
	VisibilityModifier string
	StaticModifier     string

	// Visibility values
	VisibilityPublic    string
	VisibilityProtected string
	VisibilityPrivate   string
}{
	ClassDeclaration:    "class_declaration",
	MethodDeclaration:   "method_declaration",
	FunctionDefinition:  "function_definition",
	PropertyDeclaration: "property_declaration",
	DeclarationList:     "declaration_list",

	VariableName:            "variable_name",
	SubscriptExpression:     "subscript_expression",
	MemberAccessExpression:  "member_access_expression",
	MemberCallExpression:    "member_call_expression",
	FunctionCallExpression:  "function_call_expression",
	ScopedCallExpression:    "scoped_call_expression",
	AssignmentExpression:    "assignment_expression",
	BinaryExpression:        "binary_expression",
	ParenthesizedExpression: "parenthesized_expression",
	EncapsedString:          "encapsed_string",

	SimpleParameter:            "simple_parameter",
	VariadicParameter:          "variadic_parameter",
	PropertyPromotionParameter: "property_promotion_parameter",

	ForeachStatement: "foreach_statement",
	ReturnStatement:  "return_statement",

	FieldName:       "name",
	FieldBaseClause: "base_clause",
	FieldBody:       "body",
	FieldObject:     "object",
	FieldIndex:      "index",
	FieldLeft:       "left",
	FieldRight:      "right",
	FieldFunction:   "function",

	VisibilityModifier: "visibility_modifier",
	StaticModifier:     "static_modifier",

	VisibilityPublic:    "public",
	VisibilityProtected: "protected",
	VisibilityPrivate:   "private",
}

PHPNodeTypes contains PHP-specific AST node type strings

PropertyNamePatterns maps patterns in property names to their source types

Registry is the global PHP framework pattern registry

View Source
var TaintPatterns = struct {
	// ThisArrayPattern matches $this->prop[$key] = assignments
	ThisArrayPattern *regexp.Regexp

	// DynamicPropPattern matches $this->$key = $val assignments
	DynamicPropPattern *regexp.Regexp

	// ReturnThisPattern matches return $this->prop statements
	ReturnThisPattern *regexp.Regexp

	// SuperglobalKeyPattern extracts keys from superglobal access
	SuperglobalKeyPattern *regexp.Regexp

	// LoopVariablePattern matches foreach loop variable assignments
	LoopVariablePattern *regexp.Regexp

	// ForeachValueOnlyPattern matches foreach($x as $value) without key
	ForeachValueOnlyPattern *regexp.Regexp

	// ThisPropertyOptionalArrayPattern matches $this->prop or $this->prop[...]
	ThisPropertyOptionalArrayPattern *regexp.Regexp

	// ReturnThisPropertyArrayPattern matches return $this->prop[...]
	ReturnThisPropertyArrayPattern *regexp.Regexp
}{
	ThisArrayPattern:                 regexp.MustCompile(`\$this->(\w+)\[\$\w+\]\s*=`),
	DynamicPropPattern:               regexp.MustCompile(`\$this->\$(\w+)\s*=`),
	ReturnThisPattern:                regexp.MustCompile(`return\s+\$this->(\w+)`),
	SuperglobalKeyPattern:            regexp.MustCompile(`\$_[A-Z]+\s*\[\s*['"]([^'"]+)['"]\s*\]`),
	LoopVariablePattern:              regexp.MustCompile(`as\s+\$(\w+)\s*=>\s*\$(\w+)`),
	ForeachValueOnlyPattern:          regexp.MustCompile(`as\s+\$(\w+)\s*\)`),
	ThisPropertyOptionalArrayPattern: regexp.MustCompile(`\$this->(\w+)(?:\[[^\]]*\])?`),
	ReturnThisPropertyArrayPattern:   regexp.MustCompile(`return\s+\$this->(\w+)\[`),
}

TaintPatterns contains pre-compiled regex patterns for PHP taint analysis

Functions

func BuildConditionalPattern

func BuildConditionalPattern(superglobal string) *regexp.Regexp

BuildConditionalPattern creates a pattern for conditional based on superglobal

func BuildDirectAssignPattern

func BuildDirectAssignPattern(propertyName string) *regexp.Regexp

BuildDirectAssignPattern creates a pattern for direct property assignment

func BuildMethodCallPattern

func BuildMethodCallPattern(methodName string) *regexp.Regexp

BuildMethodCallPattern creates a pattern for ->methodName(

func BuildPropertyAccessPattern

func BuildPropertyAccessPattern(propertyName string) *regexp.Regexp

BuildPropertyAccessPattern creates a pattern for $var->property or $var->property[

func BuildPropertyAssignLoopPattern

func BuildPropertyAssignLoopPattern(propertyName, keyVar, valVar string) *regexp.Regexp

BuildPropertyAssignLoopPattern creates a pattern for property assignment in loop

func BuildReturnPropertyArrayPattern

func BuildReturnPropertyArrayPattern(propertyName string) *regexp.Regexp

BuildReturnPropertyArrayPattern creates a pattern for return $this->propertyName[

func BuildReturnPropertyPattern

func BuildReturnPropertyPattern(propertyName string) *regexp.Regexp

BuildReturnPropertyPattern creates a pattern for return $this->propertyName

func BuildThisArrayPropertyAssignPattern

func BuildThisArrayPropertyAssignPattern(paramName string) *regexp.Regexp

BuildThisArrayPropertyAssignPattern creates a pattern for $this->property[...] = ... paramName

func BuildThisPropertyAssignPattern

func BuildThisPropertyAssignPattern(paramName string) *regexp.Regexp

BuildThisPropertyAssignPattern creates a pattern for $this->property = ... paramName

func ContainsCurlFunction

func ContainsCurlFunction(expr string) bool

ContainsCurlFunction specifically checks for cURL functions

func ContainsDeserializationFunction

func ContainsDeserializationFunction(expr string) bool

ContainsDeserializationFunction checks if expression contains deserialization

func ContainsInputFunction

func ContainsInputFunction(expr string) bool

ContainsInputFunction checks if expression contains any input function call

func ContainsNetworkFunction

func ContainsNetworkFunction(expr string) bool

ContainsNetworkFunction checks if expression contains network function call

func ContainsSuperglobal

func ContainsSuperglobal(text string) (bool, string)

ContainsSuperglobal checks if text contains any PHP superglobal

func DetectFrameworkFromImports

func DetectFrameworkFromImports(imports []string) []string

DetectFrameworkFromImports detects frameworks based on import statements

func DetectFrameworkFromSource

func DetectFrameworkFromSource(source string) []string

DetectFrameworkFromSource detects frameworks based on source code content

func DetectFrameworks

func DetectFrameworks(imports []string, classNames []string, source string) []string

DetectFrameworks detects all frameworks using import and source detection methods The classNames parameter is kept for API compatibility but is unused

func GetAllPatterns

func GetAllPatterns() []*common.FrameworkPattern

GetAllPatterns returns all registered framework patterns

func GetInputFunctionSourceType

func GetInputFunctionSourceType(funcName string) common.SourceType

GetInputFunctionSourceType returns the source type for an input function

func GetInputMethodPatterns

func GetInputMethodPatterns() []string

GetInputMethodPatterns returns method patterns derived from registered framework patterns Built lazily on first access to ensure all framework patterns are registered

func GetInputPropertyPatterns

func GetInputPropertyPatterns() []string

GetInputPropertyPatterns returns property patterns derived from registered framework patterns Built lazily on first access to ensure all framework patterns are registered

func GetPatternByID

func GetPatternByID(id string) *common.FrameworkPattern

GetPatternByID returns a pattern by its ID

func GetPatternsByFramework

func GetPatternsByFramework(framework string) []*common.FrameworkPattern

GetPatternsByFramework returns patterns for a specific framework

func GetTypeHintPatterns

func GetTypeHintPatterns(varName string) []*regexp.Regexp

TypeHintPatterns returns patterns for PHPDoc @var type hints Pattern 1: /* @var $varname \namespace\classname */ Pattern 2: /* @var \namespace\classname $varname */

func IdentifyExternalDataSource

func IdentifyExternalDataSource(expr string) (common.SourceType, float64)

IdentifyExternalDataSource identifies the source type from an expression Returns the source type and confidence level

func InferSourceTypeFromExpression

func InferSourceTypeFromExpression(expr string) common.SourceType

InferSourceTypeFromExpression determines source type from a full expression e.g., "$request->getCookieParams()" -> SourceHTTPCookie

func InferSourceTypeFromMethodName

func InferSourceTypeFromMethodName(methodName string) common.SourceType

InferSourceTypeFromMethodName determines the source type based on method name patterns This centralizes the logic previously in pkg/semantic/analyzer/php/analyzer.go

func InferSourceTypeFromPropertyName

func InferSourceTypeFromPropertyName(propName string) common.SourceType

InferSourceTypeFromPropertyName determines the source type based on property name patterns This centralizes the logic previously in pkg/semantic/analyzer/php/analyzer.go

func IsContextDependentMethod

func IsContextDependentMethod(methodName string) bool

IsContextDependentMethod returns true if the method needs object context to determine if it's input

func IsDatabaseFetchMethod

func IsDatabaseFetchMethod(methodName string) bool

IsDatabaseFetchMethod returns true if the method name is a database fetch method This checks object-oriented fetch methods (PDO, MySQLi object style)

func IsDatabaseQueryMethod

func IsDatabaseQueryMethod(methodName string) bool

IsDatabaseQueryMethod returns true if method is a database query method (sink)

func IsDatabaseResultObject

func IsDatabaseResultObject(objName string) bool

IsDatabaseResultObject checks if an object name looks like a database result

func IsDeserializationFunction

func IsDeserializationFunction(funcName string) bool

IsDeserializationFunction returns true if the function deserializes data

func IsExcludedMethod

func IsExcludedMethod(methodName string) bool

IsExcludedMethod returns true if the method should be excluded from input detection

func IsExternalDataFunction

func IsExternalDataFunction(funcName string) bool

IsExternalDataFunction checks if a function reads external data (any type)

func IsInputFunction

func IsInputFunction(funcName string) bool

IsInputFunction returns true if the function name is a known input function

func IsInputMethod

func IsInputMethod(methodName string) bool

IsInputMethod returns true if the method name matches input method patterns and is not excluded (false positive prevention)

func IsInputMethodCall

func IsInputMethodCall(expr string) bool

IsInputMethodCall checks if an expression matches an input method pattern

func IsInputObject

func IsInputObject(objName string) bool

IsInputObject returns true if the object/variable name suggests an input carrier

func IsInputProperty

func IsInputProperty(propName string) bool

IsInputProperty returns true if the property name matches input property patterns

func IsInputPropertyAccess

func IsInputPropertyAccess(expr string) bool

IsInputPropertyAccess checks if an expression matches an input property pattern

func IsMySQLiFetchMethod

func IsMySQLiFetchMethod(methodName string) bool

IsMySQLiFetchMethod returns true if the method is a MySQLi fetch method

func IsNetworkFunction

func IsNetworkFunction(funcName string) bool

IsNetworkFunction returns true if the function fetches network data

func IsPDOFetchMethod

func IsPDOFetchMethod(methodName string) bool

IsPDOFetchMethod returns true if the method is a PDO fetch method

func IsPHPFile

func IsPHPFile(path string) bool

IsPHPFile checks if a file path is a PHP file

func MatchesInputCarrier

func MatchesInputCarrier(objName, propOrMethodName string, isMethod bool) bool

MatchesInputCarrier returns true if the expression matches patterns suggesting user input This checks object name, property name, and method name combinations

Types

type ConcatMatch

type ConcatMatch struct {
	VarName      string
	PropertyName string
	Key          string
}

ConcatMatch represents a matched concatenated expression

func ExtractConcatenatedExpressions

func ExtractConcatenatedExpressions(line string) []ConcatMatch

ExtractConcatenatedExpressions extracts expressions from string concatenation

type EscapeMatch

type EscapeMatch struct {
	EscapeFunc   string
	VarName      string
	PropertyName string
	Key          string
}

EscapeMatch represents a matched escaped expression

func ExtractEscapedExpressions

func ExtractEscapedExpressions(line string) []EscapeMatch

ExtractEscapedExpressions extracts expressions wrapped in escape functions

type FrameworkDetection

type FrameworkDetection struct {
	ImportPatterns []string // Patterns to match in import/use statements
	SourcePatterns []string // Patterns to match in source code
}

FrameworkDetection contains patterns for detecting a framework

type Matcher

type Matcher struct {
	*common.BaseMatcher
}

Matcher matches PHP user input sources

func NewMatcher

func NewMatcher() *Matcher

NewMatcher creates a new PHP source matcher combining all definition groups.

type SQLEmbeddedMatch

type SQLEmbeddedMatch struct {
	VarName      string
	PropertyName string
	Key          string
	Pattern      string
}

SQLEmbeddedMatch represents a matched SQL embedded expression

func ExtractSQLEmbeddedExpressions

func ExtractSQLEmbeddedExpressions(line string) []SQLEmbeddedMatch

ExtractSQLEmbeddedExpressions extracts expressions from SQL strings

Jump to

Keyboard shortcuts

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