Skip to content

Commit 3b73b0d

Browse files
authored
Merge pull request #2597 from canonical/csp-styles
fix: update inline style blocks and add nonces
2 parents 139c803 + dd49477 commit 3b73b0d

117 files changed

Lines changed: 987 additions & 555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

static/sass/_utilities_csp.scss

Lines changed: 488 additions & 0 deletions
Large diffs are not rendered by default.

static/sass/styles.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,4 +1211,9 @@ body:not(.js-enabled) {
12111211
grid-template-rows: auto;
12121212
}
12131213
}
1214-
}
1214+
}
1215+
1216+
// Utility classes that replace inline style attributes (WD-36639).
1217+
// Imported last so this single-class utility layer wins same-specificity
1218+
// ties, mirroring the precedence the original inline styles had.
1219+
@import "utilities_csp";

templates/academy/exam-content/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h1>Exam Content</h1>
5656
id="{{ exam['exam_name'] }}-tab"
5757
aria-labelledby="{{ exam['exam_name'] }}"
5858
{% if (exam_name and exam_name!=exam["exam_name"]) or (not exam_name and loop.index!=1) %}hidden="hidden"{% endif %}>
59-
<div class="row" style="padding: 4rem 0rem;">
59+
<div class="row u-padding-4rem-0">
6060
<div class="col-6">
6161
<p class="p-heading--5">OVERVIEW</p>
6262
</div>
@@ -81,7 +81,7 @@ <h2 class="p-stepped-list__title">{{ chapter['chapter_title'] }}</h2>
8181
</div>
8282
<div class="u-fixed-height">
8383
<div class="row">
84-
<a href="/university/schedule" style="display: none;">
84+
<a class="u-display-none" href="/university/schedule">
8585
<button class="p-button--positive">Schedule your exam now</button>
8686
</a>
8787
</div>

templates/academy/self-study.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h1 class="p-heading--2">
3232
</section>
3333
<section>
3434
<div class="row">
35-
<div class="p-tabs" style="padding-bottom:4rem;">
35+
<div class="p-tabs u-padding-bottom-4rem">
3636
<div class="p-tabs__list u-no-margin--bottom"
3737
role="tablist"
3838
aria-label="CUE Syllabus">
@@ -69,7 +69,7 @@ <h1 class="p-heading--2">
6969
</div>
7070
</div>
7171
</div>
72-
<div class="col-6" style="padding-bottom:4rem;">
72+
<div class="col-6 u-padding-bottom-4rem">
7373
<div tabindex="0"
7474
role="tabpanel"
7575
id="examTips-tab"

templates/anbox-cloud/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h3 class="p-heading--5">GPU support for heavy workloads</h3>
220220
<div class="u-fixed-width">
221221
<hr class="p-rule" />
222222
<div class="col">
223-
<h2 class="p-text--small-caps" style="margin-top: 0.5rem;">Cloud service providers</h2>
223+
<h2 class="p-text--small-caps u-margin-top-0-5rem">Cloud service providers</h2>
224224
</div>
225225
</div>
226226
<div class="u-fixed-width">
@@ -408,7 +408,7 @@ <h3 class="p-heading--5">Webinar</h3>
408408
<section class="p-section" id="cloud-ecosystem">
409409
<div class="p-section--shallow u-fixed-width">
410410
<hr class="p-rule--highlight" />
411-
<h2 class="p-text--small-caps" style="margin-top: 0.5rem;">Leaning on a strong cloud ecosystem</h2>
411+
<h2 class="p-text--small-caps u-margin-top-0-5rem">Leaning on a strong cloud ecosystem</h2>
412412
</div>
413413
<div class="p-section">
414414
<div class="row--25-75">
@@ -728,7 +728,7 @@ <h2 class="p-section--shallow">Run Android in the cloud with Anbox Cloud</h2>
728728
<div class="u-fixed-width">
729729
<hr class="p-rule" />
730730
<div class="col">
731-
<h2 class="p-text--small-caps" style="margin-top: 0.5rem;">A selection of customers</h2>
731+
<h2 class="p-text--small-caps u-margin-top-0-5rem">A selection of customers</h2>
732732
</div>
733733
</div>
734734
<div class="u-fixed-width">

templates/base_index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,10 @@
116116
<body class="
117117
{% block body_class %}{% endblock %} l-site">
118118
<!-- Google Tag Manager (noscript) -->
119-
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M5BPGQ6"
119+
<noscript><iframe class="u-display-none u-visibility-hidden" src="https://www.googletagmanager.com/ns.html?id=GTM-M5BPGQ6"
120120
height="0"
121121
width="0"
122-
style="display:none;
123-
visibility:hidden"></iframe></noscript>
122+
></iframe></noscript>
124123
<a href="#main-content" class="u-off-screen">Skip to main content</a>
125124

126125
{% include "partial/_notifications.html" %}

templates/blog/article.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@
6161
{% if article.author %}
6262
{% if article.author and article.author.id == 217 %}
6363
<img src="https://assets.ubuntu.com/v1/f16c40d0-Favicon+-+CoF.svg"
64-
class="p-media-object__image"
64+
class="p-media-object__image u-align-self-center"
6565
alt=""
66-
style="align-self: center" />
66+
/>
6767
{% else %}
6868
<img src="{{ article.author.avatar_urls['96'] }}"
69-
class="p-media-object__image is-round"
69+
class="p-media-object__image is-round u-align-self-center"
7070
alt=""
71-
style="align-self: center" />
71+
/>
7272
{% endif %}
7373
{% endif %}
7474

templates/careers/_base-department.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ <h3 class="p-heading--2">
171171
</h3>
172172
</div>
173173
<div id="latest-articles"
174-
class="col-6 col-medium-3"
175-
style="padding-top: 0.5rem">
176-
<div style="min-height: 9.1rem">
174+
class="col-6 col-medium-3 u-padding-top-0-5rem"
175+
>
176+
<div class="u-min-height-9-1rem">
177177
<i class="p-icon--spinner u-animation--spin">Loading...</i>
178178
</div>
179179
</div>
180180
</div>
181-
<template style="display:none" id="articles-template">
181+
<template class="u-display-none" id="articles-template">
182182
<article class="u-extra-space">
183183
<div class="blog-p-card__content">
184184
<hr class="p-rule" />

templates/careers/_search.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if vacancies %}
22
<div class="js-search-jobs-form p-search-roles">
3-
<form action="/careers/all" class="p-search-roles__form" {% if form_styles %}style="{{ form_styles }}"{% endif %}>
3+
<form action="/careers/all" class="p-search-roles__form">
44
<div class="p-search-roles__group">
55
<label class="u-off-screen" for="search">Search</label>
66
<div class="p-search-roles__control u-clearfix u-no-padding--right">
@@ -13,7 +13,7 @@
1313
</div>
1414
</div>
1515
</div>
16-
<button type="submit" alt="search roles" class="p-button--positive" style="white-space: nowrap; border: none;">Search roles</button>
16+
<button type="submit" alt="search roles" class="p-button--positive u-white-space-nowrap u-border-none">Search roles</button>
1717
</form>
1818
</div>
1919
<script src="{{ versioned_static('js/modules/fuse/fuse.js') }}" nonce="{{ csp_nonce }}"></script>

templates/careers/all.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% block meta_description %}Canonical publishes Ubuntu, provides commercial services and solutions for Ubuntu, and works with hardware manufacturers, software vendors and public.{% endblock %}
88

99
{% block hero %}
10-
<section class="p-strip--light" style="background: url(https://assets.ubuntu.com/v1/18717572-05_suru2_light_glow_8K_edited.png) 70% bottom; background-size: cover;">
10+
<section class="p-strip--light u-suru-light-background">
1111
<div class="u-fixed-width u-sv3">
1212
<h1 class="u-no-margin--bottom p-heading--2">Open roles</h1>
1313
</div>

0 commit comments

Comments
 (0)