RestWrite.js 218 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _RestQuery = _interopRequireDefault(require("./RestQuery"));
  7. var _lodash = _interopRequireDefault(require("lodash"));
  8. var _logger = _interopRequireDefault(require("./logger"));
  9. var _SchemaController = require("./Controllers/SchemaController");
  10. function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
  11. function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
  12. function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
  13. function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
  14. function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
  15. function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
  16. // A RestWrite encapsulates everything we need to run an operation
  17. // that writes to the database.
  18. // This could be either a "create" or an "update".
  19. var SchemaController = require('./Controllers/SchemaController');
  20. var deepcopy = require('deepcopy');
  21. const Auth = require('./Auth');
  22. const Utils = require('./Utils');
  23. var cryptoUtils = require('./cryptoUtils');
  24. var passwordCrypto = require('./password');
  25. var Parse = require('parse/node');
  26. var triggers = require('./triggers');
  27. var ClientSDK = require('./ClientSDK');
  28. const util = require('util');
  29. // query and data are both provided in REST API format. So data
  30. // types are encoded by plain old objects.
  31. // If query is null, this is a "create" and the data in data should be
  32. // created.
  33. // Otherwise this is an "update" - the object matching the query
  34. // should get updated with data.
  35. // RestWrite will handle objectId, createdAt, and updatedAt for
  36. // everything. It also knows to use triggers and special modifications
  37. // for the _User class.
  38. function RestWrite(config, auth, className, query, data, originalData, clientSDK, context, action) {
  39. if (auth.isReadOnly) {
  40. throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'Cannot perform a write operation when using readOnlyMasterKey');
  41. }
  42. this.config = config;
  43. this.auth = auth;
  44. this.className = className;
  45. this.clientSDK = clientSDK;
  46. this.storage = {};
  47. this.runOptions = {};
  48. this.context = context || {};
  49. if (action) {
  50. this.runOptions.action = action;
  51. }
  52. if (!query) {
  53. if (this.config.allowCustomObjectId) {
  54. if (Object.prototype.hasOwnProperty.call(data, 'objectId') && !data.objectId) {
  55. throw new Parse.Error(Parse.Error.MISSING_OBJECT_ID, 'objectId must not be empty, null or undefined');
  56. }
  57. } else {
  58. if (data.objectId) {
  59. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, 'objectId is an invalid field name.');
  60. }
  61. if (data.id) {
  62. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, 'id is an invalid field name.');
  63. }
  64. }
  65. }
  66. // When the operation is complete, this.response may have several
  67. // fields.
  68. // response: the actual data to be returned
  69. // status: the http status code. if not present, treated like a 200
  70. // location: the location header. if not present, no location header
  71. this.response = null;
  72. // Processing this operation may mutate our data, so we operate on a
  73. // copy
  74. this.query = deepcopy(query);
  75. this.data = deepcopy(data);
  76. // We never change originalData, so we do not need a deep copy
  77. this.originalData = originalData;
  78. // The timestamp we'll use for this whole operation
  79. this.updatedAt = Parse._encode(new Date()).iso;
  80. // Shared SchemaController to be reused to reduce the number of loadSchema() calls per request
  81. // Once set the schemaData should be immutable
  82. this.validSchemaController = null;
  83. this.pendingOps = {
  84. operations: null,
  85. identifier: null
  86. };
  87. }
  88. // A convenient method to perform all the steps of processing the
  89. // write, in order.
  90. // Returns a promise for a {response, status, location} object.
  91. // status and location are optional.
  92. RestWrite.prototype.execute = function () {
  93. return Promise.resolve().then(() => {
  94. return this.getUserAndRoleACL();
  95. }).then(() => {
  96. return this.validateClientClassCreation();
  97. }).then(() => {
  98. return this.handleInstallation();
  99. }).then(() => {
  100. return this.handleSession();
  101. }).then(() => {
  102. return this.validateAuthData();
  103. }).then(() => {
  104. return this.checkRestrictedFields();
  105. }).then(() => {
  106. return this.runBeforeSaveTrigger();
  107. }).then(() => {
  108. return this.ensureUniqueAuthDataId();
  109. }).then(() => {
  110. return this.deleteEmailResetTokenIfNeeded();
  111. }).then(() => {
  112. return this.validateSchema();
  113. }).then(schemaController => {
  114. this.validSchemaController = schemaController;
  115. return this.setRequiredFieldsIfNeeded();
  116. }).then(() => {
  117. return this.transformUser();
  118. }).then(() => {
  119. return this.expandFilesForExistingObjects();
  120. }).then(() => {
  121. return this.destroyDuplicatedSessions();
  122. }).then(() => {
  123. return this.runDatabaseOperation();
  124. }).then(() => {
  125. return this.createSessionTokenIfNeeded();
  126. }).then(() => {
  127. return this.handleFollowup();
  128. }).then(() => {
  129. return this.runAfterSaveTrigger();
  130. }).then(() => {
  131. return this.cleanUserAuthData();
  132. }).then(() => {
  133. // Append the authDataResponse if exists
  134. if (this.authDataResponse) {
  135. if (this.response && this.response.response) {
  136. this.response.response.authDataResponse = this.authDataResponse;
  137. }
  138. }
  139. if (this.storage.rejectSignup && this.config.preventSignupWithUnverifiedEmail) {
  140. throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND, 'User email is not verified.');
  141. }
  142. return this.response;
  143. });
  144. };
  145. // Uses the Auth object to get the list of roles, adds the user id
  146. RestWrite.prototype.getUserAndRoleACL = function () {
  147. if (this.auth.isMaster || this.auth.isMaintenance) {
  148. return Promise.resolve();
  149. }
  150. this.runOptions.acl = ['*'];
  151. if (this.auth.user) {
  152. return this.auth.getUserRoles().then(roles => {
  153. this.runOptions.acl = this.runOptions.acl.concat(roles, [this.auth.user.id]);
  154. return;
  155. });
  156. } else {
  157. return Promise.resolve();
  158. }
  159. };
  160. // Validates this operation against the allowClientClassCreation config.
  161. RestWrite.prototype.validateClientClassCreation = function () {
  162. if (this.config.allowClientClassCreation === false && !this.auth.isMaster && !this.auth.isMaintenance && SchemaController.systemClasses.indexOf(this.className) === -1) {
  163. return this.config.database.loadSchema().then(schemaController => schemaController.hasClass(this.className)).then(hasClass => {
  164. if (hasClass !== true) {
  165. throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'This user is not allowed to access ' + 'non-existent class: ' + this.className);
  166. }
  167. });
  168. } else {
  169. return Promise.resolve();
  170. }
  171. };
  172. // Validates this operation against the schema.
  173. RestWrite.prototype.validateSchema = function () {
  174. return this.config.database.validateObject(this.className, this.data, this.query, this.runOptions, this.auth.isMaintenance);
  175. };
  176. // Runs any beforeSave triggers against this operation.
  177. // Any change leads to our data being mutated.
  178. RestWrite.prototype.runBeforeSaveTrigger = function () {
  179. if (this.response || this.runOptions.many) {
  180. return;
  181. }
  182. // Avoid doing any setup for triggers if there is no 'beforeSave' trigger for this class.
  183. if (!triggers.triggerExists(this.className, triggers.Types.beforeSave, this.config.applicationId)) {
  184. return Promise.resolve();
  185. }
  186. const {
  187. originalObject,
  188. updatedObject
  189. } = this.buildParseObjects();
  190. const identifier = updatedObject._getStateIdentifier();
  191. const stateController = Parse.CoreManager.getObjectStateController();
  192. const [pending] = stateController.getPendingOps(identifier);
  193. this.pendingOps = {
  194. operations: _objectSpread({}, pending),
  195. identifier
  196. };
  197. return Promise.resolve().then(() => {
  198. // Before calling the trigger, validate the permissions for the save operation
  199. let databasePromise = null;
  200. if (this.query) {
  201. // Validate for updating
  202. databasePromise = this.config.database.update(this.className, this.query, this.data, this.runOptions, true, true);
  203. } else {
  204. // Validate for creating
  205. databasePromise = this.config.database.create(this.className, this.data, this.runOptions, true);
  206. }
  207. // In the case that there is no permission for the operation, it throws an error
  208. return databasePromise.then(result => {
  209. if (!result || result.length <= 0) {
  210. throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.');
  211. }
  212. });
  213. }).then(() => {
  214. return triggers.maybeRunTrigger(triggers.Types.beforeSave, this.auth, updatedObject, originalObject, this.config, this.context);
  215. }).then(response => {
  216. if (response && response.object) {
  217. this.storage.fieldsChangedByTrigger = _lodash.default.reduce(response.object, (result, value, key) => {
  218. if (!_lodash.default.isEqual(this.data[key], value)) {
  219. result.push(key);
  220. }
  221. return result;
  222. }, []);
  223. this.data = response.object;
  224. // We should delete the objectId for an update write
  225. if (this.query && this.query.objectId) {
  226. delete this.data.objectId;
  227. }
  228. }
  229. try {
  230. Utils.checkProhibitedKeywords(this.config, this.data);
  231. } catch (error) {
  232. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, error);
  233. }
  234. });
  235. };
  236. RestWrite.prototype.runBeforeLoginTrigger = async function (userData) {
  237. // Avoid doing any setup for triggers if there is no 'beforeLogin' trigger
  238. if (!triggers.triggerExists(this.className, triggers.Types.beforeLogin, this.config.applicationId)) {
  239. return;
  240. }
  241. // Cloud code gets a bit of extra data for its objects
  242. const extraData = {
  243. className: this.className
  244. };
  245. // Expand file objects
  246. await this.config.filesController.expandFilesInObject(this.config, userData);
  247. const user = triggers.inflate(extraData, userData);
  248. // no need to return a response
  249. await triggers.maybeRunTrigger(triggers.Types.beforeLogin, this.auth, user, null, this.config, this.context);
  250. };
  251. RestWrite.prototype.setRequiredFieldsIfNeeded = function () {
  252. if (this.data) {
  253. return this.validSchemaController.getAllClasses().then(allClasses => {
  254. const schema = allClasses.find(oneClass => oneClass.className === this.className);
  255. const setRequiredFieldIfNeeded = (fieldName, setDefault) => {
  256. if (this.data[fieldName] === undefined || this.data[fieldName] === null || this.data[fieldName] === '' || typeof this.data[fieldName] === 'object' && this.data[fieldName].__op === 'Delete') {
  257. if (setDefault && schema.fields[fieldName] && schema.fields[fieldName].defaultValue !== null && schema.fields[fieldName].defaultValue !== undefined && (this.data[fieldName] === undefined || typeof this.data[fieldName] === 'object' && this.data[fieldName].__op === 'Delete')) {
  258. this.data[fieldName] = schema.fields[fieldName].defaultValue;
  259. this.storage.fieldsChangedByTrigger = this.storage.fieldsChangedByTrigger || [];
  260. if (this.storage.fieldsChangedByTrigger.indexOf(fieldName) < 0) {
  261. this.storage.fieldsChangedByTrigger.push(fieldName);
  262. }
  263. } else if (schema.fields[fieldName] && schema.fields[fieldName].required === true) {
  264. throw new Parse.Error(Parse.Error.VALIDATION_ERROR, `${fieldName} is required`);
  265. }
  266. }
  267. };
  268. // Add default fields
  269. if (!this.query) {
  270. // allow customizing createdAt and updatedAt when using maintenance key
  271. if (this.auth.isMaintenance && this.data.createdAt && this.data.createdAt.__type === 'Date') {
  272. this.data.createdAt = this.data.createdAt.iso;
  273. if (this.data.updatedAt && this.data.updatedAt.__type === 'Date') {
  274. const createdAt = new Date(this.data.createdAt);
  275. const updatedAt = new Date(this.data.updatedAt.iso);
  276. if (updatedAt < createdAt) {
  277. throw new Parse.Error(Parse.Error.VALIDATION_ERROR, 'updatedAt cannot occur before createdAt');
  278. }
  279. this.data.updatedAt = this.data.updatedAt.iso;
  280. }
  281. // if no updatedAt is provided, set it to createdAt to match default behavior
  282. else {
  283. this.data.updatedAt = this.data.createdAt;
  284. }
  285. } else {
  286. this.data.updatedAt = this.updatedAt;
  287. this.data.createdAt = this.updatedAt;
  288. }
  289. // Only assign new objectId if we are creating new object
  290. if (!this.data.objectId) {
  291. this.data.objectId = cryptoUtils.newObjectId(this.config.objectIdSize);
  292. }
  293. if (schema) {
  294. Object.keys(schema.fields).forEach(fieldName => {
  295. setRequiredFieldIfNeeded(fieldName, true);
  296. });
  297. }
  298. } else if (schema) {
  299. this.data.updatedAt = this.updatedAt;
  300. Object.keys(this.data).forEach(fieldName => {
  301. setRequiredFieldIfNeeded(fieldName, false);
  302. });
  303. }
  304. });
  305. }
  306. return Promise.resolve();
  307. };
  308. // Transforms auth data for a user object.
  309. // Does nothing if this isn't a user object.
  310. // Returns a promise for when we're done if it can't finish this tick.
  311. RestWrite.prototype.validateAuthData = function () {
  312. if (this.className !== '_User') {
  313. return;
  314. }
  315. const authData = this.data.authData;
  316. const hasUsernameAndPassword = typeof this.data.username === 'string' && typeof this.data.password === 'string';
  317. if (!this.query && !authData) {
  318. if (typeof this.data.username !== 'string' || _lodash.default.isEmpty(this.data.username)) {
  319. throw new Parse.Error(Parse.Error.USERNAME_MISSING, 'bad or missing username');
  320. }
  321. if (typeof this.data.password !== 'string' || _lodash.default.isEmpty(this.data.password)) {
  322. throw new Parse.Error(Parse.Error.PASSWORD_MISSING, 'password is required');
  323. }
  324. }
  325. if (authData && !Object.keys(authData).length || !Object.prototype.hasOwnProperty.call(this.data, 'authData')) {
  326. // Nothing to validate here
  327. return;
  328. } else if (Object.prototype.hasOwnProperty.call(this.data, 'authData') && !this.data.authData) {
  329. // Handle saving authData to null
  330. throw new Parse.Error(Parse.Error.UNSUPPORTED_SERVICE, 'This authentication method is unsupported.');
  331. }
  332. var providers = Object.keys(authData);
  333. if (providers.length > 0) {
  334. const canHandleAuthData = providers.some(provider => {
  335. var providerAuthData = authData[provider];
  336. var hasToken = providerAuthData && providerAuthData.id;
  337. return hasToken || providerAuthData === null;
  338. });
  339. if (canHandleAuthData || hasUsernameAndPassword || this.auth.isMaster || this.getUserId()) {
  340. return this.handleAuthData(authData);
  341. }
  342. }
  343. throw new Parse.Error(Parse.Error.UNSUPPORTED_SERVICE, 'This authentication method is unsupported.');
  344. };
  345. RestWrite.prototype.filteredObjectsByACL = function (objects) {
  346. if (this.auth.isMaster || this.auth.isMaintenance) {
  347. return objects;
  348. }
  349. return objects.filter(object => {
  350. if (!object.ACL) {
  351. return true; // legacy users that have no ACL field on them
  352. }
  353. // Regular users that have been locked out.
  354. return object.ACL && Object.keys(object.ACL).length > 0;
  355. });
  356. };
  357. RestWrite.prototype.getUserId = function () {
  358. if (this.query && this.query.objectId && this.className === '_User') {
  359. return this.query.objectId;
  360. } else if (this.auth && this.auth.user && this.auth.user.id) {
  361. return this.auth.user.id;
  362. }
  363. };
  364. // Developers are allowed to change authData via before save trigger
  365. // we need after before save to ensure that the developer
  366. // is not currently duplicating auth data ID
  367. RestWrite.prototype.ensureUniqueAuthDataId = async function () {
  368. if (this.className !== '_User' || !this.data.authData) {
  369. return;
  370. }
  371. const hasAuthDataId = Object.keys(this.data.authData).some(key => this.data.authData[key] && this.data.authData[key].id);
  372. if (!hasAuthDataId) return;
  373. const r = await Auth.findUsersWithAuthData(this.config, this.data.authData);
  374. const results = this.filteredObjectsByACL(r);
  375. if (results.length > 1) {
  376. throw new Parse.Error(Parse.Error.ACCOUNT_ALREADY_LINKED, 'this auth is already used');
  377. }
  378. // use data.objectId in case of login time and found user during handle validateAuthData
  379. const userId = this.getUserId() || this.data.objectId;
  380. if (results.length === 1 && userId !== results[0].objectId) {
  381. throw new Parse.Error(Parse.Error.ACCOUNT_ALREADY_LINKED, 'this auth is already used');
  382. }
  383. };
  384. RestWrite.prototype.handleAuthData = async function (authData) {
  385. const r = await Auth.findUsersWithAuthData(this.config, authData);
  386. const results = this.filteredObjectsByACL(r);
  387. const userId = this.getUserId();
  388. const userResult = results[0];
  389. const foundUserIsNotCurrentUser = userId && userResult && userId !== userResult.objectId;
  390. if (results.length > 1 || foundUserIsNotCurrentUser) {
  391. // To avoid https://github.com/parse-community/parse-server/security/advisories/GHSA-8w3j-g983-8jh5
  392. // Let's run some validation before throwing
  393. await Auth.handleAuthDataValidation(authData, this, userResult);
  394. throw new Parse.Error(Parse.Error.ACCOUNT_ALREADY_LINKED, 'this auth is already used');
  395. }
  396. // No user found with provided authData we need to validate
  397. if (!results.length) {
  398. const {
  399. authData: validatedAuthData,
  400. authDataResponse
  401. } = await Auth.handleAuthDataValidation(authData, this);
  402. this.authDataResponse = authDataResponse;
  403. // Replace current authData by the new validated one
  404. this.data.authData = validatedAuthData;
  405. return;
  406. }
  407. // User found with provided authData
  408. if (results.length === 1) {
  409. this.storage.authProvider = Object.keys(authData).join(',');
  410. const {
  411. hasMutatedAuthData,
  412. mutatedAuthData
  413. } = Auth.hasMutatedAuthData(authData, userResult.authData);
  414. const isCurrentUserLoggedOrMaster = this.auth && this.auth.user && this.auth.user.id === userResult.objectId || this.auth.isMaster;
  415. const isLogin = !userId;
  416. if (isLogin || isCurrentUserLoggedOrMaster) {
  417. // no user making the call
  418. // OR the user making the call is the right one
  419. // Login with auth data
  420. delete results[0].password;
  421. // need to set the objectId first otherwise location has trailing undefined
  422. this.data.objectId = userResult.objectId;
  423. if (!this.query || !this.query.objectId) {
  424. this.response = {
  425. response: userResult,
  426. location: this.location()
  427. };
  428. // Run beforeLogin hook before storing any updates
  429. // to authData on the db; changes to userResult
  430. // will be ignored.
  431. await this.runBeforeLoginTrigger(deepcopy(userResult));
  432. // If we are in login operation via authData
  433. // we need to be sure that the user has provided
  434. // required authData
  435. Auth.checkIfUserHasProvidedConfiguredProvidersForLogin({
  436. config: this.config,
  437. auth: this.auth
  438. }, authData, userResult.authData, this.config);
  439. }
  440. // Prevent validating if no mutated data detected on update
  441. if (!hasMutatedAuthData && isCurrentUserLoggedOrMaster) {
  442. return;
  443. }
  444. // Force to validate all provided authData on login
  445. // on update only validate mutated ones
  446. if (hasMutatedAuthData || !this.config.allowExpiredAuthDataToken) {
  447. const res = await Auth.handleAuthDataValidation(isLogin ? authData : mutatedAuthData, this, userResult);
  448. this.data.authData = res.authData;
  449. this.authDataResponse = res.authDataResponse;
  450. }
  451. // IF we are in login we'll skip the database operation / beforeSave / afterSave etc...
  452. // we need to set it up there.
  453. // We are supposed to have a response only on LOGIN with authData, so we skip those
  454. // If we're not logging in, but just updating the current user, we can safely skip that part
  455. if (this.response) {
  456. // Assign the new authData in the response
  457. Object.keys(mutatedAuthData).forEach(provider => {
  458. this.response.response.authData[provider] = mutatedAuthData[provider];
  459. });
  460. // Run the DB update directly, as 'master' only if authData contains some keys
  461. // authData could not contains keys after validation if the authAdapter
  462. // uses the `doNotSave` option. Just update the authData part
  463. // Then we're good for the user, early exit of sorts
  464. if (Object.keys(this.data.authData).length) {
  465. await this.config.database.update(this.className, {
  466. objectId: this.data.objectId
  467. }, {
  468. authData: this.data.authData
  469. }, {});
  470. }
  471. }
  472. }
  473. }
  474. };
  475. RestWrite.prototype.checkRestrictedFields = async function () {
  476. if (this.className !== '_User') {
  477. return;
  478. }
  479. if (!this.auth.isMaintenance && !this.auth.isMaster && 'emailVerified' in this.data) {
  480. const error = `Clients aren't allowed to manually update email verification.`;
  481. throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error);
  482. }
  483. };
  484. // The non-third-party parts of User transformation
  485. RestWrite.prototype.transformUser = async function () {
  486. var promise = Promise.resolve();
  487. if (this.className !== '_User') {
  488. return promise;
  489. }
  490. // Do not cleanup session if objectId is not set
  491. if (this.query && this.objectId()) {
  492. // If we're updating a _User object, we need to clear out the cache for that user. Find all their
  493. // session tokens, and remove them from the cache.
  494. const query = await (0, _RestQuery.default)({
  495. method: _RestQuery.default.Method.find,
  496. config: this.config,
  497. auth: Auth.master(this.config),
  498. className: '_Session',
  499. runBeforeFind: false,
  500. restWhere: {
  501. user: {
  502. __type: 'Pointer',
  503. className: '_User',
  504. objectId: this.objectId()
  505. }
  506. }
  507. });
  508. promise = query.execute().then(results => {
  509. results.results.forEach(session => this.config.cacheController.user.del(session.sessionToken));
  510. });
  511. }
  512. return promise.then(() => {
  513. // Transform the password
  514. if (this.data.password === undefined) {
  515. // ignore only if undefined. should proceed if empty ('')
  516. return Promise.resolve();
  517. }
  518. if (this.query) {
  519. this.storage['clearSessions'] = true;
  520. // Generate a new session only if the user requested
  521. if (!this.auth.isMaster && !this.auth.isMaintenance) {
  522. this.storage['generateNewSession'] = true;
  523. }
  524. }
  525. return this._validatePasswordPolicy().then(() => {
  526. return passwordCrypto.hash(this.data.password).then(hashedPassword => {
  527. this.data._hashed_password = hashedPassword;
  528. delete this.data.password;
  529. });
  530. });
  531. }).then(() => {
  532. return this._validateUserName();
  533. }).then(() => {
  534. return this._validateEmail();
  535. });
  536. };
  537. RestWrite.prototype._validateUserName = function () {
  538. // Check for username uniqueness
  539. if (!this.data.username) {
  540. if (!this.query) {
  541. this.data.username = cryptoUtils.randomString(25);
  542. this.responseShouldHaveUsername = true;
  543. }
  544. return Promise.resolve();
  545. }
  546. /*
  547. Usernames should be unique when compared case insensitively
  548. Users should be able to make case sensitive usernames and
  549. login using the case they entered. I.e. 'Snoopy' should preclude
  550. 'snoopy' as a valid username.
  551. */
  552. return this.config.database.find(this.className, {
  553. username: this.data.username,
  554. objectId: {
  555. $ne: this.objectId()
  556. }
  557. }, {
  558. limit: 1,
  559. caseInsensitive: true
  560. }, {}, this.validSchemaController).then(results => {
  561. if (results.length > 0) {
  562. throw new Parse.Error(Parse.Error.USERNAME_TAKEN, 'Account already exists for this username.');
  563. }
  564. return;
  565. });
  566. };
  567. /*
  568. As with usernames, Parse should not allow case insensitive collisions of email.
  569. unlike with usernames (which can have case insensitive collisions in the case of
  570. auth adapters), emails should never have a case insensitive collision.
  571. This behavior can be enforced through a properly configured index see:
  572. https://docs.mongodb.com/manual/core/index-case-insensitive/#create-a-case-insensitive-index
  573. which could be implemented instead of this code based validation.
  574. Given that this lookup should be a relatively low use case and that the case sensitive
  575. unique index will be used by the db for the query, this is an adequate solution.
  576. */
  577. RestWrite.prototype._validateEmail = function () {
  578. if (!this.data.email || this.data.email.__op === 'Delete') {
  579. return Promise.resolve();
  580. }
  581. // Validate basic email address format
  582. if (!this.data.email.match(/^.+@.+$/)) {
  583. return Promise.reject(new Parse.Error(Parse.Error.INVALID_EMAIL_ADDRESS, 'Email address format is invalid.'));
  584. }
  585. // Case insensitive match, see note above function.
  586. return this.config.database.find(this.className, {
  587. email: this.data.email,
  588. objectId: {
  589. $ne: this.objectId()
  590. }
  591. }, {
  592. limit: 1,
  593. caseInsensitive: true
  594. }, {}, this.validSchemaController).then(results => {
  595. if (results.length > 0) {
  596. throw new Parse.Error(Parse.Error.EMAIL_TAKEN, 'Account already exists for this email address.');
  597. }
  598. if (!this.data.authData || !Object.keys(this.data.authData).length || Object.keys(this.data.authData).length === 1 && Object.keys(this.data.authData)[0] === 'anonymous') {
  599. // We updated the email, send a new validation
  600. const {
  601. originalObject,
  602. updatedObject
  603. } = this.buildParseObjects();
  604. const request = {
  605. original: originalObject,
  606. object: updatedObject,
  607. master: this.auth.isMaster,
  608. ip: this.config.ip,
  609. installationId: this.auth.installationId
  610. };
  611. return this.config.userController.setEmailVerifyToken(this.data, request, this.storage);
  612. }
  613. });
  614. };
  615. RestWrite.prototype._validatePasswordPolicy = function () {
  616. if (!this.config.passwordPolicy) return Promise.resolve();
  617. return this._validatePasswordRequirements().then(() => {
  618. return this._validatePasswordHistory();
  619. });
  620. };
  621. RestWrite.prototype._validatePasswordRequirements = function () {
  622. // check if the password conforms to the defined password policy if configured
  623. // If we specified a custom error in our configuration use it.
  624. // Example: "Passwords must include a Capital Letter, Lowercase Letter, and a number."
  625. //
  626. // This is especially useful on the generic "password reset" page,
  627. // as it allows the programmer to communicate specific requirements instead of:
  628. // a. making the user guess whats wrong
  629. // b. making a custom password reset page that shows the requirements
  630. const policyError = this.config.passwordPolicy.validationError ? this.config.passwordPolicy.validationError : 'Password does not meet the Password Policy requirements.';
  631. const containsUsernameError = 'Password cannot contain your username.';
  632. // check whether the password meets the password strength requirements
  633. if (this.config.passwordPolicy.patternValidator && !this.config.passwordPolicy.patternValidator(this.data.password) || this.config.passwordPolicy.validatorCallback && !this.config.passwordPolicy.validatorCallback(this.data.password)) {
  634. return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, policyError));
  635. }
  636. // check whether password contain username
  637. if (this.config.passwordPolicy.doNotAllowUsername === true) {
  638. if (this.data.username) {
  639. // username is not passed during password reset
  640. if (this.data.password.indexOf(this.data.username) >= 0) return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, containsUsernameError));
  641. } else {
  642. // retrieve the User object using objectId during password reset
  643. return this.config.database.find('_User', {
  644. objectId: this.objectId()
  645. }).then(results => {
  646. if (results.length != 1) {
  647. throw undefined;
  648. }
  649. if (this.data.password.indexOf(results[0].username) >= 0) return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, containsUsernameError));
  650. return Promise.resolve();
  651. });
  652. }
  653. }
  654. return Promise.resolve();
  655. };
  656. RestWrite.prototype._validatePasswordHistory = function () {
  657. // check whether password is repeating from specified history
  658. if (this.query && this.config.passwordPolicy.maxPasswordHistory) {
  659. return this.config.database.find('_User', {
  660. objectId: this.objectId()
  661. }, {
  662. keys: ['_password_history', '_hashed_password']
  663. }, Auth.maintenance(this.config)).then(results => {
  664. if (results.length != 1) {
  665. throw undefined;
  666. }
  667. const user = results[0];
  668. let oldPasswords = [];
  669. if (user._password_history) oldPasswords = _lodash.default.take(user._password_history, this.config.passwordPolicy.maxPasswordHistory - 1);
  670. oldPasswords.push(user.password);
  671. const newPassword = this.data.password;
  672. // compare the new password hash with all old password hashes
  673. const promises = oldPasswords.map(function (hash) {
  674. return passwordCrypto.compare(newPassword, hash).then(result => {
  675. if (result)
  676. // reject if there is a match
  677. return Promise.reject('REPEAT_PASSWORD');
  678. return Promise.resolve();
  679. });
  680. });
  681. // wait for all comparisons to complete
  682. return Promise.all(promises).then(() => {
  683. return Promise.resolve();
  684. }).catch(err => {
  685. if (err === 'REPEAT_PASSWORD')
  686. // a match was found
  687. return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, `New password should not be the same as last ${this.config.passwordPolicy.maxPasswordHistory} passwords.`));
  688. throw err;
  689. });
  690. });
  691. }
  692. return Promise.resolve();
  693. };
  694. RestWrite.prototype.createSessionTokenIfNeeded = async function () {
  695. if (this.className !== '_User') {
  696. return;
  697. }
  698. // Don't generate session for updating user (this.query is set) unless authData exists
  699. if (this.query && !this.data.authData) {
  700. return;
  701. }
  702. // Don't generate new sessionToken if linking via sessionToken
  703. if (this.auth.user && this.data.authData) {
  704. return;
  705. }
  706. // If sign-up call
  707. if (!this.storage.authProvider) {
  708. // Create request object for verification functions
  709. const {
  710. originalObject,
  711. updatedObject
  712. } = this.buildParseObjects();
  713. const request = {
  714. original: originalObject,
  715. object: updatedObject,
  716. master: this.auth.isMaster,
  717. ip: this.config.ip,
  718. installationId: this.auth.installationId
  719. };
  720. // Get verification conditions which can be booleans or functions; the purpose of this async/await
  721. // structure is to avoid unnecessarily executing subsequent functions if previous ones fail in the
  722. // conditional statement below, as a developer may decide to execute expensive operations in them
  723. const verifyUserEmails = async () => this.config.verifyUserEmails === true || typeof this.config.verifyUserEmails === 'function' && (await Promise.resolve(this.config.verifyUserEmails(request))) === true;
  724. const preventLoginWithUnverifiedEmail = async () => this.config.preventLoginWithUnverifiedEmail === true || typeof this.config.preventLoginWithUnverifiedEmail === 'function' && (await Promise.resolve(this.config.preventLoginWithUnverifiedEmail(request))) === true;
  725. // If verification is required
  726. if ((await verifyUserEmails()) && (await preventLoginWithUnverifiedEmail())) {
  727. this.storage.rejectSignup = true;
  728. return;
  729. }
  730. }
  731. return this.createSessionToken();
  732. };
  733. RestWrite.prototype.createSessionToken = async function () {
  734. // cloud installationId from Cloud Code,
  735. // never create session tokens from there.
  736. if (this.auth.installationId && this.auth.installationId === 'cloud') {
  737. return;
  738. }
  739. if (this.storage.authProvider == null && this.data.authData) {
  740. this.storage.authProvider = Object.keys(this.data.authData).join(',');
  741. }
  742. const {
  743. sessionData,
  744. createSession
  745. } = RestWrite.createSession(this.config, {
  746. userId: this.objectId(),
  747. createdWith: {
  748. action: this.storage.authProvider ? 'login' : 'signup',
  749. authProvider: this.storage.authProvider || 'password'
  750. },
  751. installationId: this.auth.installationId
  752. });
  753. if (this.response && this.response.response) {
  754. this.response.response.sessionToken = sessionData.sessionToken;
  755. }
  756. return createSession();
  757. };
  758. RestWrite.createSession = function (config, {
  759. userId,
  760. createdWith,
  761. installationId,
  762. additionalSessionData
  763. }) {
  764. const token = 'r:' + cryptoUtils.newToken();
  765. const expiresAt = config.generateSessionExpiresAt();
  766. const sessionData = {
  767. sessionToken: token,
  768. user: {
  769. __type: 'Pointer',
  770. className: '_User',
  771. objectId: userId
  772. },
  773. createdWith,
  774. expiresAt: Parse._encode(expiresAt)
  775. };
  776. if (installationId) {
  777. sessionData.installationId = installationId;
  778. }
  779. Object.assign(sessionData, additionalSessionData);
  780. return {
  781. sessionData,
  782. createSession: () => new RestWrite(config, Auth.master(config), '_Session', null, sessionData).execute()
  783. };
  784. };
  785. // Delete email reset tokens if user is changing password or email.
  786. RestWrite.prototype.deleteEmailResetTokenIfNeeded = function () {
  787. if (this.className !== '_User' || this.query === null) {
  788. // null query means create
  789. return;
  790. }
  791. if ('password' in this.data || 'email' in this.data) {
  792. const addOps = {
  793. _perishable_token: {
  794. __op: 'Delete'
  795. },
  796. _perishable_token_expires_at: {
  797. __op: 'Delete'
  798. }
  799. };
  800. this.data = Object.assign(this.data, addOps);
  801. }
  802. };
  803. RestWrite.prototype.destroyDuplicatedSessions = function () {
  804. // Only for _Session, and at creation time
  805. if (this.className != '_Session' || this.query) {
  806. return;
  807. }
  808. // Destroy the sessions in 'Background'
  809. const {
  810. user,
  811. installationId,
  812. sessionToken
  813. } = this.data;
  814. if (!user || !installationId) {
  815. return;
  816. }
  817. if (!user.objectId) {
  818. return;
  819. }
  820. this.config.database.destroy('_Session', {
  821. user,
  822. installationId,
  823. sessionToken: {
  824. $ne: sessionToken
  825. }
  826. }, {}, this.validSchemaController);
  827. };
  828. // Handles any followup logic
  829. RestWrite.prototype.handleFollowup = function () {
  830. if (this.storage && this.storage['clearSessions'] && this.config.revokeSessionOnPasswordReset) {
  831. var sessionQuery = {
  832. user: {
  833. __type: 'Pointer',
  834. className: '_User',
  835. objectId: this.objectId()
  836. }
  837. };
  838. delete this.storage['clearSessions'];
  839. return this.config.database.destroy('_Session', sessionQuery).then(this.handleFollowup.bind(this));
  840. }
  841. if (this.storage && this.storage['generateNewSession']) {
  842. delete this.storage['generateNewSession'];
  843. return this.createSessionToken().then(this.handleFollowup.bind(this));
  844. }
  845. if (this.storage && this.storage['sendVerificationEmail']) {
  846. delete this.storage['sendVerificationEmail'];
  847. // Fire and forget!
  848. this.config.userController.sendVerificationEmail(this.data, {
  849. auth: this.auth
  850. });
  851. return this.handleFollowup.bind(this);
  852. }
  853. };
  854. // Handles the _Session class specialness.
  855. // Does nothing if this isn't an _Session object.
  856. RestWrite.prototype.handleSession = function () {
  857. if (this.response || this.className !== '_Session') {
  858. return;
  859. }
  860. if (!this.auth.user && !this.auth.isMaster && !this.auth.isMaintenance) {
  861. throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Session token required.');
  862. }
  863. // TODO: Verify proper error to throw
  864. if (this.data.ACL) {
  865. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, 'Cannot set ' + 'ACL on a Session.');
  866. }
  867. if (this.query) {
  868. if (this.data.user && !this.auth.isMaster && this.data.user.objectId != this.auth.user.id) {
  869. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME);
  870. } else if (this.data.installationId) {
  871. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME);
  872. } else if (this.data.sessionToken) {
  873. throw new Parse.Error(Parse.Error.INVALID_KEY_NAME);
  874. }
  875. if (!this.auth.isMaster) {
  876. this.query = {
  877. $and: [this.query, {
  878. user: {
  879. __type: 'Pointer',
  880. className: '_User',
  881. objectId: this.auth.user.id
  882. }
  883. }]
  884. };
  885. }
  886. }
  887. if (!this.query && !this.auth.isMaster && !this.auth.isMaintenance) {
  888. const additionalSessionData = {};
  889. for (var key in this.data) {
  890. if (key === 'objectId' || key === 'user') {
  891. continue;
  892. }
  893. additionalSessionData[key] = this.data[key];
  894. }
  895. const {
  896. sessionData,
  897. createSession
  898. } = RestWrite.createSession(this.config, {
  899. userId: this.auth.user.id,
  900. createdWith: {
  901. action: 'create'
  902. },
  903. additionalSessionData
  904. });
  905. return createSession().then(results => {
  906. if (!results.response) {
  907. throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'Error creating session.');
  908. }
  909. sessionData['objectId'] = results.response['objectId'];
  910. this.response = {
  911. status: 201,
  912. location: results.location,
  913. response: sessionData
  914. };
  915. });
  916. }
  917. };
  918. // Handles the _Installation class specialness.
  919. // Does nothing if this isn't an installation object.
  920. // If an installation is found, this can mutate this.query and turn a create
  921. // into an update.
  922. // Returns a promise for when we're done if it can't finish this tick.
  923. RestWrite.prototype.handleInstallation = function () {
  924. if (this.response || this.className !== '_Installation') {
  925. return;
  926. }
  927. if (!this.query && !this.data.deviceToken && !this.data.installationId && !this.auth.installationId) {
  928. throw new Parse.Error(135, 'at least one ID field (deviceToken, installationId) ' + 'must be specified in this operation');
  929. }
  930. // If the device token is 64 characters long, we assume it is for iOS
  931. // and lowercase it.
  932. if (this.data.deviceToken && this.data.deviceToken.length == 64) {
  933. this.data.deviceToken = this.data.deviceToken.toLowerCase();
  934. }
  935. // We lowercase the installationId if present
  936. if (this.data.installationId) {
  937. this.data.installationId = this.data.installationId.toLowerCase();
  938. }
  939. let installationId = this.data.installationId;
  940. // If data.installationId is not set and we're not master, we can lookup in auth
  941. if (!installationId && !this.auth.isMaster && !this.auth.isMaintenance) {
  942. installationId = this.auth.installationId;
  943. }
  944. if (installationId) {
  945. installationId = installationId.toLowerCase();
  946. }
  947. // Updating _Installation but not updating anything critical
  948. if (this.query && !this.data.deviceToken && !installationId && !this.data.deviceType) {
  949. return;
  950. }
  951. var promise = Promise.resolve();
  952. var idMatch; // Will be a match on either objectId or installationId
  953. var objectIdMatch;
  954. var installationIdMatch;
  955. var deviceTokenMatches = [];
  956. // Instead of issuing 3 reads, let's do it with one OR.
  957. const orQueries = [];
  958. if (this.query && this.query.objectId) {
  959. orQueries.push({
  960. objectId: this.query.objectId
  961. });
  962. }
  963. if (installationId) {
  964. orQueries.push({
  965. installationId: installationId
  966. });
  967. }
  968. if (this.data.deviceToken) {
  969. orQueries.push({
  970. deviceToken: this.data.deviceToken
  971. });
  972. }
  973. if (orQueries.length == 0) {
  974. return;
  975. }
  976. promise = promise.then(() => {
  977. return this.config.database.find('_Installation', {
  978. $or: orQueries
  979. }, {});
  980. }).then(results => {
  981. results.forEach(result => {
  982. if (this.query && this.query.objectId && result.objectId == this.query.objectId) {
  983. objectIdMatch = result;
  984. }
  985. if (result.installationId == installationId) {
  986. installationIdMatch = result;
  987. }
  988. if (result.deviceToken == this.data.deviceToken) {
  989. deviceTokenMatches.push(result);
  990. }
  991. });
  992. // Sanity checks when running a query
  993. if (this.query && this.query.objectId) {
  994. if (!objectIdMatch) {
  995. throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found for update.');
  996. }
  997. if (this.data.installationId && objectIdMatch.installationId && this.data.installationId !== objectIdMatch.installationId) {
  998. throw new Parse.Error(136, 'installationId may not be changed in this ' + 'operation');
  999. }
  1000. if (this.data.deviceToken && objectIdMatch.deviceToken && this.data.deviceToken !== objectIdMatch.deviceToken && !this.data.installationId && !objectIdMatch.installationId) {
  1001. throw new Parse.Error(136, 'deviceToken may not be changed in this ' + 'operation');
  1002. }
  1003. if (this.data.deviceType && this.data.deviceType && this.data.deviceType !== objectIdMatch.deviceType) {
  1004. throw new Parse.Error(136, 'deviceType may not be changed in this ' + 'operation');
  1005. }
  1006. }
  1007. if (this.query && this.query.objectId && objectIdMatch) {
  1008. idMatch = objectIdMatch;
  1009. }
  1010. if (installationId && installationIdMatch) {
  1011. idMatch = installationIdMatch;
  1012. }
  1013. // need to specify deviceType only if it's new
  1014. if (!this.query && !this.data.deviceType && !idMatch) {
  1015. throw new Parse.Error(135, 'deviceType must be specified in this operation');
  1016. }
  1017. }).then(() => {
  1018. if (!idMatch) {
  1019. if (!deviceTokenMatches.length) {
  1020. return;
  1021. } else if (deviceTokenMatches.length == 1 && (!deviceTokenMatches[0]['installationId'] || !installationId)) {
  1022. // Single match on device token but none on installationId, and either
  1023. // the passed object or the match is missing an installationId, so we
  1024. // can just return the match.
  1025. return deviceTokenMatches[0]['objectId'];
  1026. } else if (!this.data.installationId) {
  1027. throw new Parse.Error(132, 'Must specify installationId when deviceToken ' + 'matches multiple Installation objects');
  1028. } else {
  1029. // Multiple device token matches and we specified an installation ID,
  1030. // or a single match where both the passed and matching objects have
  1031. // an installation ID. Try cleaning out old installations that match
  1032. // the deviceToken, and return nil to signal that a new object should
  1033. // be created.
  1034. var delQuery = {
  1035. deviceToken: this.data.deviceToken,
  1036. installationId: {
  1037. $ne: installationId
  1038. }
  1039. };
  1040. if (this.data.appIdentifier) {
  1041. delQuery['appIdentifier'] = this.data.appIdentifier;
  1042. }
  1043. this.config.database.destroy('_Installation', delQuery).catch(err => {
  1044. if (err.code == Parse.Error.OBJECT_NOT_FOUND) {
  1045. // no deletions were made. Can be ignored.
  1046. return;
  1047. }
  1048. // rethrow the error
  1049. throw err;
  1050. });
  1051. return;
  1052. }
  1053. } else {
  1054. if (deviceTokenMatches.length == 1 && !deviceTokenMatches[0]['installationId']) {
  1055. // Exactly one device token match and it doesn't have an installation
  1056. // ID. This is the one case where we want to merge with the existing
  1057. // object.
  1058. const delQuery = {
  1059. objectId: idMatch.objectId
  1060. };
  1061. return this.config.database.destroy('_Installation', delQuery).then(() => {
  1062. return deviceTokenMatches[0]['objectId'];
  1063. }).catch(err => {
  1064. if (err.code == Parse.Error.OBJECT_NOT_FOUND) {
  1065. // no deletions were made. Can be ignored
  1066. return;
  1067. }
  1068. // rethrow the error
  1069. throw err;
  1070. });
  1071. } else {
  1072. if (this.data.deviceToken && idMatch.deviceToken != this.data.deviceToken) {
  1073. // We're setting the device token on an existing installation, so
  1074. // we should try cleaning out old installations that match this
  1075. // device token.
  1076. const delQuery = {
  1077. deviceToken: this.data.deviceToken
  1078. };
  1079. // We have a unique install Id, use that to preserve
  1080. // the interesting installation
  1081. if (this.data.installationId) {
  1082. delQuery['installationId'] = {
  1083. $ne: this.data.installationId
  1084. };
  1085. } else if (idMatch.objectId && this.data.objectId && idMatch.objectId == this.data.objectId) {
  1086. // we passed an objectId, preserve that instalation
  1087. delQuery['objectId'] = {
  1088. $ne: idMatch.objectId
  1089. };
  1090. } else {
  1091. // What to do here? can't really clean up everything...
  1092. return idMatch.objectId;
  1093. }
  1094. if (this.data.appIdentifier) {
  1095. delQuery['appIdentifier'] = this.data.appIdentifier;
  1096. }
  1097. this.config.database.destroy('_Installation', delQuery).catch(err => {
  1098. if (err.code == Parse.Error.OBJECT_NOT_FOUND) {
  1099. // no deletions were made. Can be ignored.
  1100. return;
  1101. }
  1102. // rethrow the error
  1103. throw err;
  1104. });
  1105. }
  1106. // In non-merge scenarios, just return the installation match id
  1107. return idMatch.objectId;
  1108. }
  1109. }
  1110. }).then(objId => {
  1111. if (objId) {
  1112. this.query = {
  1113. objectId: objId
  1114. };
  1115. delete this.data.objectId;
  1116. delete this.data.createdAt;
  1117. }
  1118. // TODO: Validate ops (add/remove on channels, $inc on badge, etc.)
  1119. });
  1120. return promise;
  1121. };
  1122. // If we short-circuited the object response - then we need to make sure we expand all the files,
  1123. // since this might not have a query, meaning it won't return the full result back.
  1124. // TODO: (nlutsenko) This should die when we move to per-class based controllers on _Session/_User
  1125. RestWrite.prototype.expandFilesForExistingObjects = async function () {
  1126. // Check whether we have a short-circuited response - only then run expansion.
  1127. if (this.response && this.response.response) {
  1128. await this.config.filesController.expandFilesInObject(this.config, this.response.response);
  1129. }
  1130. };
  1131. RestWrite.prototype.runDatabaseOperation = function () {
  1132. if (this.response) {
  1133. return;
  1134. }
  1135. if (this.className === '_Role') {
  1136. this.config.cacheController.role.clear();
  1137. if (this.config.liveQueryController) {
  1138. this.config.liveQueryController.clearCachedRoles(this.auth.user);
  1139. }
  1140. }
  1141. if (this.className === '_User' && this.query && this.auth.isUnauthenticated()) {
  1142. throw new Parse.Error(Parse.Error.SESSION_MISSING, `Cannot modify user ${this.query.objectId}.`);
  1143. }
  1144. if (this.className === '_Product' && this.data.download) {
  1145. this.data.downloadName = this.data.download.name;
  1146. }
  1147. // TODO: Add better detection for ACL, ensuring a user can't be locked from
  1148. // their own user record.
  1149. if (this.data.ACL && this.data.ACL['*unresolved']) {
  1150. throw new Parse.Error(Parse.Error.INVALID_ACL, 'Invalid ACL.');
  1151. }
  1152. if (this.query) {
  1153. // Force the user to not lockout
  1154. // Matched with parse.com
  1155. if (this.className === '_User' && this.data.ACL && this.auth.isMaster !== true && this.auth.isMaintenance !== true) {
  1156. this.data.ACL[this.query.objectId] = {
  1157. read: true,
  1158. write: true
  1159. };
  1160. }
  1161. // update password timestamp if user password is being changed
  1162. if (this.className === '_User' && this.data._hashed_password && this.config.passwordPolicy && this.config.passwordPolicy.maxPasswordAge) {
  1163. this.data._password_changed_at = Parse._encode(new Date());
  1164. }
  1165. // Ignore createdAt when update
  1166. delete this.data.createdAt;
  1167. let defer = Promise.resolve();
  1168. // if password history is enabled then save the current password to history
  1169. if (this.className === '_User' && this.data._hashed_password && this.config.passwordPolicy && this.config.passwordPolicy.maxPasswordHistory) {
  1170. defer = this.config.database.find('_User', {
  1171. objectId: this.objectId()
  1172. }, {
  1173. keys: ['_password_history', '_hashed_password']
  1174. }, Auth.maintenance(this.config)).then(results => {
  1175. if (results.length != 1) {
  1176. throw undefined;
  1177. }
  1178. const user = results[0];
  1179. let oldPasswords = [];
  1180. if (user._password_history) {
  1181. oldPasswords = _lodash.default.take(user._password_history, this.config.passwordPolicy.maxPasswordHistory);
  1182. }
  1183. //n-1 passwords go into history including last password
  1184. while (oldPasswords.length > Math.max(0, this.config.passwordPolicy.maxPasswordHistory - 2)) {
  1185. oldPasswords.shift();
  1186. }
  1187. oldPasswords.push(user.password);
  1188. this.data._password_history = oldPasswords;
  1189. });
  1190. }
  1191. return defer.then(() => {
  1192. // Run an update
  1193. return this.config.database.update(this.className, this.query, this.data, this.runOptions, false, false, this.validSchemaController).then(response => {
  1194. response.updatedAt = this.updatedAt;
  1195. this._updateResponseWithData(response, this.data);
  1196. this.response = {
  1197. response
  1198. };
  1199. });
  1200. });
  1201. } else {
  1202. // Set the default ACL and password timestamp for the new _User
  1203. if (this.className === '_User') {
  1204. var ACL = this.data.ACL;
  1205. // default public r/w ACL
  1206. if (!ACL) {
  1207. ACL = {};
  1208. if (!this.config.enforcePrivateUsers) {
  1209. ACL['*'] = {
  1210. read: true,
  1211. write: false
  1212. };
  1213. }
  1214. }
  1215. // make sure the user is not locked down
  1216. ACL[this.data.objectId] = {
  1217. read: true,
  1218. write: true
  1219. };
  1220. this.data.ACL = ACL;
  1221. // password timestamp to be used when password expiry policy is enforced
  1222. if (this.config.passwordPolicy && this.config.passwordPolicy.maxPasswordAge) {
  1223. this.data._password_changed_at = Parse._encode(new Date());
  1224. }
  1225. }
  1226. // Run a create
  1227. return this.config.database.create(this.className, this.data, this.runOptions, false, this.validSchemaController).catch(error => {
  1228. if (this.className !== '_User' || error.code !== Parse.Error.DUPLICATE_VALUE) {
  1229. throw error;
  1230. }
  1231. // Quick check, if we were able to infer the duplicated field name
  1232. if (error && error.userInfo && error.userInfo.duplicated_field === 'username') {
  1233. throw new Parse.Error(Parse.Error.USERNAME_TAKEN, 'Account already exists for this username.');
  1234. }
  1235. if (error && error.userInfo && error.userInfo.duplicated_field === 'email') {
  1236. throw new Parse.Error(Parse.Error.EMAIL_TAKEN, 'Account already exists for this email address.');
  1237. }
  1238. // If this was a failed user creation due to username or email already taken, we need to
  1239. // check whether it was username or email and return the appropriate error.
  1240. // Fallback to the original method
  1241. // TODO: See if we can later do this without additional queries by using named indexes.
  1242. return this.config.database.find(this.className, {
  1243. username: this.data.username,
  1244. objectId: {
  1245. $ne: this.objectId()
  1246. }
  1247. }, {
  1248. limit: 1
  1249. }).then(results => {
  1250. if (results.length > 0) {
  1251. throw new Parse.Error(Parse.Error.USERNAME_TAKEN, 'Account already exists for this username.');
  1252. }
  1253. return this.config.database.find(this.className, {
  1254. email: this.data.email,
  1255. objectId: {
  1256. $ne: this.objectId()
  1257. }
  1258. }, {
  1259. limit: 1
  1260. });
  1261. }).then(results => {
  1262. if (results.length > 0) {
  1263. throw new Parse.Error(Parse.Error.EMAIL_TAKEN, 'Account already exists for this email address.');
  1264. }
  1265. throw new Parse.Error(Parse.Error.DUPLICATE_VALUE, 'A duplicate value for a field with unique values was provided');
  1266. });
  1267. }).then(response => {
  1268. response.objectId = this.data.objectId;
  1269. response.createdAt = this.data.createdAt;
  1270. if (this.responseShouldHaveUsername) {
  1271. response.username = this.data.username;
  1272. }
  1273. this._updateResponseWithData(response, this.data);
  1274. this.response = {
  1275. status: 201,
  1276. response,
  1277. location: this.location()
  1278. };
  1279. });
  1280. }
  1281. };
  1282. // Returns nothing - doesn't wait for the trigger.
  1283. RestWrite.prototype.runAfterSaveTrigger = function () {
  1284. if (!this.response || !this.response.response || this.runOptions.many) {
  1285. return;
  1286. }
  1287. // Avoid doing any setup for triggers if there is no 'afterSave' trigger for this class.
  1288. const hasAfterSaveHook = triggers.triggerExists(this.className, triggers.Types.afterSave, this.config.applicationId);
  1289. const hasLiveQuery = this.config.liveQueryController.hasLiveQuery(this.className);
  1290. if (!hasAfterSaveHook && !hasLiveQuery) {
  1291. return Promise.resolve();
  1292. }
  1293. const {
  1294. originalObject,
  1295. updatedObject
  1296. } = this.buildParseObjects();
  1297. updatedObject._handleSaveResponse(this.response.response, this.response.status || 200);
  1298. if (hasLiveQuery) {
  1299. this.config.database.loadSchema().then(schemaController => {
  1300. // Notify LiveQueryServer if possible
  1301. const perms = schemaController.getClassLevelPermissions(updatedObject.className);
  1302. this.config.liveQueryController.onAfterSave(updatedObject.className, updatedObject, originalObject, perms);
  1303. });
  1304. }
  1305. if (!hasAfterSaveHook) {
  1306. return Promise.resolve();
  1307. }
  1308. // Run afterSave trigger
  1309. return triggers.maybeRunTrigger(triggers.Types.afterSave, this.auth, updatedObject, originalObject, this.config, this.context).then(result => {
  1310. const jsonReturned = result && !result._toFullJSON;
  1311. if (jsonReturned) {
  1312. this.pendingOps.operations = {};
  1313. this.response.response = result;
  1314. } else {
  1315. this.response.response = this._updateResponseWithData((result || updatedObject).toJSON(), this.data);
  1316. }
  1317. }).catch(function (err) {
  1318. _logger.default.warn('afterSave caught an error', err);
  1319. });
  1320. };
  1321. // A helper to figure out what location this operation happens at.
  1322. RestWrite.prototype.location = function () {
  1323. var middle = this.className === '_User' ? '/users/' : '/classes/' + this.className + '/';
  1324. const mount = this.config.mount || this.config.serverURL;
  1325. return mount + middle + this.data.objectId;
  1326. };
  1327. // A helper to get the object id for this operation.
  1328. // Because it could be either on the query or on the data
  1329. RestWrite.prototype.objectId = function () {
  1330. return this.data.objectId || this.query.objectId;
  1331. };
  1332. // Returns a copy of the data and delete bad keys (_auth_data, _hashed_password...)
  1333. RestWrite.prototype.sanitizedData = function () {
  1334. const data = Object.keys(this.data).reduce((data, key) => {
  1335. // Regexp comes from Parse.Object.prototype.validate
  1336. if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(key)) {
  1337. delete data[key];
  1338. }
  1339. return data;
  1340. }, deepcopy(this.data));
  1341. return Parse._decode(undefined, data);
  1342. };
  1343. // Returns an updated copy of the object
  1344. RestWrite.prototype.buildParseObjects = function () {
  1345. var _this$query;
  1346. const extraData = {
  1347. className: this.className,
  1348. objectId: (_this$query = this.query) === null || _this$query === void 0 ? void 0 : _this$query.objectId
  1349. };
  1350. let originalObject;
  1351. if (this.query && this.query.objectId) {
  1352. originalObject = triggers.inflate(extraData, this.originalData);
  1353. }
  1354. const className = Parse.Object.fromJSON(extraData);
  1355. const readOnlyAttributes = className.constructor.readOnlyAttributes ? className.constructor.readOnlyAttributes() : [];
  1356. if (!this.originalData) {
  1357. for (const attribute of readOnlyAttributes) {
  1358. extraData[attribute] = this.data[attribute];
  1359. }
  1360. }
  1361. const updatedObject = triggers.inflate(extraData, this.originalData);
  1362. Object.keys(this.data).reduce(function (data, key) {
  1363. if (key.indexOf('.') > 0) {
  1364. if (typeof data[key].__op === 'string') {
  1365. if (!readOnlyAttributes.includes(key)) {
  1366. updatedObject.set(key, data[key]);
  1367. }
  1368. } else {
  1369. // subdocument key with dot notation { 'x.y': v } => { 'x': { 'y' : v } })
  1370. const splittedKey = key.split('.');
  1371. const parentProp = splittedKey[0];
  1372. let parentVal = updatedObject.get(parentProp);
  1373. if (typeof parentVal !== 'object') {
  1374. parentVal = {};
  1375. }
  1376. parentVal[splittedKey[1]] = data[key];
  1377. updatedObject.set(parentProp, parentVal);
  1378. }
  1379. delete data[key];
  1380. }
  1381. return data;
  1382. }, deepcopy(this.data));
  1383. const sanitized = this.sanitizedData();
  1384. for (const attribute of readOnlyAttributes) {
  1385. delete sanitized[attribute];
  1386. }
  1387. updatedObject.set(sanitized);
  1388. return {
  1389. updatedObject,
  1390. originalObject
  1391. };
  1392. };
  1393. RestWrite.prototype.cleanUserAuthData = function () {
  1394. if (this.response && this.response.response && this.className === '_User') {
  1395. const user = this.response.response;
  1396. if (user.authData) {
  1397. Object.keys(user.authData).forEach(provider => {
  1398. if (user.authData[provider] === null) {
  1399. delete user.authData[provider];
  1400. }
  1401. });
  1402. if (Object.keys(user.authData).length == 0) {
  1403. delete user.authData;
  1404. }
  1405. }
  1406. }
  1407. };
  1408. RestWrite.prototype._updateResponseWithData = function (response, data) {
  1409. const stateController = Parse.CoreManager.getObjectStateController();
  1410. const [pending] = stateController.getPendingOps(this.pendingOps.identifier);
  1411. for (const key in this.pendingOps.operations) {
  1412. if (!pending[key]) {
  1413. data[key] = this.originalData ? this.originalData[key] : {
  1414. __op: 'Delete'
  1415. };
  1416. this.storage.fieldsChangedByTrigger.push(key);
  1417. }
  1418. }
  1419. const skipKeys = [...(_SchemaController.requiredColumns.read[this.className] || [])];
  1420. if (!this.query) {
  1421. skipKeys.push('objectId', 'createdAt');
  1422. } else {
  1423. skipKeys.push('updatedAt');
  1424. delete response.objectId;
  1425. }
  1426. for (const key in response) {
  1427. if (skipKeys.includes(key)) {
  1428. continue;
  1429. }
  1430. const value = response[key];
  1431. if (value == null || value.__type && value.__type === 'Pointer' || util.isDeepStrictEqual(data[key], value) || util.isDeepStrictEqual((this.originalData || {})[key], value)) {
  1432. delete response[key];
  1433. }
  1434. }
  1435. if (_lodash.default.isEmpty(this.storage.fieldsChangedByTrigger)) {
  1436. return response;
  1437. }
  1438. const clientSupportsDelete = ClientSDK.supportsForwardDelete(this.clientSDK);
  1439. this.storage.fieldsChangedByTrigger.forEach(fieldName => {
  1440. const dataValue = data[fieldName];
  1441. if (!Object.prototype.hasOwnProperty.call(response, fieldName)) {
  1442. response[fieldName] = dataValue;
  1443. }
  1444. // Strips operations from responses
  1445. if (response[fieldName] && response[fieldName].__op) {
  1446. delete response[fieldName];
  1447. if (clientSupportsDelete && dataValue.__op == 'Delete') {
  1448. response[fieldName] = dataValue;
  1449. }
  1450. }
  1451. });
  1452. return response;
  1453. };
  1454. var _default = exports.default = RestWrite;
  1455. module.exports = R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AgICB9XG4gICAgICAgIGNvbnN0IHVzZXIgPSByZXN1bHRzWzBdO1xuICAgICAgICBsZXQgb2xkUGFzc3dvcmRzID0gW107XG4gICAgICAgIGlmICh1c2VyLl9wYXNzd29yZF9oaXN0b3J5KVxuICAgICAgICAgIG9sZFBhc3N3b3JkcyA9IF8udGFrZShcbiAgICAgICAgICAgIHVzZXIuX3Bhc3N3b3JkX2hpc3RvcnksXG4gICAgICAgICAgICB0aGlzLmNvbmZpZy5wYXNzd29yZFBvbGljeS5tYXhQYXNzd29yZEhpc3RvcnkgLSAxXG4gICAgICAgICAgKTtcbiAgICAgICAgb2xkUGFzc3dvcmRzLnB1c2godXNlci5wYXNzd29yZCk7XG4gICAgICAgIGNvbnN0IG5ld1Bhc3N3b3JkID0gdGhpcy5kYXRhLnBhc3N3b3JkO1xuICAgICAgICAvLyBjb21wYXJlIHRoZSBuZXcgcGFzc3dvcmQgaGFzaCB3aXRoIGFsbCBvbGQgcGFzc3dvcmQgaGFzaGVzXG4gICAgICAgIGNvbnN0IHByb21pc2VzID0gb2xkUGFzc3dvcmRzLm1hcChmdW5jdGlvbiAoaGFzaCkge1xuICAgICAgICAgIHJldHVybiBwYXNzd29yZENyeXB0by5jb21wYXJlKG5ld1Bhc3N3b3JkLCBoYXNoKS50aGVuKHJlc3VsdCA9PiB7XG4gICAgICAgICAgICBpZiAocmVzdWx0KVxuICAgICAgICAgICAgICAvLyByZWplY3QgaWYgdGhlcmUgaXMgYSBtYXRjaFxuICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoJ1JFUEVBVF9QQVNTV09SRCcpO1xuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgLy8gd2FpdCBmb3IgYWxsIGNvbXBhcmlzb25zIHRvIGNvbXBsZXRlXG4gICAgICAgIHJldHVybiBQcm9taXNlLmFsbChwcm9taXNlcylcbiAgICAgIC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dElkOiBpZE1hdGNoLm9iamVjdElkIH07XG4gICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLmRhdGFiYXNlXG4gICAgICAgICAgICAuZGVzdHJveSgnX0luc3RhbGxhdGlvbicsIGRlbFF1ZXJ5KVxuICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICByZXR1cm4gZGV2aWNlVG9rZW5NYXRjaGVzWzBdWydvYmplY3RJZCddO1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIC5jYXRjaChlcnIgPT4ge1xuICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgPT0gUGFyc2UuRXJyb3IuT0JKRUNUX05PVF9GT1VORCkge1xuICAgICAgICAgICAgICAgIC8vIG5vIGRlbGV0aW9ucyB3ZXJlIG1hZGUuIENhbiBiZSBpZ25vcmVkXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIC8vIHJldGhyb3cgdGhlIGVycm9yXG4gICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGlmICh0aGlzLmRhdGEuZGV2aWNlVG9rZW4gJiYgaWRNYXRjaC5kZXZpY2VUb2tlbiAhPSB0aGlzLmRhdGEuZGV2aWNlVG9rZW4pIHtcbiAgICAgICAgICAgIC8vIFdlJ3JlIHNldHRpbmcgdGhlIGRldmljZSB0b2tlbiBvbiBhbiBleGlzdGluZyBpbnN0YWxsYXRpb24sIHNvXG4gICAgICAgICAgICAvLyB3ZSBzaG91bGQgdHJ5IGNsZWFuaW5nIG91dCBvbGQgaW5zdGFsbGF0aW9ucyB0aGF0IG1hdGNoIHRoaXNcbiAgICAgICAgICAgIC8vIGRldmljZSB0b2tlbi5cbiAgICAgICAgICAgIGNvbnN0IGRlbFF1ZXJ5ID0ge1xuICAgICAgICAgICAgICBkZXZpY2VUb2tlbjogdGhpcy5kYXRhLmRldmljZVRva2VuLFxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIC8vIFdlIGhhdmUgYSB1bmlxdWUgaW5zdGFsbCBJZCwgdXNlIHRoYXQgdG8gcHJlc2VydmVcbiAgICAgICAgICAgIC8vIHRoZSBpbnRlcmVzdGluZyBpbnN0YWxsYXRpb25cbiAgICAgICAgICAgIGlmICh0aGlzLmRhdGEuaW5zdGFsbGF0aW9uSWQpIHtcbiAgICAgICAgICAgICAgZGVsUXVlcnlbJ2luc3RhbGxhdGlvbklkJ10gPSB7XG4gICAgICAgICAgICAgICAgJG5lOiB0aGlzLmRhdGEuaW5zdGFsbGF0aW9uSWQsXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9IGVsc2UgaWYgKFxuICAgICAgICAgICAgICBpZE1hdGNoLm9iamVjdElkICYmXG4gICAgICAgICAgICAgIHRoaXMuZGF0YS5vYmplY3RJZCAmJlxuICAgICAgICAgICAgICBpZE1hdGNoLm9iamVjdElkID09IHRoaXMuZGF0YS5vYmplY3RJZFxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgIC8vIHdlIHBhc3NlZCBhbiBvYmplY3RJZCwgcHJlc2VydmUgdGhhdCBpbnN0YWxhdGlvblxuICAgICAgICAgICAgICBkZWxRdWVyeVsnb2JqZWN0SWQnXSA9IHtcbiAgICAgICAgICAgICAgICAkbmU6IGlkTWF0Y2gub2JqZWN0SWQsXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBXaGF0IHRvIGRvIGhlcmU/IGNhbid0IHJlYWxseSBjbGVhbiB1cCBldmVyeXRoaW5nLi4uXG4gICAgICAgICAgICAgIHJldHVybiBpZE1hdGNoLm9iamVjdElkO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuZGF0YS5hcHBJZGVudGlmaWVyKSB7XG4gICAgICAgICAgICAgIGRlbFF1ZXJ5WydhcHBJZGVudGlma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pcy5jb25maWcucGFzc3dvcmRQb2xpY3kubWF4UGFzc3dvcmRIaXN0b3J5XG4gICAgKSB7XG4gICAgICBkZWZlciA9IHRoaXMuY29uZmlnLmRhdGFiYXNlXG4gICAgICAgIC5maW5kKFxuICAgICAgICAgICdfVXNlcicsXG4gICAgICAgICAgeyBvYmplY3RJZDogdGhpcy5vYmplY3RJZCgpIH0sXG4gICAgICAgICAgeyBrZXlzOiBbJ19wYXNzd29yZF9oaXN0b3J5JywgJ19oYXNoZWRfcGFzc3dvcmQnXSB9LFxuICAgICAgICAgIEF1dGgubWFpbnRlbmFuY2UodGhpcy5jb25maWcpXG4gICAgICAgIClcbiAgICAgICAgLnRoZW4ocmVzdWx0cyA9PiB7XG4gICAgICAgICAgaWYgKHJlc3VsdHMubGVuZ3RoICE9IDEpIHtcbiAgICAgICAgICAgIHRocm93IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29uc3QgdXNlciA9IHJlc3VsdHNbMF07XG4gICAgICAgICAgbGV0IG9sZFBhc3N3b3JkcyA9IFtdO1xuICAgICAgICAgIGlmICh1c2VyLl9wYXNzd29yZF9oaXN0b3J5KSB7XG4gICAgICAgICAgICBvbGRQYXNzd29yZHMgPSBfLnRha2UoXG4gICAgICAgICAgICAgIHVzZXIuX3Bhc3N3b3JkX2hpc3RvcnksXG4gICAgICAgICAgICAgIHRoaXMuY29uZmlnLnBhc3N3b3JkUG9saWN5Lm1heFBhc3N3b3JkSGlzdG9yeVxuICAgICAgICAgICAgKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLy9uLTEgcGFzc3dvcmRzIGdvIGludG8gaGlzdG9yeSBpbmNsdWRpbmcgbGFzdCBwYXNzd29yZFxuICAgICAgICAgIHdoaWxlIChcbiAgICAgICAgICAgIG9sZFBhc3N3b3Jkcy5sZW5ndGggPiBNYXRoLm1heCgwLCB0aGlzLmNvbmZpZy5wYXNzd29yZFBvbGljeS5tYXhQYXNzd29yZEhpc3RvcnkgL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8gRmFsbGJhY2sgdG8gdGhlIG9yaWdpbmFsIG1ldGhvZFxuICAgICAgICAvLyBUT0RPOiBTZWUgaWYgd2UgY2FuIGxhdGVyIGRvIHRoaXMgd2l0aG91dCBhZGRpdGlvbmFsIHF1ZXJpZXMgYnkgdXNpbmcgbmFtZWQgaW5kZXhlcy5cbiAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLmRhdGFiYXNlXG4gICAgICAgICAgLmZpbmQoXG4gICAgICAgICAgICB0aGlzLmNsYXNzTmFtZSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgdXNlcm5hbWU6IHRoaXMuZGF0YS51c2VybmFtZSxcbiAgICAgICAgICAgICAgb2JqZWN0SWQ6IHsgJG5lOiB0aGlzLm9iamVjdElkKCkgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7IGxpbWl0OiAxIH1cbiAgICAgICAgICApXG4gICAgICAgICAgLnRoZW4ocmVzdWx0cyA9PiB7XG4gICAgICAgICAgICBpZiAocmVzdWx0cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgIHRocm93IG5ldyBQYXJzZS5FcnJvcihcbiAgICAgICAgICAgICAgICBQYXJzZS5FcnJvci5VU0VSTkFNRV9UQUtFTixcbiAgICAgICAgICAgICAgICAnQWNjb3VudCBhbHJlYWR5IGV4aXN0cyBmb3IgdGhpcyB1c2VybmFtZS4nXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jb25maWcuZGF0YWJhc2UuZmluZChcbiAgICAgICAgICAgICAgdGhpcy5jbGFzc05hbWUsXG4gICAgICAgICAgICAgIHsgZW1haWw6IHRoaXMuZGF0YS5lbWFpbCwgb2JqZWN0SWQ6IHsgJG5lOiB0aGlzLm9iamVjdElkKCkgfSB9LFxuICAgICAgICAgICAgICB7IGxpbWl0OiAxIH1cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfSlcbiAgICAgICAgIC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