MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / record_rules

Method record_rules

src/pyspector/stats.py:115–140  ·  view source on GitHub ↗
(self, rules_toml_str: str)

Source from the content-addressed store, hash-verified

113 )
114
115 def record_rules(self, rules_toml_str: str) -> None:
116 try:
117 import toml # already a project dependency
118 data = toml.loads(rules_toml_str)
119 rules = data.get("rule", [])
120 self.rules_count = len(rules)
121
122 for sink in data.get("taint_sink", []):
123 vid = sink.get("vulnerability_id", "")
124 if vid:
125 self._rule_detection[vid] = "taint"
126
127 for rule in rules:
128 rid = rule.get("id", "")
129 if rid in self._rule_detection:
130 continue # already tagged via taint sink
131 has_ast = bool(rule.get("ast_match"))
132 has_regex = bool(rule.get("pattern"))
133 if has_regex:
134 self._rule_detection[rid] = "regex"
135 elif has_ast:
136 self._rule_detection[rid] = "ast"
137 else:
138 self._rule_detection[rid] = "taint"
139 except Exception:
140 pass
141
142 def record_raw_issues(self, raw_issues: List[Any]) -> None:
143 self.pre_filter_count = len(raw_issues)

Callers 1

_execute_scanFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected