Class: Olyx::Guardrails::Secrets::Blocked

Inherits:
Guardrails::Blocked
  • Object
show all
Defined in:
lib/olyx/guardrails/secrets/blocked.rb

Overview

Raised by SecretScanner.scan! when secret findings make input unsafe. A Guardrails::Blocked subclass so callers can rescue either the specific findings here or the shared Blocked contract uniformly.

Constant Summary collapse

DECISION =

Decision shape mirrors Rails::ResultSummary's keys so any handler rescuing the shared Blocked contract can read them uniformly, even though this low-level raise site never ran a full policy decision.

{
  policy_name: nil,
  allowed: false,
  risk_score: nil,
  violations: ['secret_leaked'].freeze,
  policy_rules: [].freeze
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(findings) ⇒ Blocked

Returns a new instance of Blocked.



25
26
27
28
# File 'lib/olyx/guardrails/secrets/blocked.rb', line 25

def initialize(findings)
  @findings = findings
  super(DECISION, 'Response blocked: secret leakage detected')
end

Instance Attribute Details

#findingsObject (readonly)

Returns the value of attribute findings.



23
24
25
# File 'lib/olyx/guardrails/secrets/blocked.rb', line 23

def findings
  @findings
end