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

Reduce number of CSP + Turbolinks complaints #273

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChaelCodes
Copy link
Owner

fixes #272

Description of Changes

Reload stylesheet for Turbolinks, so the CSP allows it.

Also, remove inline styles and replace with cards, so the CSP stops complaining.

Did not fix: CSP complains on back button.

Screenshots

Problem Solved

CSP was throwing errors into the console due to inline styles and unreloaded stylesheets from turbolinks.

PR Checklist

  • Unit test coverage?
  • Code Climate Passes? (Reach out to @ChaelCodes if checks need dismissing)
  • Example Seed file if new data table introduced?

@ChaelCodes
Copy link
Owner Author

Please review my lazy CSP fixes PR @sjaustirni

Copy link

@sjaustirni sjaustirni left a comment

Choose a reason for hiding this comment

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

This is a clever fix, I like it :D

<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<meta charset="utf-8">
<meta name="turbolinks-cache-control" content="no-cache">

Choose a reason for hiding this comment

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

(suggestion): Removing this line seems to fix the back button issue (since we are caching now, we don't really need the full page reload on back button click, as the bundle is still valid). (additional context).

(suggestion): When testing, remember to open the page in a new tab after removing the line. Otherwise you can go back to the history when this line was still being served and that will trigger a CSP error! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content Security Policy blocks execution of Turbolinks
2 participants