Class: Scryer::Rule
- Inherits:
-
Object
- Object
- Scryer::Rule
- Defined in:
- lib/scryer/rule.rb
Overview
Base class for a single detection rule. Subclasses implement #scan and
return an Array of Finding. Every rule gets the parsed sexp tree (so it
doesn't have to re-parse), the raw source (for snippet extraction), and
the relative file path (for reporting).
Direct Known Subclasses
PerformanceRules::InefficientSaveLoopRule, PerformanceRules::MissingPaginationRule, PerformanceRules::NPlusOneQueryRule, PerformanceRules::UnboundedTableScanRule, Scryer::Rules::ActionCableForgeryProtectionRule, Scryer::Rules::ActiveStorageInlineDispositionRule, Scryer::Rules::ActiveStorageMissingContentTypeValidationRule, Scryer::Rules::AuthenticationBypassRule, Scryer::Rules::CommandInjectionRule, Scryer::Rules::CorsMisconfigurationRule, Scryer::Rules::CsrfProtectionRule, Scryer::Rules::ForceSslRule, Scryer::Rules::FrozenStringLiteralRule, Scryer::Rules::GraphqlMissingQueryLimitsRule, Scryer::Rules::HardcodedBasicAuthRule, Scryer::Rules::HardcodedSecretKeyBaseRule, Scryer::Rules::HardcodedSecretRule, Scryer::Rules::IdorRule, Scryer::Rules::InsecureCookieSerializerRule, Scryer::Rules::JobRawParamsRule, Scryer::Rules::JwtInsecureRule, Scryer::Rules::MassAssignmentRule, Scryer::Rules::OpenRedirectRule, Scryer::Rules::PathTraversalRule, Scryer::Rules::SecurityHeadersRule, Scryer::Rules::SqlInjectionRule, Scryer::Rules::SsrfRule, Scryer::Rules::UnsafeDeserializationRule, Scryer::Rules::WeakCryptoRule, Scryer::Rules::WeakSessionCookieRule, Scryer::Rules::XssUnsafeHtmlRule
Class Attribute Summary collapse
-
.category ⇒ Object
Returns the value of attribute category.
-
.default_severity ⇒ Object
Returns the value of attribute default_severity.
-
.rule_id ⇒ Object
Returns the value of attribute rule_id.
-
.title ⇒ Object
Returns the value of attribute title.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#sexp ⇒ Object
readonly
Returns the value of attribute sexp.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file:, source:, sexp:) ⇒ Rule
constructor
A new instance of Rule.
- #scan ⇒ Object
Constructor Details
#initialize(file:, source:, sexp:) ⇒ Rule
Returns a new instance of Rule.
16 17 18 19 20 |
# File 'lib/scryer/rule.rb', line 16 def initialize(file:, source:, sexp:) @file = file @source = source @sexp = sexp end |
Class Attribute Details
.category ⇒ Object
Returns the value of attribute category.
8 9 10 |
# File 'lib/scryer/rule.rb', line 8 def category @category end |
.default_severity ⇒ Object
Returns the value of attribute default_severity.
8 9 10 |
# File 'lib/scryer/rule.rb', line 8 def default_severity @default_severity end |
.rule_id ⇒ Object
Returns the value of attribute rule_id.
8 9 10 |
# File 'lib/scryer/rule.rb', line 8 def rule_id @rule_id end |
.title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/scryer/rule.rb', line 8 def title @title end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
22 23 24 |
# File 'lib/scryer/rule.rb', line 22 def file @file end |
#sexp ⇒ Object (readonly)
Returns the value of attribute sexp.
22 23 24 |
# File 'lib/scryer/rule.rb', line 22 def sexp @sexp end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
22 23 24 |
# File 'lib/scryer/rule.rb', line 22 def source @source end |
Class Method Details
Instance Method Details
#scan ⇒ Object
24 25 26 |
# File 'lib/scryer/rule.rb', line 24 def scan raise NotImplementedError, "#{self.class} must implement #scan" end |