Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/st2-actions/actions-details.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -477,7 +488,7 @@ export default class ActionsDetails extends React.Component {
</Link>
) : null }
</DetailsToolbar>
{ this.state.runPreview && <Highlight key="preview" well data-test="action_code" code={this.state.runValue} /> }
{ this.state.runPreview && <Highlight key="preview" well data-test="action_code" code={this.sanitizePreview(this.state.runValue)} /> }
<DetailsPanel key="panel" data-test="action_parameters">
<DetailsPanelBody>
<form>
Expand Down