Skip to content

Commit ad4de1c

Browse files
author
Vidas P
committed
Remove unused 'dangerous' path
Some agents used to be flagged as dangerous and required additional confirmation during workflow import. No such agents exist therefore functionality is removed.
1 parent 6a57ffc commit ad4de1c

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

app/importers/workflow_import.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class WorkflowImport
77
include ActiveModel::Callbacks
88
include ActiveModel::Validations::Callbacks
99

10-
DANGEROUS_AGENT_TYPES = %w[Agents::ShellCommandAgent].freeze
1110
URL_REGEX = %r{/\Ahttps?:\/\//i}.freeze
1211

1312
attr_accessor :file, :data, :do_import, :merges
@@ -36,10 +35,6 @@ def existing_workflow
3635
@existing_workflow ||= user.workflows.find_by(guid: parsed_data['guid'])
3736
end
3837

39-
def dangerous?
40-
(parsed_data['agents'] || []).any? { |agent| DANGEROUS_AGENT_TYPES.include?(agent['type']) }
41-
end
42-
4338
def parsed_data
4439
@parsed_data ||= (data && JSON.parse(data) rescue {}) || {}
4540
end

app/views/workflow_imports/_step_two.html.erb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<div class="row">
22
<div class="col-md-12">
3-
<% if @workflow_import.dangerous? %>
4-
<div class="alert alert-danger">
5-
<%= icon_tag('fa-exclamation-triangle') %>
6-
This Workflow contains one or more potentially dangerous Agents.
7-
These may be able to run local commands or execute code.
8-
Please be sure that you understand the Agent configurations before importing!
9-
</div>
10-
<% end %>
11-
123
<% if @workflow_import.existing_workflow.present? %>
134
<div class="alert alert-warning">
145
<%= icon_tag('fa-exclamation-triangle') %>

spec/importers/workflow_import_spec.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,6 @@
137137
end
138138
end
139139

140-
describe '#dangerous?' do
141-
it 'returns false on most Agents' do
142-
expect(WorkflowImport.new(data: valid_data)).not_to be_dangerous
143-
end
144-
145-
it 'returns true if a ShellCommandAgent is present' do
146-
valid_parsed_data[:agents][0][:type] = 'Agents::ShellCommandAgent'
147-
expect(WorkflowImport.new(data: valid_parsed_data.to_json)).to be_dangerous
148-
end
149-
end
150-
151140
describe '#import and #generate_diff' do
152141
let(:workflow_import) do
153142
_import = WorkflowImport.new(data: valid_data)

0 commit comments

Comments
 (0)