obfs 0.0.2 → 0.0.3
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 +4 -4
- data/lib/obfs.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25399ce3e5a530c99396f3fdf5208f33f32d65e043a4a78a9f1775c403db0718
|
4
|
+
data.tar.gz: 4c4eba2a6208251e709c6b650263e9a73dacb63f7bfdd324e5a978de0393606c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f53fe3231e3ad87617989b23eca24e9834024903276486b775e7afbaffae3ee01e7b0dd9e6b725ab51c2b40ba939fef3638e976a0eb83399b098a4a270256b
|
7
|
+
data.tar.gz: 14d216f77c45e53708432307856e578492ff1d667f86fe7c1ebb80a387433afa1ef694f0842b7f10f0b1c26219c30da51893febc0b2122d3eda752c62aeed95e
|
data/lib/obfs.rb
CHANGED
@@ -19,6 +19,9 @@ class OBFS
|
|
19
19
|
dataA = args[0]
|
20
20
|
dataB = args[1]
|
21
21
|
|
22
|
+
# prevent traversing out of dir
|
23
|
+
raise "traversal through . and .. not allowed" if ['.', '..'].include? method_name
|
24
|
+
|
22
25
|
# setter call
|
23
26
|
if method_name.end_with?('=')
|
24
27
|
|
@@ -33,6 +36,9 @@ class OBFS
|
|
33
36
|
method_name = m.to_s.gsub('=','')
|
34
37
|
data = args[0]
|
35
38
|
end
|
39
|
+
|
40
|
+
# prevent traversing out of dir
|
41
|
+
raise "traversal through . and .. not allowed" if ['.', '..'].include? method_name
|
36
42
|
|
37
43
|
# write data
|
38
44
|
if data == nil
|
@@ -47,6 +53,10 @@ class OBFS
|
|
47
53
|
elsif method_name == "[]"
|
48
54
|
|
49
55
|
method_name = dataA.to_s.gsub(/\["/,'').gsub(/"\]/,'')
|
56
|
+
|
57
|
+
# prevent traversing out of dir
|
58
|
+
raise "traversal through . and .. not allowed" if ['.', '..'].include? method_name
|
59
|
+
|
50
60
|
if (!File.directory? File.join(@path, method_name)) && (File.exist? File.join(@path, method_name))
|
51
61
|
read(@path, method_name)
|
52
62
|
else
|
@@ -55,6 +65,9 @@ class OBFS
|
|
55
65
|
|
56
66
|
# recurse or read
|
57
67
|
else
|
68
|
+
|
69
|
+
# prevent traversing out of dir
|
70
|
+
raise "traversal through . and .. not allowed" if ['.', '..'].include? method_name
|
58
71
|
|
59
72
|
if (!File.directory? File.join(@path, method_name)) && (File.exist? File.join(@path, method_name))
|
60
73
|
read(@path, method_name)
|