Skip to content

Commit e0bf18f

Browse files
authored
fix(security): replace IO.read with File.read (#378)
1 parent 263e66a commit e0bf18f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3+
## Next
4+
5+
* fix(security): replace IO.read with File.read [#378](https://github.com/rubyconfig/config/pull/378)
6+
37
## 5.6.0
48

5-
* Added `extra_sources` in initializer ([#366](https://github.com/rubyconfig/config/pull/366))
9+
* Added `extra_sources` in initializer ([#366](https://github.com/rubyconfig/config/pull/366))
610

711
## 5.5.2
812

lib/config/sources/yaml_source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize(path, evaluate_erb: Config.evaluate_erb_in_yaml)
1515
# returns a config hash from the YML file
1616
def load
1717
if @path and File.exist?(@path)
18-
file_contents = IO.read(@path)
18+
file_contents = File.read(@path)
1919
file_contents = ERB.new(file_contents).result if evaluate_erb
2020
result = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(file_contents) : YAML.load(file_contents)
2121
end

spec/support/rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Loads ENV vars from a yaml file
66
def load_env(filename)
77
if filename and File.exist?(filename.to_s)
8-
result = YAML.load(ERB.new(IO.read(filename.to_s)).result)
8+
result = YAML.load(ERB.new(File.read(filename.to_s)).result)
99
end
1010
result.each { |key, value| ENV[key.to_s] = value.to_s } unless result.nil?
1111
end

0 commit comments

Comments
 (0)