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

Remove safe and markdown filters from templates #286

Merged
merged 7 commits into from
Nov 7, 2016

Conversation

pcraig3
Copy link
Contributor

@pcraig3 pcraig3 commented Nov 4, 2016

So it turns out that using safe and markdown (which is more permissive than safe) isn't actually that safe, despite the deceptive name.

This pull request removes all uses of safe and markdown from our templates, as well as removes two outdated patterns that we have stopped using (namely, search-results and framework-notice).

It's a pretty large breaking change because in quite a few places we're passing stuff into the templates that we expect will be escaped, but @allait and I are taking care of pulling them into the frontend apps.

Markdown formatted text in the content is still allowed, it's just going to be handled in the content loader now instead of here, so some of our examples have had to change to just using straight HTML rather than asterisks and dashes.

We used this once when DOS1 was opening, but since then we've
interated relentlessly and focused like crazy on user needs so
that now we have a much simpler template.

This one was ultimately too prescriptive to really be extended
and so let's just get rid of it.
The markdown filter is becoming a bit dangerous and now that we
have TemplateFields in the ContentLoader, we can stop using it.
Within the self-contained universe of the frontend toolkit,
'markdown' as a concept has been obliterated.

It seemed like we had two options going forward:

1. Do some intermediary processing in the `generate_pages.py` file
   to run some of our question fields through markdown.
   This would reflects how these particular fields from the content
   will actually appear once rendered in front of users.
2. Remove all markdown from the examples in favour of straight HTML.
   This is consistent with how the templates itself act in isolation.

We've gone with the latter approach because in general it seems
safer to ignore the world outside of this app because it's less
certain and subject to change.
If we pull in the content-loader, we don't need the markdown
filter at all anymore.
Means we can un-require the utils repo altogether.
It's better to pass in messages as Markup than to require all of
the templates use the `safe` filter.
Doesn't appeear to be used anywhere, so it gets ✂️.
@allait
Copy link
Contributor

allait commented Nov 7, 2016

👍

@allait allait merged commit 8c98fda into master Nov 7, 2016
@allait allait deleted the pc-make-markdown-missing branch November 7, 2016 14:20
@idavidmcdonald
Copy link
Contributor

Would be good to add a record to the changelog for the breaking version bump please :)

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.

3 participants