kleya 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e961f3f872b73c43fa5ba4ae0698131fd6d4661b373d420c777407cb65a2b89c
4
- data.tar.gz: fa9350aee31f915fb377896f53af0e84c9c792171646c90a4b8989b31f06cd49
3
+ metadata.gz: 3637aa608ae5b732ac331b301d73342c352e89b51cf9cca1539949bf696cb967
4
+ data.tar.gz: 407dffe786eded0e8d1b4936cfd2d3746df84b553b8cc67487e49aaf1482a9c1
5
5
  SHA512:
6
- metadata.gz: 507f50a9fb5e402940627a4348e439ef48abc8fdca6ba2c8a904928f0b1bda584c382ac95f300c055793e34424b876679e215aaa64d0001647293a79b989c50b
7
- data.tar.gz: bf91d1195ba0ef3d283ec35dae24f31f56ea1103bed9f83a17a05e8309a9013ceb682b939181db3982b8c62758dd4333598200a4638152978b24883c45382873
6
+ metadata.gz: fbe9b5a622435673de2a6491bf459811e047d777aaeb907c63ee047dcb57db38880dd2962ddfb550480d49094aa770732f47653cbd0eb4e5f7fea5c9b028d256
7
+ data.tar.gz: c874c21a1523e2df494c4e9d413bb7ab7c564dfe96a0422b937054e7d37d481d62b8b39a896adad0e979afaa51bb888a3008c655c35cd1fdabd732c6ca459b27
@@ -35,6 +35,8 @@ module Kleya
35
35
  # @param path [String] the path to save the artifact
36
36
  # @return [String] the full path where the file was saved
37
37
  def save(path = nil)
38
+ raise ArgumentError, 'path cannot contain parent directory traversal' if path.to_s.split(/[\\\/]/).include?('..')
39
+
38
40
  if path.nil?
39
41
  path = filename
40
42
  elsif File.directory?(path)
@@ -36,6 +36,12 @@ class ArtifactTest < Minitest::Test
36
36
  assert File.exist?('appends_extension.jpeg')
37
37
  end
38
38
 
39
+ def test_artifact_save_rejects_parent_directory_traversal
40
+ error = assert_raises(ArgumentError) { @artifact.save('../escaped') }
41
+
42
+ assert_equal('path cannot contain parent directory traversal', error.message)
43
+ end
44
+
39
45
  def test_artifact_base64
40
46
  assert_equal(Base64.encode64('test'), @artifact.base64)
41
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kleya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hellotext