Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML should use safe_load throughout and support psych 4 #137

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ gem 'rails', '~> 7.0.4', '>= 7.0.8.1'
# Use old psych for YAML on Ruby 3.1 until we move to Rails 7.0.4
# so that we can continue to use aliases in config/locales/en.yml
# cf. https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias
gem 'psych', '3.3.2' # Exactly match the version on Ruby 3.0
gem 'psych', '4.0.4' # Exactly match the version on Ruby 3.1
gem 'stringio', '3.0.1.2' # psych dependency: exactly match the version on Ruby 3.1

# Use postgresql as the database for Active Record
gem 'pg', '~> 1.4.6' # All client instance have postgres version >= 9.3
Expand Down
7 changes: 5 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ GEM
method_source (~> 1.0)
pry-rails (0.3.11)
pry (>= 0.13.0)
psych (3.3.2)
psych (4.0.4)
stringio
public_suffix (6.0.1)
puma (6.4.3)
nio4r (~> 2.0)
Expand Down Expand Up @@ -509,6 +510,7 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
stringio (3.0.1.2)
terminal-notifier-guard (1.7.0)
test-unit (3.6.2)
power_assert
Expand Down Expand Up @@ -598,7 +600,7 @@ DEPENDENCIES
possibly
pry
pry-rails
psych (= 3.3.2)
psych (= 4.0.4)
puma (~> 6.0)
puma-daemon
rack-mini-profiler
Expand All @@ -609,6 +611,7 @@ DEPENDENCIES
sass-rails
simplecov
spring
stringio (= 3.0.1.2)
terminal-notifier-guard
turbolinks (~> 5.x)
web-console
Expand Down
8 changes: 2 additions & 6 deletions config/attribute-map.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Maps attributes from IdP SAML response to SP user model fields.
# See https://github.com/apokalipto/devise_saml_authenticatable for more.
default: &default {}
development: {}

development:
<<: *default

test:
<<: *default
test: {}

production:
objectGuid: object_guid
Expand Down
3 changes: 2 additions & 1 deletion lib/export/cancer_death_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def initialize(filename, e_type, ppats, filter = 'cd', ppatid_rowids: nil)
# Load the required mapping file based on @batch.e_type
def table_mapping
mapping_file = 'cd_mapping.yml'
YAML.load_file(SafePath.new('mappings_config').join(mapping_file))['cd']
YAML.safe_load_file(SafePath.new('mappings_config').join(mapping_file),
permitted_classes: [NdrImport::Table, Regexp, Symbol])['cd']
end

# Does this row match the current extract
Expand Down
3 changes: 2 additions & 1 deletion lib/export/delimited_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def table_mapping
raise "No mapping found for #{@batch.e_type}"
end

YAML.load_file(SafePath.new('mappings_config').join(mapping_file))
YAML.safe_load_file(SafePath.new('mappings_config').join(mapping_file),
permitted_classes: [NdrImport::Table, Regexp, Symbol])
end

# Header rows (including weird capitalisations of some fields)
Expand Down
3 changes: 2 additions & 1 deletion lib/import/brca/core/brca_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def table_mapping
else
raise "No mapping found for #{@batch.e_type}"
end
YAML.load_file(SafePath.new('mappings_config').join(mapping_file))
YAML.safe_load_file(SafePath.new('mappings_config').join(mapping_file),
permitted_classes: [NdrImport::Table, Regexp, Symbol])
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/import/delimited_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def table_mapping
raise "No mapping found for #{@batch.e_type}"
end

YAML.load_file(SafePath.new('mappings_config').join(mapping_file))
YAML.safe_load_file(SafePath.new('mappings_config').join(mapping_file),
permitted_classes: [NdrImport::Table, Regexp, Symbol])
end

# Check that the mappings inherit NdrImport::Table
Expand Down
Binary file removed vendor/cache/psych-3.3.2.gem
Binary file not shown.
Binary file added vendor/cache/psych-4.0.4.gem
Binary file not shown.
Binary file added vendor/cache/stringio-3.0.1.2.gem
Binary file not shown.
Loading