@dwp/govuk-casa 8.6.0 → 8.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,9 +91,9 @@ export function validateSessionName(name?: string | undefined): string;
91
91
  * Validates and sanitises sessions secure flag.
92
92
  *
93
93
  * @access private
94
- * @param {boolean} [secure=false] Session secure flag.
94
+ * @param {boolean} [secure] Session secure flag.
95
95
  * @throws {ReferenceError} For missing value type.
96
- * @throws {TypeError} For invalid value.
96
+ * @throws {TypeError} For invalid or missing value.
97
97
  * @returns {string} Name.
98
98
  */
99
99
  export function validateSessionSecure(secure?: boolean | undefined): string;
@@ -190,12 +190,15 @@ exports.validateSessionName = validateSessionName;
190
190
  * Validates and sanitises sessions secure flag.
191
191
  *
192
192
  * @access private
193
- * @param {boolean} [secure=false] Session secure flag.
193
+ * @param {boolean} [secure] Session secure flag.
194
194
  * @throws {ReferenceError} For missing value type.
195
- * @throws {TypeError} For invalid value.
195
+ * @throws {TypeError} For invalid or missing value.
196
196
  * @returns {string} Name.
197
197
  */
198
- function validateSessionSecure(secure = false) {
198
+ function validateSessionSecure(secure) {
199
+ if (secure === undefined) {
200
+ throw new Error('Session secure flag must be explicitly defined (session.secure)');
201
+ }
199
202
  if (typeof secure !== 'boolean') {
200
203
  throw new TypeError('Session secure flag must be boolean (session.secure)');
201
204
  }
@@ -11,22 +11,22 @@
11
11
  * })
12
12
  * @memberof module:@dwp/govuk-casa
13
13
  * @param {object} obj Options
14
- * @param {string} obj.waypoint Waypoint
15
- * @param {string} obj.mountUrl Mount URL
16
- * @param {JourneyContext} obj.journeyContext JourneyContext
17
- * @param {boolean} obj.edit Turn edit mode on or off
18
- * @param {string} obj.editOrigin Edit mode original URL
19
- * @param {boolean} obj.skipTo Skip to this waypoint from the current one
20
- * @param {string} obj.routeName Plan route name; next | prev
14
+ * @param {string} [obj.waypoint=""] Waypoint
15
+ * @param {string} [obj.mountUrl="/"] Mount URL
16
+ * @param {JourneyContext} [obj.journeyContext] JourneyContext
17
+ * @param {boolean} [obj.edit=false] Turn edit mode on or off
18
+ * @param {string} [obj.editOrigin] Edit mode original URL
19
+ * @param {boolean} [obj.skipTo] Skip to this waypoint from the current one
20
+ * @param {string} [obj.routeName=next] Plan route name; next | prev
21
21
  * @returns {string} URL
22
22
  */
23
23
  export default function waypointUrl({ waypoint, mountUrl, journeyContext, edit, editOrigin, skipTo, routeName, }?: {
24
- waypoint: string;
25
- mountUrl: string;
26
- journeyContext: JourneyContext;
27
- edit: boolean;
28
- editOrigin: string;
29
- skipTo: boolean;
30
- routeName: string;
24
+ waypoint?: string | undefined;
25
+ mountUrl?: string | undefined;
26
+ journeyContext?: import("./JourneyContext").default | undefined;
27
+ edit?: boolean | undefined;
28
+ editOrigin?: string | undefined;
29
+ skipTo?: boolean | undefined;
30
+ routeName?: string | undefined;
31
31
  }): string;
32
32
  export type JourneyContext = import('./index').JourneyContext;
@@ -27,13 +27,13 @@ const sanitiseWaypoint = (w) => w.replace(/[^/a-z0-9_-]/ig, '').replace(/\/+/g,
27
27
  * })
28
28
  * @memberof module:@dwp/govuk-casa
29
29
  * @param {object} obj Options
30
- * @param {string} obj.waypoint Waypoint
31
- * @param {string} obj.mountUrl Mount URL
32
- * @param {JourneyContext} obj.journeyContext JourneyContext
33
- * @param {boolean} obj.edit Turn edit mode on or off
34
- * @param {string} obj.editOrigin Edit mode original URL
35
- * @param {boolean} obj.skipTo Skip to this waypoint from the current one
36
- * @param {string} obj.routeName Plan route name; next | prev
30
+ * @param {string} [obj.waypoint=""] Waypoint
31
+ * @param {string} [obj.mountUrl="/"] Mount URL
32
+ * @param {JourneyContext} [obj.journeyContext] JourneyContext
33
+ * @param {boolean} [obj.edit=false] Turn edit mode on or off
34
+ * @param {string} [obj.editOrigin] Edit mode original URL
35
+ * @param {boolean} [obj.skipTo] Skip to this waypoint from the current one
36
+ * @param {string} [obj.routeName=next] Plan route name; next | prev
37
37
  * @returns {string} URL
38
38
  */
39
39
  function waypointUrl({ waypoint = '', mountUrl = '/', journeyContext, edit = false, editOrigin, skipTo, routeName = 'next', } = Object.create(null)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwp/govuk-casa",
3
- "version": "8.6.0",
3
+ "version": "8.7.1",
4
4
  "description": "A framework for building GOVUK Collect-And-Submit-Applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,15 +19,21 @@
19
19
  "views/**/*"
20
20
  ],
21
21
  "engines": {
22
- "node": ">=14.17.2"
22
+ "node": "^14.0.0 || ^16.0.0 || ^18.0.0",
23
+ "npm": "^8.0.0"
23
24
  },
24
25
  "scripts": {
25
26
  "pipeline": "npm run coverage && npm run lint",
27
+ "coverage": "c8 npm test",
28
+ "test": "npm run test:unit && npm run test:e2e",
26
29
  "test:unit": "mocha './tests/**/*.test.js'",
27
30
  "test:e2e": "spiderplan --worker-init ./tests/e2e/worker-init.js --language en ./tests/e2e/personas/**/*.yaml",
28
- "test": "npm run test:unit && npm run test:e2e",
31
+ "test:dast": "spiderplan --worker-init ./tests/e2e/worker-init.js --language en ./tests/e2e/personas/**/traversal.yaml --workers 1 --zap --zap-proxy 'http://localhost:8080/' --zap-target-hostname 'host.docker.internal'",
32
+ "test:dast:report": "curl -s --header 'X-ZAP-Api-Key: secret' http://localhost:8080/OTHER/core/other/htmlreport > gl-dast-report.html",
33
+ "test:dast:setup": "docker run --rm --name casa-dast -d -u zap -p 8080:8080 -i owasp/zap2docker-stable zap.sh -daemon -host 0.0.0.0 -port 8080 -config api.addrs.addr.name=\".*\" -config api.addrs.addr.regex=true -config api.key=secret; npm run test:dast:ready-check",
34
+ "test:dast:ready-check": "while [ \"$(curl -Is -o /dev/null -w %{response_code} http://localhost:8080/)\" -ne \"200\" ]; do sleep 1; echo 'Waiting for ZAP to start ...'; done",
35
+ "test:dast:teardown": "docker stop casa-dast",
29
36
  "lint": "eslint .",
30
- "coverage": "c8 npm test",
31
37
  "build": "npm run build:prepare && npm run build:sources && npm run build:css-assets",
32
38
  "build:prepare": "rm -rf dist/* && mkdir -p dist/assets/js/ && mkdir -p dist/assets/css/",
33
39
  "build:sources": "tsc -p tsconfig-cjs.json && ./scripts/fixup.sh",
@@ -47,10 +53,10 @@
47
53
  "deepmerge": "4.2.2",
48
54
  "express": "4.18.2",
49
55
  "express-session": "1.17.3",
50
- "govuk-frontend": "4.3.1",
56
+ "govuk-frontend": "4.4.0",
51
57
  "graphlib": "2.1.8",
52
58
  "helmet": "6.0.0",
53
- "i18next": "22.0.4",
59
+ "i18next": "22.0.6",
54
60
  "i18next-http-middleware": "3.2.1",
55
61
  "js-yaml": "4.1.0",
56
62
  "lodash": "4.17.21",
@@ -64,35 +70,32 @@
64
70
  "@babel/core": "7.20.2",
65
71
  "@babel/eslint-parser": "7.19.1",
66
72
  "@babel/preset-env": "7.20.2",
67
- "@ckeditor/jsdoc-plugins": "31.1.8",
68
- "@commitlint/config-conventional": "17.2.0",
69
- "@dwp/casa-spiderplan": "2.4.1",
70
- "@dwp/casa-spiderplan-a11y-plugin": "0.1.4",
73
+ "@ckeditor/jsdoc-plugins": "31.1.9",
74
+ "@commitlint/config-conventional": "17.3.0",
75
+ "@dwp/casa-spiderplan": "2.5.1",
76
+ "@dwp/casa-spiderplan-a11y-plugin": "0.1.5",
71
77
  "@dwp/casa-spiderplan-zap-plugin": "0.1.1",
72
78
  "@dwp/eslint-config-base": "6.0.0",
73
79
  "@types/express": "4.17.14",
74
80
  "@types/node": "18.11.9",
75
81
  "@types/nunjucks": "3.2.1",
76
- "babel-eslint": "10.1.0",
77
82
  "c8": "7.12.0",
78
- "chai": "4.3.6",
83
+ "chai": "4.3.7",
79
84
  "cheerio": "1.0.0-rc.12",
80
- "commitlint": "17.2.0",
81
- "docdash": "1.2.0",
82
- "eslint": "8.26.0",
85
+ "commitlint": "17.3.0",
86
+ "docdash": "2.0.0",
87
+ "eslint": "8.28.0",
83
88
  "eslint-plugin-no-unsafe-regex": "1.0.0",
84
89
  "eslint-plugin-security": "1.5.0",
85
90
  "eslint-plugin-sonarjs": "0.16.0",
86
91
  "fast-check": "3.3.0",
87
- "husky": "8.0.1",
88
92
  "jsdoc": "4.0.0",
89
93
  "jsdoc-tsimport-plugin": "1.0.5",
90
94
  "mocha": "10.1.0",
91
- "sass": "1.56.0",
92
- "sinon": "14.0.1",
95
+ "sass": "1.56.1",
96
+ "sinon": "14.0.2",
93
97
  "sinon-chai": "3.7.0",
94
- "standard-version": "9.5.0",
95
98
  "supertest": "6.3.1",
96
- "typescript": "4.8.4"
99
+ "typescript": "4.9.3"
97
100
  }
98
101
  }