mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
HTML report from exported project security issue [SCI-10237]
This commit is contained in:
parent
45353987ad
commit
48b4dbe1fe
3 changed files with 12 additions and 8 deletions
|
@ -349,15 +349,15 @@ class MyModule < ApplicationRecord
|
|||
rows.find_each do |row|
|
||||
row_json = []
|
||||
row_json << row.code
|
||||
row_json << (row.archived ? "#{row.name} [#{I18n.t('general.archived')}]" : row.name)
|
||||
row_json << (row.archived ? "#{escape_script_tag(row.name)} [#{I18n.t('general.archived')}]" : escape_script_tag(row.name))
|
||||
row_json << I18n.l(row.created_at, format: :full)
|
||||
row_json << row.created_by.full_name
|
||||
row_json << escape_script_tag(row.created_by.full_name)
|
||||
if repository.has_stock_management?
|
||||
if repository.is_a?(RepositorySnapshot)
|
||||
consumed_stock = row.repository_stock_consumption_cell&.value&.formatted
|
||||
consumed_stock = escape_script_tag(row.repository_stock_consumption_cell&.value&.formatted)
|
||||
row_json << (consumed_stock || 0)
|
||||
else
|
||||
row_json << row.row_consumption(row.stock_consumption)
|
||||
row_json << escape_script_tag(row.row_consumption(row.stock_consumption))
|
||||
end
|
||||
end
|
||||
data << row_json
|
||||
|
@ -484,6 +484,10 @@ class MyModule < ApplicationRecord
|
|||
protocols << Protocol.new_blank_for_module(self)
|
||||
end
|
||||
|
||||
def escape_script_tag(value)
|
||||
value&.gsub(/\</, '<')&.gsub(/\>/, '>')
|
||||
end
|
||||
|
||||
def coordinates_uniqueness_check
|
||||
if experiment && experiment.my_modules.active.where(x: x, y: y).where.not(id: id).any?
|
||||
errors.add(:position, I18n.t('activerecord.errors.models.my_module.attributes.position.not_unique'))
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8 %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata.to_json %>" />
|
||||
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8.gsub(/\</, '<').gsub(/\>/, '>') %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata.to_json.gsub(/\</, '<').gsub(/\>/, '>') %>" />
|
||||
<div class="hot-table-container"></div>
|
||||
<table class="report-common-table-format"></table>
|
||||
</div>
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="report-element-body">
|
||||
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8 %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata.to_json %>" />
|
||||
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8.gsub(/\</, '<').gsub(/\>/, '>') %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata.to_json.gsub(/\</, '<').gsub(/\>/, '>') %>" />
|
||||
<div class="hot-table-container"></div>
|
||||
<table class="report-common-table-format"></table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue