diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4e7b4fe1b..45d911454 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,10 @@ in development Changed ~~~~~~~ +* Re-introduced preview sanitization for secrets. #1005 + + Contributed by @fdrab + * Updated various dependencies (security). #1009, #1020 Contributed by @enykeev diff --git a/apps/st2-actions/actions-details.component.js b/apps/st2-actions/actions-details.component.js index 84a3df31f..230211d69 100644 --- a/apps/st2-actions/actions-details.component.js +++ b/apps/st2-actions/actions-details.component.js @@ -17,6 +17,7 @@ import React from 'react'; import { PropTypes } from 'prop-types'; import { connect } from 'react-redux'; import store from './store'; +import _ from 'lodash'; import api from '@stackstorm/module-api'; import notification from '@stackstorm/module-notification'; @@ -270,6 +271,16 @@ export default class ActionsDetails extends React.Component { this.setState({ runPreview }); } + sanitizePreview(code) { + return _.mapValues(code, (value, key) => { + if (value && this.props.action.parameters[key] && this.props.action.parameters[key].secret) { + return '*'.repeat(value.length); + } + + return value; + }); + } + handleToggleExecution(id) { this.setState({ executionsVisible: { @@ -477,7 +488,7 @@ export default class ActionsDetails extends React.Component { ) : null } - { this.state.runPreview && } + { this.state.runPreview && }