Skip to content

Commit

Permalink
Encrypt site icon requests
Browse files Browse the repository at this point in the history
Paths to favicons are now encrypted with the user's Fernet key, the same
as any other external result page element
  • Loading branch information
benbusby committed Oct 11, 2023
1 parent a7e937f commit 81b7fd1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,11 @@ def add_favicon(self, link) -> None:

# Construct the html for inserting the icon into the parent div
parsed = urlparse.urlparse(link['href'])
src = f'{self.root_url}/{Endpoint.element}?url=' + (
f'{parsed.scheme}://{parsed.netloc}/favicon.ico'
) + '&type=image/x-icon'
favicon = self.encrypt_path(
f'{parsed.scheme}://{parsed.netloc}/favicon.ico',
is_element=True)
src = f'{self.root_url}/{Endpoint.element}?url={favicon}' + \
'&type=image/x-icon'
html = f'<img class="site-favicon" src="{src}">'

favicon = BeautifulSoup(html, 'html.parser')
Expand Down

0 comments on commit 81b7fd1

Please sign in to comment.