From ebf14cbe5cf731dfc5efb04855c2646c765f1abf Mon Sep 17 00:00:00 2001 From: roschaefer Date: Wed, 4 Sep 2019 11:19:18 +0200 Subject: [PATCH 1/5] Encode the bearer token instead of hard-coding it That should fix our build server. --- .../src/schema/resolvers/user_management.spec.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/backend/src/schema/resolvers/user_management.spec.js b/backend/src/schema/resolvers/user_management.spec.js index ad088d4aa..4fe21f92a 100644 --- a/backend/src/schema/resolvers/user_management.spec.js +++ b/backend/src/schema/resolvers/user_management.spec.js @@ -4,6 +4,7 @@ import Factory from '../../seed/factories' import { gql } from '../../jest/helpers' import { createTestClient } from 'apollo-server-testing' import createServer, { context } from '../../server' +import encode from '../../jwt/encode' const factory = Factory() let query @@ -12,16 +13,9 @@ let variables let req let user -// This is a bearer token of a user with id `u3`: -const userBearerToken = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsIm5hbWUiOiJKZW5ueSBSb3N0b2NrIiwiZGlzYWJsZWQiOmZhbHNlLCJhdmF0YXIiOiJodHRwczovL3MzLmFtYXpvbmF3cy5jb20vdWlmYWNlcy9mYWNlcy90d2l0dGVyL2tleXVyaTg1LzEyOC5qcGciLCJpZCI6InUzIiwiZW1haWwiOiJ1c2VyQGV4YW1wbGUub3JnIiwic2x1ZyI6Implbm55LXJvc3RvY2siLCJpYXQiOjE1Njc0NjgyMDIsImV4cCI6MTU2NzU1NDYwMiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDozMDAwIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo0MDAwIiwic3ViIjoidTMifQ.RkmrdJDL1kIqGnMWUBl_sJJ4grzfpTEGdT6doMsbLW8' - -// This is a bearer token of a user with id `u2`: -const moderatorBearerToken = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoibW9kZXJhdG9yIiwibmFtZSI6IkJvYiBkZXIgQmF1bWVpc3RlciIsImRpc2FibGVkIjpmYWxzZSwiYXZhdGFyIjoiaHR0cHM6Ly9zMy5hbWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci9hbmRyZXdvZmZpY2VyLzEyOC5qcGciLCJpZCI6InUyIiwiZW1haWwiOiJtb2RlcmF0b3JAZXhhbXBsZS5vcmciLCJzbHVnIjoiYm9iLWRlci1iYXVtZWlzdGVyIiwiaWF0IjoxNTY3NDY4MDUwLCJleHAiOjE1Njc1NTQ0NTAsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMCIsInN1YiI6InUyIn0.LdVFPKqIcoY0a7_kFZSTgnc8NzmZD7CrR3vkWLSqedM' - const disable = async id => { await factory.create('User', { id: 'u2', role: 'moderator' }) + const moderatorBearerToken = encode({ id: 'u2' }) req = { headers: { authorization: `Bearer ${moderatorBearerToken}` } } await mutate({ mutation: gql` @@ -74,6 +68,7 @@ describe('isLoggedIn', () => { describe('authenticated', () => { beforeEach(async () => { user = await factory.create('User', { id: 'u3' }) + const userBearerToken = encode({ id: 'u3' }) req = { headers: { authorization: `Bearer ${userBearerToken}` } } }) @@ -139,6 +134,7 @@ describe('currentUser', () => { slug: 'matilde-hermiston', role: 'user', }) + const userBearerToken = encode({ id: 'u3' }) req = { headers: { authorization: `Bearer ${userBearerToken}` } } }) @@ -276,6 +272,7 @@ describe('change password', () => { describe('authenticated', () => { beforeEach(async () => { await factory.create('User', { id: 'u3' }) + const userBearerToken = encode({ id: 'u3' }) req = { headers: { authorization: `Bearer ${userBearerToken}` } } }) describe('old password === new password', () => { From 628f66f2900c39f0fe3666ec60fd18de723ab910 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 09:53:37 +0000 Subject: [PATCH 2/5] Bump eslint-config-prettier from 6.1.0 to 6.2.0 in /backend Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.1.0...v6.2.0) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 8555e4196..eb5d2525f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -116,7 +116,7 @@ "chai": "~4.2.0", "cucumber": "~5.1.0", "eslint": "~6.3.0", - "eslint-config-prettier": "~6.1.0", + "eslint-config-prettier": "~6.2.0", "eslint-config-standard": "~14.1.0", "eslint-plugin-import": "~2.18.2", "eslint-plugin-jest": "~22.16.0", diff --git a/backend/yarn.lock b/backend/yarn.lock index 526d40eb1..6936f9ba7 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -3283,10 +3283,10 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-config-prettier@~6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.1.0.tgz#e6f678ba367fbd1273998d5510f76f004e9dce7b" - integrity sha512-k9fny9sPjIBQ2ftFTesJV21Rg4R/7a7t7LCtZVrYQiHEp8Nnuk3EGaDmsKSAnsPj0BYcgB2zxzHa2NTkIxcOLg== +eslint-config-prettier@~6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.2.0.tgz#80e0b8714e3f6868c4ac2a25fbf39c02e73527a7" + integrity sha512-VLsgK/D+S/FEsda7Um1+N8FThec6LqE3vhcMyp8mlmto97y3fGf3DX7byJexGuOb1QY0Z/zz222U5t+xSfcZDQ== dependencies: get-stdin "^6.0.0" From 4decb2c60a684ee9997fd664596ecaa3fc154aea Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 09:53:48 +0000 Subject: [PATCH 3/5] Bump eslint-config-prettier from 6.1.0 to 6.2.0 in /webapp Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.1.0...v6.2.0) Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index 1ab34fa04..e12e5fe73 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -102,7 +102,7 @@ "core-js": "~2.6.9", "css-loader": "~3.2.0", "eslint": "~5.16.0", - "eslint-config-prettier": "~6.1.0", + "eslint-config-prettier": "~6.2.0", "eslint-config-standard": "~12.0.0", "eslint-loader": "~3.0.0", "eslint-plugin-import": "~2.18.2", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 833e02991..5a37786f1 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -6340,10 +6340,10 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-config-prettier@^6.0.0, eslint-config-prettier@~6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.1.0.tgz#e6f678ba367fbd1273998d5510f76f004e9dce7b" - integrity sha512-k9fny9sPjIBQ2ftFTesJV21Rg4R/7a7t7LCtZVrYQiHEp8Nnuk3EGaDmsKSAnsPj0BYcgB2zxzHa2NTkIxcOLg== +eslint-config-prettier@^6.0.0, eslint-config-prettier@~6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.2.0.tgz#80e0b8714e3f6868c4ac2a25fbf39c02e73527a7" + integrity sha512-VLsgK/D+S/FEsda7Um1+N8FThec6LqE3vhcMyp8mlmto97y3fGf3DX7byJexGuOb1QY0Z/zz222U5t+xSfcZDQ== dependencies: get-stdin "^6.0.0" From a175bb0f71495cae28008f6820191002d33487e1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 09:54:17 +0000 Subject: [PATCH 4/5] Bump nodemon from 1.19.1 to 1.19.2 in /backend Bumps [nodemon](https://github.com/remy/nodemon) from 1.19.1 to 1.19.2. - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v1.19.1...v1.19.2) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 8555e4196..8ef8576f2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -126,7 +126,7 @@ "eslint-plugin-standard": "~4.0.1", "graphql-request": "~1.8.2", "jest": "~24.9.0", - "nodemon": "~1.19.1", + "nodemon": "~1.19.2", "prettier": "~1.18.2", "supertest": "~4.0.2" } diff --git a/backend/yarn.lock b/backend/yarn.lock index 526d40eb1..89eb2a796 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -6300,10 +6300,10 @@ nodemailer@^6.3.0: resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.3.0.tgz#a89b0c62d3937bdcdeecbf55687bd7911b627e12" integrity sha512-TEHBNBPHv7Ie/0o3HXnb7xrPSSQmH1dXwQKRaMKDBGt/ZN54lvDVujP6hKkO/vjkIYL9rK8kHSG11+G42Nhxuw== -nodemon@~1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.1.tgz#576f0aad0f863aabf8c48517f6192ff987cd5071" - integrity sha512-/DXLzd/GhiaDXXbGId5BzxP1GlsqtMGM9zTmkWrgXtSqjKmGSbLicM/oAy4FR0YWm14jCHRwnR31AHS2dYFHrg== +nodemon@~1.19.2: + version "1.19.2" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.2.tgz#b0975147dc99b3761ceb595b3f9277084931dcc0" + integrity sha512-hRLYaw5Ihyw9zK7NF+9EUzVyS6Cvgc14yh8CAYr38tPxJa6UrOxwAQ351GwrgoanHCF0FalQFn6w5eoX/LGdJw== dependencies: chokidar "^2.1.5" debug "^3.1.0" From 58d2a8e996f64661822ea43771176f13a1337378 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 09:54:56 +0000 Subject: [PATCH 5/5] Bump nodemon from 1.19.1 to 1.19.2 in /webapp Bumps [nodemon](https://github.com/remy/nodemon) from 1.19.1 to 1.19.2. - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v1.19.1...v1.19.2) Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 29 +++++------------------------ 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index 1ab34fa04..198304cb6 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -117,7 +117,7 @@ "jest": "~24.9.0", "mutation-observer": "^1.0.3", "node-sass": "~4.12.0", - "nodemon": "~1.19.1", + "nodemon": "~1.19.2", "prettier": "~1.18.2", "sass-loader": "~8.0.0", "style-loader": "~0.23.1", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 833e02991..21ef4a1fe 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -4660,26 +4660,7 @@ cheerio@^1.0.0-rc.2: lodash "^4.15.0" parse5 "^3.0.1" -chokidar@^2.0.2, chokidar@^2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.5.tgz#0ae8434d962281a5f56c72869e79cb6d9d86ad4d" - integrity sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A== - dependencies: - anymatch "^2.0.0" - async-each "^1.0.1" - braces "^2.3.2" - glob-parent "^3.1.0" - inherits "^2.0.3" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - normalize-path "^3.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.2.1" - upath "^1.1.1" - optionalDependencies: - fsevents "^1.2.7" - -chokidar@^2.0.4: +chokidar@^2.0.2, chokidar@^2.0.4, chokidar@^2.1.5: version "2.1.6" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== @@ -10570,10 +10551,10 @@ node-sass@^4.12.0, node-sass@~4.12.0: stdout-stream "^1.4.0" "true-case-path" "^1.0.2" -nodemon@^1.19.1, nodemon@~1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.1.tgz#576f0aad0f863aabf8c48517f6192ff987cd5071" - integrity sha512-/DXLzd/GhiaDXXbGId5BzxP1GlsqtMGM9zTmkWrgXtSqjKmGSbLicM/oAy4FR0YWm14jCHRwnR31AHS2dYFHrg== +nodemon@^1.19.1, nodemon@~1.19.2: + version "1.19.2" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.2.tgz#b0975147dc99b3761ceb595b3f9277084931dcc0" + integrity sha512-hRLYaw5Ihyw9zK7NF+9EUzVyS6Cvgc14yh8CAYr38tPxJa6UrOxwAQ351GwrgoanHCF0FalQFn6w5eoX/LGdJw== dependencies: chokidar "^2.1.5" debug "^3.1.0"