def testVersion2(self): definitions["jquery"]["vulnerabilities"].append( {"atOrAbove": "10.0.0-*", "below": "10.0.1"}) result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/10.0.0.beta.2/jquery.min.js", definitions) self.assertTrue(retire.is_vulnerable(result))
def testVersion1(self): definitions["jquery"]["vulnerabilities"].append( {"below": "10.0.0.beta.2"}) result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/10.0.0/jquery.min.js", definitions) self.assertFalse(retire.is_vulnerable(result))
def testVersion9(self): definitions["jquery"]["vulnerabilities"] = [{"below": "10.0.0.beta.2"}] result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/10.0.0.rc.1/jquery.min.js", definitions) self.assertFalse(retire.is_vulnerable(result))
def testfilename6(self): result = retire.scan_filename("jquery-1.6.0-rc.1.js") self.assertTrue(retire.is_vulnerable(result))
def testfilename4(self): result = retire.scan_filename("jquery-1.12.1.js") self.assertFalse(retire.is_vulnerable(result))
def testhash4(self): definitions["jquery"]["extractors"]["hashes"][hash] = "1.12.1" result = retire.scan_file_content(content) self.assertFalse(retire.is_vulnerable(result))
def testhash1(self): global content, hash definitions["jquery"]["extractors"]["hashes"][hash] = "1.8.1" result = retire.scan_file_content(content) self.assertTrue(retire.is_vulnerable(result))
def testuri5(self): result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js") self.assertTrue(retire.is_vulnerable(result))
def test6(self): result = retire.scan_file_content("a = 1; /*! jQuery v1.4 asdasd ") self.assertTrue(retire.is_vulnerable(result))
def test4(self): result = retire.scan_file_content("/*! jQuery v1.12.1 asdasd ") self.assertFalse(retire.is_vulnerable(result))
def testVersion8(self): definitions["jquery"]["vulnerabilities"] = [{"below": "10.0.0"}] result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/10.0.0.rc.1/jquery.min.js", definitions) self.assertTrue(retire.is_vulnerable(result))
def testVersion4(self): definitions["jquery"]["vulnerabilities"] = [{"below": "1.9.0b1"}] result = retire.scan_uri( "https://ajax.googleapis.com/ajax/libs/jquery/1.9.0rc1/jquery.min.js", definitions) self.assertFalse(retire.is_vulnerable(result))
def testfilename2(self): result = retire.scan_filename("jquery-2.0.0.js") self.assertTrue(retire.is_vulnerable(result))
def testfilename3(self): result = retire.scan_filename("jquery-1.12.0.js") self.assertFalse(retire.is_vulnerable(result))