Module: Scryer
- Defined in:
- lib/scryer/minitest.rb,
lib/scryer.rb,
lib/scryer/ast.rb,
lib/scryer/cli.rb,
lib/scryer/rule.rb,
lib/scryer/finding.rb,
lib/scryer/railtie.rb,
lib/scryer/scanner.rb,
lib/scryer/version.rb,
lib/scryer/baseline.rb,
lib/scryer/rule_set.rb,
lib/scryer/ai_client.rb,
lib/scryer/fix_verifier.rb,
lib/scryer/query_watcher.rb,
lib/scryer/cache_extractor.rb,
lib/scryer/query_extractor.rb,
lib/scryer/report_renderer.rb,
lib/scryer/rules/idor_rule.rb,
lib/scryer/rules/ssrf_rule.rb,
lib/scryer/ai_fix_suggester.rb,
lib/scryer/dependency_audit.rb,
lib/scryer/method_extractor.rb,
lib/scryer/duplicate_detector.rb,
lib/scryer/rules/force_ssl_rule.rb,
lib/scryer/authorization_watcher.rb,
lib/scryer/rules/weak_crypto_rule.rb,
lib/scryer/rules/jwt_insecure_rule.rb,
lib/scryer/rules/open_redirect_rule.rb,
lib/scryer/rules/sql_injection_rule.rb,
lib/scryer/rules/job_raw_params_rule.rb,
lib/scryer/rules/path_traversal_rule.rb,
lib/scryer/rules/csrf_protection_rule.rb,
lib/scryer/rules/mass_assignment_rule.rb,
lib/scryer/rules/xss_unsafe_html_rule.rb,
lib/scryer/rules/hardcoded_secret_rule.rb,
lib/scryer/rules/security_headers_rule.rb,
lib/generators/scryer/install_generator.rb,
lib/scryer/rules/command_injection_rule.rb,
lib/scryer/rules/weak_session_cookie_rule.rb,
lib/scryer/rules/hardcoded_basic_auth_rule.rb,
lib/scryer/rules/missing_policy_scope_rule.rb,
lib/scryer/rules/authentication_bypass_rule.rb,
lib/scryer/rules/cors_misconfiguration_rule.rb,
lib/scryer/rules/missing_authorization_rule.rb,
lib/scryer/rules/unsafe_deserialization_rule.rb,
lib/scryer/rules/hardcoded_secret_key_base_rule.rb,
lib/scryer/rules/insecure_cookie_serializer_rule.rb,
lib/scryer/rules/consider_all_requests_local_rule.rb,
lib/scryer/rules/host_authorization_disabled_rule.rb,
lib/scryer/style_rules/frozen_string_literal_rule.rb,
lib/scryer/performance_rules/n_plus_one_query_rule.rb,
lib/scryer/rules/graphql_missing_query_limits_rule.rb,
lib/scryer/rules/verbose_production_log_level_rule.rb,
lib/scryer/performance_rules/missing_pagination_rule.rb,
lib/scryer/rules/action_cable_forgery_protection_rule.rb,
lib/scryer/performance_rules/unbounded_table_scan_rule.rb,
lib/scryer/performance_rules/inefficient_save_loop_rule.rb,
lib/scryer/rules/active_storage_inline_disposition_rule.rb,
lib/scryer/rules/active_storage_missing_content_type_validation_rule.rb
Overview
Opt-in Minitest integration — require this file yourself (e.g. require "scryer/minitest" in test_helper.rb) rather than it loading automatically
with the gem; same reasoning as lib/scryer/rspec.rb (Minitest is never a
Scryer runtime dependency, and this file's assertions only make sense once
the host app's own test framework is already loaded).
Mix Scryer::MinitestAssertions into a Minitest::Test (or ActiveSupport::TestCase, which is one) to assert this app's own security scan stays clean as part of its normal test suite:
class SecurityTest < ActiveSupport::TestCase
include Scryer::MinitestAssertions
test "no critical findings" do
assert_no_critical_scryer_findings(Scryer.scan(root: Rails.root.to_s))
end
test "the mass-assignment bug fixed in PR #123 doesn't come back" do
assert_no_scryer_findings_for(Scryer.scan(root: Rails.root.to_s), "mass_assignment")
end
end
Defined Under Namespace
Modules: Ast, Baseline, CacheExtractor, FixVerifier, Generators, MethodExtractor, MinitestAssertions, PerformanceRules, QueryExtractor, RuleSet, Rules Classes: AiClient, AiFixSuggester, AuthorizationWatcher, CLI, CacheCallInfo, Configuration, DependencyAudit, DuplicateDetector, Finding, MethodInfo, QueryWatcher, Railtie, ReportRenderer, Rule, Scanner
Constant Summary collapse
- VERSION =
"1.1.0"
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
-
.scan(root:, dirs: configuration.dirs, skip_rules: configuration.skip_rules) ⇒ Object
Runs the static scan with the current configuration (or explicit overrides) applied, without needing to know Scanner's own constructor shape.
Class Method Details
.configuration ⇒ Object
55 56 57 |
# File 'lib/scryer.rb', line 55 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
51 52 53 |
# File 'lib/scryer.rb', line 51 def configure yield configuration end |
.scan(root:, dirs: configuration.dirs, skip_rules: configuration.skip_rules) ⇒ Object
Runs the static scan with the current configuration (or explicit
overrides) applied, without needing to know Scanner's own constructor
shape. Exists mainly so the RSpec/Minitest test helpers (see
lib/scryer/rspec.rb / lib/scryer/minitest.rb) — and any other future
caller that just wants "the result of a normal scan" — don't each
duplicate Scanner.new(root:, dirs:, skip_rules:).call. The CLI/rake
task aren't changed to use this (they also handle dependency auditing,
baselines, and report writing inline) — this is for callers that only
need the static-scan Result itself.
68 69 70 |
# File 'lib/scryer.rb', line 68 def scan(root:, dirs: configuration.dirs, skip_rules: configuration.skip_rules) Scryer::Scanner.new(root: root, dirs: dirs, skip_rules: skip_rules).call end |