Skip to content

Commit

Permalink
Added secret variable type
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-sharma-08 committed Sep 25, 2023
1 parent d863b00 commit 56f36ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions lib/collection/variable-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var _ = require('../util').lodash,
SET: 'set',
UNSET: 'unset'
},
ANY = 'any',
SECRET = 'secret',
VariableScope;

/**
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}
},

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 56f36ab

Please sign in to comment.