From 1a72e333605329a91a4e2ef6563d8db7b2d1ea52 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Thu, 30 Dec 2021 12:13:05 +0000 Subject: [PATCH 1/4] chore(scripts): remove invalid license identifier from `lint:licenses` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 676bae37..7ca140d7 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "jest": "jest --detectOpenHandles --runInBand", "jest:coverage": "jest --coverage --runInBand", "lint": "eslint . --cache --ext js,jsx,ts,tsx --ignore-path .gitignore", - "lint:licenses": "license-checker --direct --onlyAllow=\"0BSD;Apache-2.0;Apache 2.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;Unlicense\" --production --summary", + "lint:licenses": "license-checker --direct --onlyAllow=\"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;MIT;Unlicense\" --production --summary", "lint:prettier": "prettier . --write --ignore-unknown", "lint:prettier:ci": "prettier . --check --ignore-unknown", "prepare": "husky install && rm -rf .git/hooks && ln -s ../.husky .git/hooks", From c58c62c7e52064ad565ef551a386e98f0663a435 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Thu, 30 Dec 2021 12:17:17 +0000 Subject: [PATCH 2/4] chore(server): update inline comment re helmet defaults --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index f4024c03..6a9fb8e5 100644 --- a/src/server.js +++ b/src/server.js @@ -55,7 +55,7 @@ async function plugin(server, config) { .addHook("onSend", server.rateLimit()) /* - * `x-xss-protection` and `content-security-policy` is set by default. + * `x-xss-protection` and `content-security-policy` is set by default by Helmet. * These are only useful for HTML/XML content; the only CSP directive that * is of use to other content is "frame-ancestors 'none'" to stop responses * from being wrapped in iframes and used for clickjacking attacks. From 47a9d66439b0ae1ca4f4532d654c410f02c83faf Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Fri, 31 Dec 2021 15:29:55 +0000 Subject: [PATCH 3/4] docs(contributing): add step for `lint:licenses` script --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 279211fb..bf426b41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,10 +50,11 @@ Titles and headings should adhere to the [Associated Press (AP)](https://www.aps Prior to submitting a pull request back to the main repository, please make sure you have completed the following steps: 1. Pull request base branch is set to `master`. All pull requests should be forked from and merged back to `master` -2. Run `npm test` to check the code adheres to the defined style and that it passes the Jest tests +2. Run `npm test` to check the code adheres to the defined ESLint style and that it passes the Jest tests 3. Run `npm run lint:prettier` to run the Prettier code formatter over the code +4. Run `npm run lint:licenses` if adding or updating production dependencies to check they use permissive licenses -Step 2. is automatically run by a pre-commit hook added by [Husky](https://typicode.github.io/husky/#/). +Steps 2. and 4. are automatically run by a pre-commit hook added by [Husky](https://typicode.github.io/husky/#/). ## Issues From 98e9064ac77940b259f416ea3a6f802f34824775 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Fri, 31 Dec 2021 17:26:05 +0000 Subject: [PATCH 4/4] chore: fix `server` jsdoc tag param type --- src/plugins/jwt-jwks-auth/index.js | 2 +- src/plugins/shared-schemas/index.js | 2 +- src/routes/admin/healthcheck/index.js | 2 +- src/routes/redirect/index.js | 2 +- src/server.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/jwt-jwks-auth/index.js b/src/plugins/jwt-jwks-auth/index.js index 4fe7c179..6e08e8a3 100644 --- a/src/plugins/jwt-jwks-auth/index.js +++ b/src/plugins/jwt-jwks-auth/index.js @@ -35,7 +35,7 @@ async function getSigningKey(token, jwksUri) { * @author Frazer Smith * @description Decorator plugin that adds `verifyJWT` function * to authenticate JWTs using JWKS endpoint. - * @param {Function} server - Fastify instance. + * @param {object} server - Fastify instance. * @param {object} options - Plugin config values. * @param {string} options.jwksEndpoint - URL of endpoint containing JWKS public keys. * @param {string|Array=} options.allowedAudiences - Accepted recipient(s) that JWT is intended for. diff --git a/src/plugins/shared-schemas/index.js b/src/plugins/shared-schemas/index.js index 9ca87073..1e5938f7 100644 --- a/src/plugins/shared-schemas/index.js +++ b/src/plugins/shared-schemas/index.js @@ -4,7 +4,7 @@ const S = require("fluent-json-schema"); /** * @author Frazer Smith * @description Plugin that adds collection of shared schemas for re-use throughout server. - * @param {Function} server - Fastify instance. + * @param {object} server - Fastify instance. */ async function plugin(server) { // Response schemas diff --git a/src/routes/admin/healthcheck/index.js b/src/routes/admin/healthcheck/index.js index 850f4fb7..1eb61fdd 100644 --- a/src/routes/admin/healthcheck/index.js +++ b/src/routes/admin/healthcheck/index.js @@ -8,7 +8,7 @@ const { healthcheckGetSchema } = require("./schema"); * @description Sets routing options for server for healthcheck endpoint. * This is used by monitoring software to poll and confirm the API is running, * so needs no authentication. - * @param {Function} server - Fastify instance. + * @param {object} server - Fastify instance. * @param {object} options - Route config values. * @param {object} options.cors - CORS settings. */ diff --git a/src/routes/redirect/index.js b/src/routes/redirect/index.js index db572383..fd098918 100644 --- a/src/routes/redirect/index.js +++ b/src/routes/redirect/index.js @@ -7,7 +7,7 @@ const { redirectGetSchema } = require("./schema"); /** * @author Frazer Smith * @description Sets routing options for server. - * @param {Function} server - Fastify instance. + * @param {object} server - Fastify instance. * @param {object} options - Route config values. * @param {object} options.cors - CORS settings. * @param {string} options.redirectUrl - URL and port the Mirth Connect FHIR/HTTP Listener channel is listening on. diff --git a/src/server.js b/src/server.js index 6a9fb8e5..f22348f4 100644 --- a/src/server.js +++ b/src/server.js @@ -18,7 +18,7 @@ const sharedSchemas = require("./plugins/shared-schemas"); /** * @author Frazer Smith * @description Build Fastify instance. - * @param {Function} server - Fastify instance. + * @param {object} server - Fastify instance. * @param {object} config - Fastify configuration values. */ async function plugin(server, config) {