lib/mihari/schemas/rule.rb in mihari-3.2.0 vs lib/mihari/schemas/rule.rb in mihari-3.3.0
- old
+ new
@@ -61,12 +61,23 @@
optional(:updated_on).value(:date)
required(:queries).value(:array).each { Analyzer | Spyse | ZoomEye | Urlscan | Crtsh }
optional(:allowed_data_types).value(array[DataTypes]).default(ALLOWED_DATA_TYPES)
+ optional(:disallowed_data_values).value(array[:string]).default([])
end
class RuleContract < Dry::Validation::Contract
+ include Mihari::Mixins::DisallowedDataValue
+
params(Rule)
+
+ rule(:disallowed_data_values) do
+ value.each do |v|
+ unless valid_disallowed_data_value?(v)
+ key.failure("#{v} is not a valid format.")
+ end
+ end
+ end
end
end
end