MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / add_taint

Method add_taint

aura/analyzers/python/nodes.py:237–267  ·  view source on GitHub ↗

Assign a taint to the node Operation is ignored if the current taint is already higher or equal return True if the taint was modified (increased)

(self, taint: Taints, context: Context, lock=False, taint_log: typing.Optional[TaintLog]=None)

Source from the content-addressed store, hash-verified

235 pp(self)
236
237 def add_taint(self, taint: Taints, context: Context, lock=False, taint_log: typing.Optional[TaintLog]=None) -> bool:
238 """
239 Assign a taint to the node
240 Operation is ignored if the current taint is already higher or equal
241 return True if the taint was modified (increased)
242 """
243 if taint_log:
244 logger.debug(f"{taint_log.message} at {taint_log.path}:{taint_log.line_no}")
245
246 if lock:
247 self._taint_locked = True
248 if taint != self._taint_class:
249 self._taint_class = taint
250 if taint_log:
251 self._taint_log.append(taint_log)
252 else:
253 warn("Taint is modified but the log entry is not set", stacklevel=2)
254 return True
255 return False
256 elif self._taint_locked:
257 return False
258 if taint <= self._taint_class:
259 return False
260
261 self._taint_class = taint
262 context.visitor.modified = True
263 if taint_log:
264 self._taint_log.append(taint_log)
265 else:
266 warn("Taint is modified but the log entry is not set", stacklevel=2)
267 return True
268
269 def set_safe(self, context: Context) -> bool:
270 if self._taint_class != Taints.SAFE:

Callers 4

applyMethod · 0.80
_visit_nodeMethod · 0.80
__propagate_taintMethod · 0.80
__propagate_attributeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected