From 56f36abb4970b94ad09ac41dc85d483dbb370338 Mon Sep 17 00:00:00 2001 From: Dev Sharma Date: Mon, 25 Sep 2023 12:35:01 +0530 Subject: [PATCH] Added secret variable type --- lib/collection/variable-scope.js | 14 +++++++++++--- package.json | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/collection/variable-scope.js b/lib/collection/variable-scope.js index 8791b8db5..c24e24492 100644 --- a/lib/collection/variable-scope.js +++ b/lib/collection/variable-scope.js @@ -15,7 +15,7 @@ var _ = require('../util').lodash, SET: 'set', UNSET: 'unset' }, - ANY = 'any', + SECRET = 'secret', VariableScope; /** @@ -221,7 +221,7 @@ _.assign(VariableScope.prototype, /** @lends VariableScope.prototype */ { * @param {*} value - The value of the variable to be set. * @param {Variable.types} [type] - Optionally, the value of the variable can be set to a type */ - set: function (key, value, type = ANY) { + set: function (key, value, type) { var variable = this.values.oneNormalizedVariable(key), // create an object that will be used as setter @@ -239,7 +239,15 @@ _.assign(VariableScope.prototype, /** @lends VariableScope.prototype */ { } // track the change if mutation tracking is enabled - this._postman_enableTracking && this.mutations.track(MUTATIONS.SET, key, value, type); + if (this._postman_enableTracking) { + // eslint-disable-next-line security/detect-possible-timing-attacks + if (type === SECRET) { + this.mutations.track(MUTATIONS.SET, key, value, type); + } + else { + this.mutations.track(MUTATIONS.SET, key, value); + } + } }, /** diff --git a/package.json b/package.json index 90e450a7e..7029979db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postman-collection-secret-variable-type-only", - "version": "1.0.0", + "version": "1.0.1", "description": "Enables developers to use a unified Postman Collection format Object across projects", "author": "Postman Inc.", "license": "Apache-2.0",