Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace logo selection route with per-request global variable #5874

Merged
merged 1 commit into from Mar 25, 2021

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Mar 16, 2021

Status

Ready for review

Description of Changes

Getting the logo URL via the /org-logo route's redirect meant that the logo had to be retrieved with every page load, which of course over Tor can take several seconds. Selecting the logo at the start of each request and storing its URL in the Flask globals allows the static URL to be used in the templates, with the default caching of static assets, eliminating the extra requests.

Testing

  • git checkout -b static-logo origin/static-logo
  • If you have a custom logo in your working copy at securedrop/static/i/custom_logo.png, remove it.
  • make dev
  • Verify that the default logo is shown on both source and journalist interfaces, served from its static URL, not from /org-logo.
  • Note that the logo is cached like other static assets, and not retrieved on subsequent normal page loads.
  • Visit the instance configuration page in the journalist interface, upload a custom logo, and check that it's used in both source and journalist interfaces.
  • Make the same checks in an environment using Apache, like staging.

Deployment

This does introduce the possibility of OSSEC alerts from the errors logged if no site logo is available, or if the static directory is missing.

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make test) pass in the development container

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

Choose one of the following:

  • I have opened a PR in the docs repo for these changes, or will do so later
  • I would appreciate help with the documentation
  • These changes do not require documentation

@emkll emkll added this to Ready for Review in SecureDrop Team Board Mar 17, 2021
@rmol rmol self-assigned this Mar 17, 2021
@kushaldas kushaldas moved this from Ready for Review to Under Review in SecureDrop Team Board Mar 25, 2021
@kushaldas kushaldas self-assigned this Mar 25, 2021
Getting the logo URL via the /org-logo route's redirect meant that the
logo had to be retrieved with every page load, which of course over
Tor can take several seconds. Selecting the logo at the start of each
request and storing its URL in the Flask globals allows the static URL
to be used in the templates, with the default caching of static
assets, eliminating the extra requests.
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Logo is static when using default logo
  • Custom logo is static

This is true for both source and journalist interfaces. Approved

@kushaldas kushaldas merged commit 480cf77 into develop Mar 25, 2021
SecureDrop Team Board automation moved this from Under Review to Done Mar 25, 2021
@zenmonkeykstop zenmonkeykstop mentioned this pull request Jun 14, 2021
39 tasks
@rmol rmol deleted the static-logo branch June 23, 2021 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants