tainted 0.1.0 → 0.2.0
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/Rakefile +1 -1
- data/lib/tainted/lint.rb +1 -1
- data/lib/tainted/static.rb +14 -4
- data/lib/tainted/version.rb +1 -1
- metadata +2 -3
- data/fixtures/simple.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d61982c033f50c5e79a00dc34ef94fe612400097ef70e2e934d6def3f28cfac
|
4
|
+
data.tar.gz: 55314168a8b4a3026e4c0cf9c9c61adcd277ed306ef656078b29f9930cff8dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a211a22a04214a44ddb858930a69af6014f2c18aeb23c86c63ebcfbb8034f6f2da2d2f541088314fed8a0a59eb2a410ea9a9ca9e5527a89bef08e168a60eac5d
|
7
|
+
data.tar.gz: 1da46aac7509d85177687d1b4f1ab06824d6f7e944c2404dfc249cffe17c3cf9eb29b9470ca7914df86b113c8134655ee5a06e6c533a3164544fa4e6935b179e
|
data/Rakefile
CHANGED
data/lib/tainted/lint.rb
CHANGED
data/lib/tainted/static.rb
CHANGED
@@ -4,10 +4,11 @@ module Tainted
|
|
4
4
|
class Static < SyntaxTree::Visitor
|
5
5
|
attr_reader :result
|
6
6
|
|
7
|
-
def initialize(sources,
|
7
|
+
def initialize(sources, sinks)
|
8
8
|
super()
|
9
9
|
|
10
10
|
@sources = sources
|
11
|
+
@sinks = sinks
|
11
12
|
@result = []
|
12
13
|
end
|
13
14
|
|
@@ -29,10 +30,17 @@ module Tainted
|
|
29
30
|
|
30
31
|
def parse_assign(node)
|
31
32
|
variable_name = node.target.value.value
|
32
|
-
# pp node.value.class
|
33
|
-
return unless node.value.is_a?(SyntaxTree::CallNode)
|
34
33
|
|
35
|
-
method_name =
|
34
|
+
method_name =
|
35
|
+
case node.value
|
36
|
+
when SyntaxTree::CallNode
|
37
|
+
node.value.message.value
|
38
|
+
when SyntaxTree::ARef
|
39
|
+
# (aref (vcall (ident "<method_name>")))
|
40
|
+
node.value.collection.value.value
|
41
|
+
end
|
42
|
+
|
43
|
+
return if method_name.nil?
|
36
44
|
return unless @sources.include?(method_name&.to_sym)
|
37
45
|
|
38
46
|
State.instance.var_dependencies[variable_name.to_sym][:tainted] = true
|
@@ -45,6 +53,8 @@ module Tainted
|
|
45
53
|
arguments.map { |arg| [arg, taint_status(arg.value.value.to_sym)] }
|
46
54
|
|
47
55
|
method_name = node.message.value
|
56
|
+
return unless @sinks.include?(method_name.to_sym)
|
57
|
+
|
48
58
|
taint_statuses.each do |status|
|
49
59
|
next unless status[1]
|
50
60
|
|
data/lib/tainted/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tainted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syed Faraaz Ahmad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -23,7 +23,6 @@ files:
|
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.md
|
25
25
|
- Rakefile
|
26
|
-
- fixtures/simple.rb
|
27
26
|
- lib/tainted.rb
|
28
27
|
- lib/tainted/dataflow.rb
|
29
28
|
- lib/tainted/lint.rb
|