def test_INP13(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.validatesInput = False lambda1.validatesInput = False ThreatObj = Threat(next(item for item in threats_json if item["SID"] == "INP13")) self.assertTrue(ThreatObj.apply(process1)) self.assertTrue(ThreatObj.apply(lambda1))
def test_INP13(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.validatesInput = False lambda1.validatesInput = False threat = threats["INP13"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1))
def test_API02(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.implementsAPI = True process1.validatesInput = False lambda1.implementsAPI = True lambda1.validatesInput = False threat = threats["API02"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1))
def test_INP26(self): process1 = Process("Process") lambda1 = Lambda("lambda") process1.validatesInput = False process1.sanitizesInput = False lambda1.validatesInput = False lambda1.sanitizesInput = False threat = threats["INP26"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1))
def test_INP24(self): process1 = Process("Process") lambda1 = Lambda("lambda") process1.checksInputBounds = False process1.validatesInput = False lambda1.checksInputBounds = False lambda1.validatesInput = False threat = threats["INP24"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1))
def test_API02(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.implementsAPI = True process1.validatesInput = False lambda1.implementsAPI = True lambda1.validatesInput = False ThreatObj = Threat(next(item for item in threats_json if item["SID"] == "API02")) self.assertTrue(ThreatObj.apply(process1)) self.assertTrue(ThreatObj.apply(lambda1))
def test_INP14(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") web = Server("Web Server") process1.validatesInput = False lambda1.validatesInput = False web.validatesInput = False threat = threats["INP14"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1)) self.assertTrue(threat.apply(web))
def test_INP24(self): process1 = Process("Process") lambda1 = Lambda("lambda") process1.checksInputBounds = False process1.validatesInput = False lambda1.checksInputBounds = False lambda1.validatesInput = False ThreatObj = Threat( next(item for item in threats_json if item["SID"] == "INP24")) self.assertTrue(ThreatObj.apply(process1)) self.assertTrue(ThreatObj.apply(lambda1))
def test_AC03(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.usesEnvironmentVariables = True process1.implementsAuthenticationScheme = False process1.validatesInput = False process1.authorizesSource = False lambda1.usesEnvironmentVariables = True lambda1.implementsAuthenticationScheme = False lambda1.validatesInput = False lambda1.authorizesSource = False threat = threats["AC03"] self.assertTrue(threat.apply(process1)) self.assertTrue(threat.apply(lambda1))
def test_INP08(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") web = Server("Web Server") process1.validatesInput = False process1.sanitizesInput = False lambda1.validatesInput = False lambda1.sanitizesInput = False web.validatesInput = False web.sanitizesInput = False ThreatObj = Threat(next(item for item in threats_json if item["SID"] == "INP08")) self.assertTrue(ThreatObj.apply(process1)) self.assertTrue(ThreatObj.apply(lambda1)) self.assertTrue(ThreatObj.apply(web))
def test_AC03(self): process1 = Process("Process1") lambda1 = Lambda("Lambda1") process1.usesEnvironmentVariables = True process1.implementsAuthenticationScheme = False process1.validatesInput = False process1.authorizesSource = False lambda1.usesEnvironmentVariables = True lambda1.implementsAuthenticationScheme = False lambda1.validatesInput = False lambda1.authorizesSource = False ThreatObj = Threat(next(item for item in threats_json if item["SID"] == "AC03")) self.assertTrue(ThreatObj.apply(process1)) self.assertTrue(ThreatObj.apply(lambda1))