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

Class TestPLAINPWD001

tests/unit/test_missing_rules.py:327–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325# ============================================================
326
327class TestPLAINPWD001:
328 def test_create_with_tainted_password_fires(self):
329 code = """
330 pwd = request.POST.get('password')
331 User.objects.create(username='alice', password=pwd)
332 """
333 assert fires(code, "PLAIN_PWD001"), "PLAIN_PWD001 must fire: tainted password in ORM create()"
334
335 def test_hashed_password_safe(self):
336 code = """
337 from django.contrib.auth.hashers import make_password
338 User.objects.create(username='alice', password=make_password(raw_pwd))
339 """
340 assert not_fires(code, "PLAIN_PWD001"), "PLAIN_PWD001 must NOT fire when password is hashed"
341
342
343# ============================================================

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected