From 768983a519ac62487d4cc7e73ac99afc8143d4ea Mon Sep 17 00:00:00 2001 From: Onur Eren Hanife Date: Tue, 2 Jan 2024 13:56:43 +0300 Subject: [PATCH 1/3] #8842 Auth providers disabled by default --- DEPRECATIONS.md | 2 +- spec/AuthenticationAdapters.spec.js | 14 -------------- src/Auth.js | 7 ------- src/Options/Definitions.js | 4 ++-- src/Options/docs.js | 2 +- src/Options/index.js | 4 ++-- 6 files changed, 6 insertions(+), 27 deletions(-) diff --git a/DEPRECATIONS.md b/DEPRECATIONS.md index b825e50b2f..713bedb35f 100644 --- a/DEPRECATIONS.md +++ b/DEPRECATIONS.md @@ -9,7 +9,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h | DEPPS3 | Config option `enforcePrivateUsers` defaults to `true` | [#7319](https://github.com/parse-community/parse-server/pull/7319) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - | | DEPPS4 | Remove convenience method for http request `Parse.Cloud.httpRequest` | [#7589](https://github.com/parse-community/parse-server/pull/7589) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - | | DEPPS5 | Config option `allowClientClassCreation` defaults to `false` | [#7925](https://github.com/parse-community/parse-server/pull/7925) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - | -| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - | +| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - | | DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - | | DEPPS8 | Login with expired 3rd party authentication token defaults to `false` | [#7079](https://github.com/parse-community/parse-server/pull/7079) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - | | DEPPS9 | Rename LiveQuery `fields` option to `keys` | [#8389](https://github.com/parse-community/parse-server/issues/8389) | 6.0.0 (2023) | 7.0.0 (2024) | deprecated | - | diff --git a/spec/AuthenticationAdapters.spec.js b/spec/AuthenticationAdapters.spec.js index dee82fdc58..c6834dcf45 100644 --- a/spec/AuthenticationAdapters.spec.js +++ b/spec/AuthenticationAdapters.spec.js @@ -589,20 +589,6 @@ describe('AuthenticationProviders', function () { new Parse.Error(Parse.Error.UNSUPPORTED_SERVICE, 'This authentication method is unsupported.') ); }); - - it('can deprecate', async () => { - await reconfigureServer(); - const Deprecator = require('../lib/Deprecator/Deprecator'); - const spy = spyOn(Deprecator, 'logRuntimeDeprecation').and.callFake(() => {}); - const provider = getMockMyOauthProvider(); - Parse.User._registerAuthenticationProvider(provider); - await Parse.User._logInWith('myoauth'); - expect(spy).toHaveBeenCalledWith({ - usage: 'Using the authentication adapter "myoauth" without explicitly enabling it', - solution: - 'Enable the authentication adapter by setting the Parse Server option "auth.myoauth.enabled: true".', - }); - }); }); describe('instagram auth adapter', () => { diff --git a/src/Auth.js b/src/Auth.js index 6488b8427e..f21ba96c6c 100644 --- a/src/Auth.js +++ b/src/Auth.js @@ -1,7 +1,6 @@ const Parse = require('parse/node'); import { isDeepStrictEqual } from 'util'; import { getRequestObject, resolveError } from './triggers'; -import Deprecator from './Deprecator/Deprecator'; import { logger } from './logger'; import RestQuery from './RestQuery'; import RestWrite from './RestWrite'; @@ -523,12 +522,6 @@ const handleAuthDataValidation = async (authData, req, foundUser) => { } const { validator } = req.config.authDataManager.getValidatorForProvider(provider); const authProvider = (req.config.auth || {})[provider] || {}; - if (authProvider.enabled == null) { - Deprecator.logRuntimeDeprecation({ - usage: `Using the authentication adapter "${provider}" without explicitly enabling it`, - solution: `Enable the authentication adapter by setting the Parse Server option "auth.${provider}.enabled: true".`, - }); - } if (!validator || authProvider.enabled === false) { throw new Parse.Error( Parse.Error.UNSUPPORTED_SERVICE, diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index 35da35bb5f..b3f10772c0 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -1044,9 +1044,9 @@ module.exports.DatabaseOptions = { }; module.exports.AuthAdapter = { enabled: { - help: 'Is `true` if the auth adapter is enabled, `false` otherwise.', + help: 'Is `false` by default.', action: parsers.booleanParser, - default: true, + default: false, }, }; module.exports.LogLevels = { diff --git a/src/Options/docs.js b/src/Options/docs.js index 643123c253..e251e250ec 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -240,7 +240,7 @@ /** * @interface AuthAdapter - * @property {Boolean} enabled Is `true` if the auth adapter is enabled, `false` otherwise. + * @property {Boolean} enabled Is `false` by default. */ /** diff --git a/src/Options/index.js b/src/Options/index.js index cfda946a05..03e288712f 100644 --- a/src/Options/index.js +++ b/src/Options/index.js @@ -599,8 +599,8 @@ export interface DatabaseOptions { } export interface AuthAdapter { - /* Is `true` if the auth adapter is enabled, `false` otherwise. - :DEFAULT: true + /* Is `false` by default. + :DEFAULT: false :ENV: */ enabled: ?boolean; From bbbe5f585bd30155ead704f441d315621d02a62a Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:10:12 +0100 Subject: [PATCH 2/3] Update index.js --- src/Options/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Options/index.js b/src/Options/index.js index 03e288712f..9d1fc480a1 100644 --- a/src/Options/index.js +++ b/src/Options/index.js @@ -599,7 +599,7 @@ export interface DatabaseOptions { } export interface AuthAdapter { - /* Is `false` by default. + /* Is `true` if the auth adapter is enabled, `false` otherwise. :DEFAULT: false :ENV: */ From 5591fdfb06f90cdf7e43c80f96342d0f0ca2ab75 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:10:24 +0100 Subject: [PATCH 3/3] update defs --- src/Options/Definitions.js | 2 +- src/Options/docs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index ed9cc710b3..f4c9619633 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -1044,7 +1044,7 @@ module.exports.DatabaseOptions = { }; module.exports.AuthAdapter = { enabled: { - help: 'Is `false` by default.', + help: 'Is `true` if the auth adapter is enabled, `false` otherwise.', action: parsers.booleanParser, default: false, }, diff --git a/src/Options/docs.js b/src/Options/docs.js index ad858ffed9..2938662949 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -240,7 +240,7 @@ /** * @interface AuthAdapter - * @property {Boolean} enabled Is `false` by default. + * @property {Boolean} enabled Is `true` if the auth adapter is enabled, `false` otherwise. */ /**