From 50048ddf1529989d090e0047be14857a62a3c40a Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Tue, 9 Jul 2024 12:48:45 +0100 Subject: [PATCH 1/6] update CDN to v5.3.0 --- src/views/layout.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/layout.html b/src/views/layout.html index 58f35a2..5ee943f 100644 --- a/src/views/layout.html +++ b/src/views/layout.html @@ -20,7 +20,7 @@ {% from "govuk/components/notification-banner/macro.njk" import govukNotificationBanner %} {% block head %} - + @@ -86,6 +86,6 @@ {% if FEATURE_FLAG_ENABLE_COOKIE_BANNER == "true" %} {% endif %} - + {% endblock %} \ No newline at end of file From 5a28144930fdb941ed80da3f170c83b027b9edba Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Tue, 9 Jul 2024 12:49:37 +0100 Subject: [PATCH 2/6] add sign-out component --- src/config/helmet.ts | 2 +- src/views/include/sign-out.html | 10 ++++++++++ src/views/layout.html | 1 + test/mock/data.ts | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/views/include/sign-out.html diff --git a/src/config/helmet.ts b/src/config/helmet.ts index 562f9a8..8754fa6 100644 --- a/src/config/helmet.ts +++ b/src/config/helmet.ts @@ -13,7 +13,7 @@ export const configureHelmet = (app: express.Application) => { directives: { defaultSrc: ["'self'"], fontSrc: ["'self'", config.CDN_HOST], - styleSrc: ["'self'", config.CDN_HOST], + styleSrc: ["'self'", "'unsafe-hashes'", "'sha256-6FWIojjtZwiNizws7ImlHjGH3DA5yMh5x4c+/4UVpXk='", config.CDN_HOST], scriptSrc: [ "'self'", "'sha256-l1eTVSK8DTnK8+yloud7wZUqFrI0atVo6VlC6PJvYaQ='", diff --git a/src/views/include/sign-out.html b/src/views/include/sign-out.html new file mode 100644 index 0000000..9c3c0b3 --- /dev/null +++ b/src/views/include/sign-out.html @@ -0,0 +1,10 @@ +{% if userEmail %} + +{% endif %} diff --git a/src/views/layout.html b/src/views/layout.html index 5ee943f..4ea86a3 100644 --- a/src/views/layout.html +++ b/src/views/layout.html @@ -44,6 +44,7 @@ {% block beforeContent %} {% include "include/phase-banner.html" %} + {% include "include/sign-out.html" %} {% block backLink %} {% endblock %} {% endblock %} diff --git a/test/mock/data.ts b/test/mock/data.ts index ab8d163..d58bbd0 100644 --- a/test/mock/data.ts +++ b/test/mock/data.ts @@ -107,7 +107,7 @@ export const MOCK_HELMET_VALUE = { directives: { defaultSrc: ["'self'"], fontSrc: ["'self'", config.CDN_HOST], - styleSrc: ["'self'", config.CDN_HOST], + styleSrc: ["'self'", "'unsafe-hashes'", "'sha256-6FWIojjtZwiNizws7ImlHjGH3DA5yMh5x4c+/4UVpXk='", config.CDN_HOST], scriptSrc: [ "'self'", // Hash of the inline scripts respectively for: From 6291e4a0e70cf6be9544d8fb79c0a68326b6e829 Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Wed, 10 Jul 2024 09:26:52 +0100 Subject: [PATCH 3/6] add govuk-body class to p tag --- src/views/include/sign-out.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/include/sign-out.html b/src/views/include/sign-out.html index 9c3c0b3..bddd618 100644 --- a/src/views/include/sign-out.html +++ b/src/views/include/sign-out.html @@ -1,7 +1,7 @@ {% if userEmail %}
  • -

    +

    {{ userEmail }} | Sign out

    From 6a6995188dc29289b5fa6c5a6ef55e223a7d093d Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Wed, 10 Jul 2024 10:35:51 +0100 Subject: [PATCH 4/6] remove javascripts from cdn path --- src/views/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/layout.html b/src/views/layout.html index 4ea86a3..b1a2e73 100644 --- a/src/views/layout.html +++ b/src/views/layout.html @@ -87,6 +87,6 @@ {% if FEATURE_FLAG_ENABLE_COOKIE_BANNER == "true" %} {% endif %} - + {% endblock %} \ No newline at end of file From ff5bb51a03508980774629b42f164e4552fa13f9 Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Wed, 10 Jul 2024 11:09:21 +0100 Subject: [PATCH 5/6] update @co-digital/login to v1.0.4 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39b2f38..0a80fd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@aws-sdk/lib-dynamodb": "^3.585.0", "@co-digital/api-sdk": "^1.0.6", "@co-digital/logging": "^1.0.1", - "@co-digital/login": "^1.0.3", + "@co-digital/login": "^1.0.4", "cookie-parser": "^1.4.6", "cookie-session": "^2.1.0", "cors": "^2.8.5", @@ -1422,9 +1422,9 @@ } }, "node_modules/@co-digital/login": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@co-digital/login/-/login-1.0.3.tgz", - "integrity": "sha512-B8TPdsXg/UcQ27FBUFgPW8wrDq04qHBH56GdHOWhXnVA5PT46wUpGQ1yLVLMFg+88txdDmAGb0HViTYkqiv/tw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@co-digital/login/-/login-1.0.4.tgz", + "integrity": "sha512-w57cntkUq5BxcPfVWY5gOuYa+s+2Qy+crUMhTQaxL9oIiAOKnZdoIMkPXtLAy8JYs8KV90eFrTWQvIAWg1Kpfw==", "dependencies": { "@co-digital/logging": "^1.0.2", "cookie-parser": "^1.4.6", diff --git a/package.json b/package.json index 0976b0d..b13b33e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@aws-sdk/lib-dynamodb": "^3.585.0", "@co-digital/api-sdk": "^1.0.6", "@co-digital/logging": "^1.0.1", - "@co-digital/login": "^1.0.3", + "@co-digital/login": "^1.0.4", "cookie-parser": "^1.4.6", "cookie-session": "^2.1.0", "cors": "^2.8.5", From 4da3458bbb91813ac3469e77cc602a88fbd73960 Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Wed, 10 Jul 2024 11:10:09 +0100 Subject: [PATCH 6/6] display userEmailAuth on sign-out banner for production environment --- src/views/include/sign-out.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/include/sign-out.html b/src/views/include/sign-out.html index bddd618..f155a2d 100644 --- a/src/views/include/sign-out.html +++ b/src/views/include/sign-out.html @@ -1,8 +1,8 @@ -{% if userEmail %} +{% if userEmailAuth or userEmail %}
    • - {{ userEmail }} | + {{ userEmailAuth | default(userEmail) }} | Sign out