pub struct CalleePattern { /* private fields */ }Expand description
A pre-segmented callee pattern. Matching is segment-aware (NOT substring):
the pattern is split on ., a leading * segment means “any object”
(*.innerHTML matches el.innerHTML and this.node.innerHTML by
suffix-matching the trailing non-* segments), and a trailing * segment
means “any member” (child_process.* matches child_process.exec by
prefix-matching the leading non-* segments). The security catalogue uses
exact and leading-wildcard rows; the trailing form serves the boundary
forbidden-call detector.
Implementations§
Source§impl CalleePattern
impl CalleePattern
Sourcepub fn parse(raw: &str) -> Option<Self>
pub fn parse(raw: &str) -> Option<Self>
Parse a raw pattern string into its segmented form. Returns None for
an empty or whitespace-only pattern. Public constructor for non-security
reusers of the segment-aware matcher (the boundary forbidden-call
detector); the catalogue’s own rows go through the same parser.
Sourcepub fn matches(&self, callee_path: &str) -> bool
pub fn matches(&self, callee_path: &str) -> bool
Segment-aware match against a captured dotted/bare callee path.
With a leading *, the trailing segments must equal the tail of the
candidate’s segments (suffix match), so *.innerHTML matches
el.innerHTML but not el.innerHTMLFoo. With a trailing *, the
leading segments must equal the head of the candidate’s segments
(prefix match), so child_process.* matches child_process.exec but
not the bare child_process. Without either, the whole segment list
must match exactly, so fetch matches fetch but not myfetch.
Patterns carrying BOTH wildcards match nothing (rejected by the config
layer; never produced by catalogue rows).