Class: Sanctify::Scanner
- Inherits:
-
Object
- Object
- Sanctify::Scanner
- Defined in:
- lib/sanctify/scanner.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#matcher_list ⇒ Object
readonly
Returns the value of attribute matcher_list.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(args) ⇒ Scanner
constructor
A new instance of Scanner.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Scanner
8 9 10 11 12 |
# File 'lib/sanctify/scanner.rb', line 8 def initialize(args) @config = args[:config] || {} @repo = Repo.new(args, ignored_paths) @matcher_list = MatcherList.new end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/sanctify/scanner.rb', line 7 def config @config end |
#matcher_list ⇒ Object (readonly)
Returns the value of attribute matcher_list.
7 8 9 |
# File 'lib/sanctify/scanner.rb', line 7 def matcher_list @matcher_list end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
7 8 9 |
# File 'lib/sanctify/scanner.rb', line 7 def repo @repo end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sanctify/scanner.rb', line 14 def run initialize_custom_matchers! repo.added_lines.each do |line, path| matcher_list.each do |matcher| if matcher[:regex].match(line) raise ScannerError, "[ERROR] SECRET FOUND (#{matcher[:description]}): #{line} : #{path}" end end end puts "SUCCESS! No Secrets Found in #{repo.path}" end |