Documentation
¶
Index ¶
- func AddListToSetString(set map[string]struct{}, list []string) map[string]struct{}
- func ExtractDomain(rawURL string, maxDomainLevel int) string
- func IsAbsoluteURL(u string) bool
- func IsSubdomain(base string, sub string) bool
- func IsURLAllowed(baseURL string, targetURL string, requireBaseURLMatch bool, ...) bool
- func MergeBodyParams(params1 []*discover.RouteBodyParam, params2 []*discover.RouteBodyParam) []*discover.RouteBodyParam
- func MergeQueryParams(params1 []*discover.RouteQueryParam, params2 []*discover.RouteQueryParam) []*discover.RouteQueryParam
- func MergeStaticAssets(staticAssets []string) []string
- func MergeWebRoutes(routes []*discover.RouteDetails) []*discover.RouteDetails
- func ParseBodyParams(postData string) ([]*discover.RouteBodyParam, error)
- func ParseQueryParams(reqURL *url.URL) []*discover.RouteQueryParam
- func ResolveURL(base, ref string) string
- func SetToListString(set map[string]struct{}) []string
- func URLRemoveQueryParams(rawURL string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddListToSetString ¶
AddListToSetString adds elements from a list of strings to a set of strings.
func ExtractDomain ¶
ExtractDomain helper function to extract the domain from a URL with an optional maxDomainLevel parameter maxDomainLevel specifies the number of domain levels to include in the extracted domain e.g. maxDomainLevel=2 would extract "example.com" from "www.sub.example.com" maxDomainLevel=0 would extract the full domain
func IsAbsoluteURL ¶
IsAbsoluteURL helper function to check if a URL is absolute
func IsSubdomain ¶
IsSubdomain helper function to check if sub is a subdomain of base
func IsURLAllowed ¶
func IsURLAllowed(baseURL string, targetURL string, requireBaseURLMatch bool, ignoreStaticAssets bool) bool
IsURLAllowed helper function to check if a URL is allowed based on baseUrlsOnly and base domain and captureStaticAssets This only checks the first subdomain only of the baseURL as a condition for match Web routes often get redirected to www.* or other subdomains, so we only check the base domain baseURL should be the original URL sent to the CLI, targetURL is the URL discovered that needs checking
func MergeBodyParams ¶
func MergeBodyParams(params1 []*discover.RouteBodyParam, params2 []*discover.RouteBodyParam) []*discover.RouteBodyParam
MergeBodyParams helper function to merge BodyParams only retaining those that are unique When the same param name is encountered, the example values are merged
func MergeQueryParams ¶
func MergeQueryParams(params1 []*discover.RouteQueryParam, params2 []*discover.RouteQueryParam) []*discover.RouteQueryParam
MergeQueryParams Helper function to merge QueryParams only retaining those that are unique When the same param name is encountered, the example values are merged
func MergeStaticAssets ¶
MergeStaticAssets merges StaticAssets, retaining only unique static assets
func MergeWebRoutes ¶
func MergeWebRoutes(routes []*discover.RouteDetails) []*discover.RouteDetails
MergeWebRoutes merges WebRoutes, retaining only unique routes unique routes are defined by the combination of method and URL
func ParseBodyParams ¶
func ParseBodyParams(postData string) ([]*discover.RouteBodyParam, error)
ParseBodyParams helper function to parse body parameters
func ParseQueryParams ¶
func ParseQueryParams(reqURL *url.URL) []*discover.RouteQueryParam
ParseQueryParams helper function to parse query parameters from the URL
func ResolveURL ¶
ResolveURL helper function to resolve relative URLs
func SetToListString ¶
SetToListString converts a set of strings to a list of strings.
func URLRemoveQueryParams ¶
URLRemoveQueryParams helper function to remove query parameters from a URL
Types ¶
This section is empty.