Class: QueryGuard::Analyzers::SelectStarAnalyzer
- Defined in:
- lib/query_guard/analyzers/select_star_analyzer.rb
Overview
Detects SELECT * statements.
Constant Summary collapse
- SELECT_STAR_PATTERN =
/\bSELECT\s+\*/i.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #analyze(context, config) ⇒ Object
-
#initialize ⇒ SelectStarAnalyzer
constructor
A new instance of SelectStarAnalyzer.
Methods inherited from Base
Constructor Details
#initialize ⇒ SelectStarAnalyzer
Returns a new instance of SelectStarAnalyzer.
9 10 11 |
# File 'lib/query_guard/analyzers/select_star_analyzer.rb', line 9 def initialize super(:select_star) end |
Instance Method Details
#analyze(context, config) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/query_guard/analyzers/select_star_analyzer.rb', line 13 def analyze(context, config) findings = [] return findings unless config.block_select_star context.queries.each do |query| next unless matches_select_star?(query.sql) next if exceeds_ignored_sql?(query.sql, config) findings << Core::FindingBuilders.select_star( query, severity: config.select_star_severity || :warn ) end findings end |