Documentation
¶
Overview ¶
Package webpath is the one reading of a web request path shared by the platform and the sensor: how a server sees a path (CleanPath), whether a path falls under an excluded path (Denied) or an allowed prefix (Under), and whether a path names a state-changing action (Destructive).
The platform plans path discovery and filters candidate lists with these functions, and the sensor's web scope refuses requests with the same ones, so a candidate the platform keeps is never one the sensor would refuse for a different reason, and an exclusion can never be read two ways.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrEncodedSeparator = errors.New("encoded separator in the path") ErrBadEscape = errors.New("invalid percent-encoding in the path") ErrControl = errors.New("control character in the path") ErrDotParams = errors.New("dot segment with parameters in the path") )
Errors of CleanPath.
var DestructiveVerbs = []string{
"logout", "logoff", "signout", "delete", "remove", "destroy", "drop", "purge", "wipe",
"reset", "shutdown", "restart", "reboot", "kill", "unsubscribe", "cancel", "revoke",
}
DestructiveVerbs are the words that mark a path as a state-changing action a GET may still trigger (a logout link, "/admin/delete?id=1"). Discovery never requests such a path and a crawler never follows one.
Functions ¶
func CleanPath ¶
CleanPath is the path a server sees for an escaped request path: percent-decoded, backslashes read as slashes, dot segments resolved, never empty, a trailing slash kept. A path with an encoded slash, backslash or NUL, a control character, or a dot segment with parameters ("..;") is refused: servers disagree on it.
func Denied ¶
Denied returns the first deny path that a clean path falls under, in any reading. A deny path matches every path that starts with it, ignoring case: over-blocking is the safe side ("/admin" also denies "/Admin" and "/administrator").
func Destructive ¶
Destructive reports whether a path (escaped or clean) names a state-changing action: a segment has a word that is one of DestructiveVerbs, or that starts with one ("deleteUser", "logout_all", "resetPassword"), or two adjacent words that join into one ("log-out", "sign_out"). Words are split on anything that is not a letter or a digit, and on a lower-to-upper case change. Over-blocking is the safe side.
func HasDotSegment ¶
HasDotSegment reports whether a path has a "." or ".." segment.
Types ¶
This section is empty.