tainted 0.2.0 → 0.3.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/README.md +7 -2
- data/lib/tainted/lint.rb +1 -1
- data/lib/tainted/offense.rb +12 -0
- data/lib/tainted/static.rb +3 -3
- data/lib/tainted/version.rb +1 -1
- data/lib/tainted.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 278da9234147c4a8df18795ca9666877032253e8cb4409219ba0fd8e4420444b
|
4
|
+
data.tar.gz: 16e24fa14406e9755b3f631809a23a13fcf255605b5f6a2f66fc60d27ecee27a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1fdc6834f8e8727e6e7fa0328ddd4193d4a7433f3c020f16eacaa6d63ef61f96b682a7a7e8b34db7e39d28a4554c77373d96467bb3a9cab8b8b00348d4b0fd0
|
7
|
+
data.tar.gz: 96b9a1687308bed7f57317dd66ece9eca69a7d0e2a7544cc8e40861017911d447aa11244daf44d5e3d27620358e80150e117b008c3a7a97b76e633608ff73f31
|
data/README.md
CHANGED
@@ -29,8 +29,13 @@ require 'tainted'
|
|
29
29
|
file = "#{__dir__}/../fixtures/simple.rb"
|
30
30
|
lint = Tainted::Lint.new(file, %i[tainted], %i[unsafe])
|
31
31
|
lint.analyze
|
32
|
-
|
33
|
-
|
32
|
+
=>
|
33
|
+
[#<Tainted::Offense:0x0000000107caf690
|
34
|
+
@message="Method `unsafe()` consuming tainted variable `d`",
|
35
|
+
@node=(call nil nil (ident "unsafe") (arg_paren (args ((var_ref (ident "d"))))))>,
|
36
|
+
#<Tainted::Offense:0x0000000107caf5f0
|
37
|
+
@message="Method `unsafe()` consuming tainted variable `c`",
|
38
|
+
@node=(call nil nil (ident "unsafe") (arg_paren (args ((var_ref (ident "c"))))))>]
|
34
39
|
```
|
35
40
|
|
36
41
|
## Development
|
data/lib/tainted/lint.rb
CHANGED
data/lib/tainted/static.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Tainted
|
4
4
|
class Static < SyntaxTree::Visitor
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :offenses
|
6
6
|
|
7
7
|
def initialize(sources, sinks)
|
8
8
|
super()
|
9
9
|
|
10
10
|
@sources = sources
|
11
11
|
@sinks = sinks
|
12
|
-
@
|
12
|
+
@offenses = []
|
13
13
|
end
|
14
14
|
|
15
15
|
def visit(node)
|
@@ -58,7 +58,7 @@ module Tainted
|
|
58
58
|
taint_statuses.each do |status|
|
59
59
|
next unless status[1]
|
60
60
|
|
61
|
-
@
|
61
|
+
@offenses << Offense.new(node, "Method `#{method_name}()` consuming tainted variable `#{status[0].value.value}`")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
data/lib/tainted/version.rb
CHANGED
data/lib/tainted.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.3.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-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- lib/tainted.rb
|
27
27
|
- lib/tainted/dataflow.rb
|
28
28
|
- lib/tainted/lint.rb
|
29
|
+
- lib/tainted/offense.rb
|
29
30
|
- lib/tainted/state.rb
|
30
31
|
- lib/tainted/static.rb
|
31
32
|
- lib/tainted/version.rb
|