Skip to content

Commit

Permalink
Add nonces back in for scripts and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jun 12, 2024
1 parent 08044d5 commit f29e519
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def create_app(config_class):
"connect-src": app.config["CSP_CONNECT_SRC"],
"media-src": app.config["CSP_MEDIA_SRC"],
},
content_security_policy_nonce_in=["script-src", "style-src"],
feature_policy={
"camera": "'none'",
"fullscreen": "'self'",
Expand Down
4 changes: 2 additions & 2 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,6 @@
{% endblock %}

{% block bodyEnd %}
<script src="{{ url_for('static', filename='main.min.js') }}" defer></script>
<script src="{{ url_for('static', filename='analytics.min.js') }}" defer></script>
<script src="{{ url_for('static', filename='main.min.js') }}" nonce="{{ csp_nonce() }}" defer></script>
<script src="{{ url_for('static', filename='analytics.min.js') }}" nonce="{{ csp_nonce() }}" defer></script>
{% endblock %}
2 changes: 1 addition & 1 deletion app/templates/catalogue/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block beforeContent %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/catalogue/creator.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block beforeContent %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/catalogue/person.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block beforeContent %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/catalogue/record.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='catalogue.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block beforeContent %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/explore-the-collection/article-focused.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ <h2 class="etna-author-list__heading tna-heading-s">Author{{ 's' if page_data.au
{% endblock %}

{% block bodyEnd %}
<script src="{{ url_for('static', filename='article.min.js') }}" defer></script>
<script src="{{ url_for('static', filename='article.min.js') }}" nonce="{{ csp_nonce() }}" defer></script>
{{ super() }}
{% endblock %}
4 changes: 2 additions & 2 deletions app/templates/explore-the-collection/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='article.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='article.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block content %}
Expand Down Expand Up @@ -88,6 +88,6 @@ <h1 class="tna-hgroup__title" itemprop="name">{{ page_data.title }}</h1>
{% endblock %}

{% block bodyEnd %}
<script src="{{ url_for('static', filename='article.min.js') }}" defer></script>
<script src="{{ url_for('static', filename='article.min.js') }}" nonce="{{ csp_nonce() }}" defer></script>
{{ super() }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='highlight-gallery.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='highlight-gallery.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/explore-the-collection/record-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='article.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='article.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/main/new_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block stylesheets %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='homepage.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='homepage.css') }}" nonce="{{ csp_nonce() }}">
{% endblock %}

{% block content %}
Expand Down

0 comments on commit f29e519

Please sign in to comment.