mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-12 05:05:32 +02:00
Prevent external redirects
This commit is contained in:
@@ -35,6 +35,15 @@ class BookmarkUnarchiveViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
|
||||
self.assertRedirects(response, reverse('bookmarks:close'))
|
||||
|
||||
def test_should_not_redirect_to_external_url(self):
|
||||
bookmark = self.setup_bookmark()
|
||||
|
||||
response = self.client.get(
|
||||
reverse('bookmarks:unarchive', args=[bookmark.id]) + '?return_url=https://example.com'
|
||||
)
|
||||
|
||||
self.assertRedirects(response, reverse('bookmarks:archived'))
|
||||
|
||||
def test_can_only_archive_own_bookmarks(self):
|
||||
other_user = User.objects.create_user('otheruser', 'otheruser@example.com', 'password123')
|
||||
bookmark = self.setup_bookmark(is_archived=True, user=other_user)
|
||||
|
Reference in New Issue
Block a user