Scrub passwords from extra vars preview on launch

This commit is contained in:
mabashian
2018-04-02 16:47:49 -04:00
parent b905aec1d4
commit 278a2091c2

View File

@@ -37,6 +37,8 @@ export default
scope.promptData.extraVars = ToJSON(scope.parseType, scope.promptData.prompts.variables.value, false);
const surveyPasswords = {};
if (scope.promptData.launchConf.ask_tags_on_launch) {
scope.promptData.prompts.tags.value = consolidateTags(scope.promptData.prompts.tags.value, "#job_launch_job_tags");
}
@@ -69,10 +71,20 @@ export default
break;
}
}
if (surveyQuestion.type === 'password' && surveyQuestion.model.toString()!=="") {
surveyPasswords[surveyQuestion.variable] = '$encrypted$';
}
});
}
scope.promptExtraVars = $.isEmptyObject(scope.promptData.extraVars) ? '---' : '---\n' + jsyaml.safeDump(scope.promptData.extraVars);
// We don't want to modify the extra vars when we merge them with the survey
// password $encrypted$ strings so we clone it
const extraVarsClone = _.cloneDeep(scope.promptData.extraVars);
// Replace the survey passwords with $encrypted$ to display to the user
const cleansedExtraVars = Object.assign(extraVarsClone, surveyPasswords);
scope.promptExtraVars = $.isEmptyObject(scope.promptData.extraVars) ? '---' : '---\n' + jsyaml.safeDump(cleansedExtraVars);
ParseTypeChange({
scope: scope,