mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Refs #24461 -- Added test/release notes for XSS issue in ModelAdmin.readonly_fields
This issue was fixed by refs #24464.
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							300fdbbebb
						
					
				
				
					commit
					82c9169077
				
			| @@ -4644,6 +4644,15 @@ class ReadonlyTest(TestCase): | ||||
|         self.assertContains(response, '<label for="id_public">Overridden public label:</label>', html=True) | ||||
|         self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)") | ||||
|  | ||||
|     def test_correct_autoescaping(self): | ||||
|         """ | ||||
|         Make sure that non-field readonly elements are properly autoescaped (#24461) | ||||
|         """ | ||||
|         section = Section.objects.create(name='<a>evil</a>') | ||||
|         response = self.client.get(reverse('admin:admin_views_section_change', args=(section.pk,))) | ||||
|         self.assertNotContains(response, "<a>evil</a>", status_code=200) | ||||
|         self.assertContains(response, "<a>evil</a>", status_code=200) | ||||
|  | ||||
|  | ||||
| @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], | ||||
|     ROOT_URLCONF="admin_views.urls") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user