olyx-guardrails 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +117 -0
- data/CODE_OF_CONDUCT.md +28 -0
- data/CONTRIBUTING.md +63 -0
- data/LICENSE +134 -0
- data/README.md +611 -0
- data/SECURITY.md +35 -0
- data/docs/API.md +460 -0
- data/examples/claude_analyzer.rb +53 -0
- data/examples/custom_policy.rb +41 -0
- data/examples/notifier.rb +37 -0
- data/examples/openai_analyzer.rb +45 -0
- data/examples/rails_opt_in.rb +99 -0
- data/examples/ruby_only.rb +53 -0
- data/lib/generators/olyx_guardrails/install_generator.rb +22 -0
- data/lib/generators/olyx_guardrails/templates/initializer.rb.tt +16 -0
- data/lib/generators/olyx_guardrails/templates/policy.yml.tt +41 -0
- data/lib/olyx/guardrails/ai/analysis_normalizer.rb +26 -0
- data/lib/olyx/guardrails/ai/analysis_pipeline.rb +26 -0
- data/lib/olyx/guardrails/ai/boolean_validator.rb +18 -0
- data/lib/olyx/guardrails/ai/flag_finding_merger.rb +16 -0
- data/lib/olyx/guardrails/ai/result_sanitizer.rb +29 -0
- data/lib/olyx/guardrails/ai/secret_finding_merger.rb +19 -0
- data/lib/olyx/guardrails/ai/standard_finding_merger.rb +24 -0
- data/lib/olyx/guardrails/ai_analysis.rb +29 -0
- data/lib/olyx/guardrails/ai_context_builder.rb +32 -0
- data/lib/olyx/guardrails/ai_failure_handler.rb +17 -0
- data/lib/olyx/guardrails/ai_finding_merger.rb +30 -0
- data/lib/olyx/guardrails/check_analyzer.rb +26 -0
- data/lib/olyx/guardrails/check_base_result.rb +32 -0
- data/lib/olyx/guardrails/check_pipeline.rb +17 -0
- data/lib/olyx/guardrails/check_result_builder.rb +24 -0
- data/lib/olyx/guardrails/check_runner.rb +42 -0
- data/lib/olyx/guardrails/check_set.rb +33 -0
- data/lib/olyx/guardrails/checks/injection_check.rb +20 -0
- data/lib/olyx/guardrails/checks/injection_result.rb +22 -0
- data/lib/olyx/guardrails/checks/length_check.rb +18 -0
- data/lib/olyx/guardrails/checks/message_injection_check.rb +19 -0
- data/lib/olyx/guardrails/checks/pii_check.rb +19 -0
- data/lib/olyx/guardrails/checks/policy_check.rb +26 -0
- data/lib/olyx/guardrails/checks/secret_check.rb +30 -0
- data/lib/olyx/guardrails/checks/skipped_checks.rb +26 -0
- data/lib/olyx/guardrails/enum_value.rb +20 -0
- data/lib/olyx/guardrails/errors.rb +22 -0
- data/lib/olyx/guardrails/injection_detector.rb +27 -0
- data/lib/olyx/guardrails/injection_patterns.rb +44 -0
- data/lib/olyx/guardrails/integrations/openai/analyzer_setup.rb +21 -0
- data/lib/olyx/guardrails/integrations/openai/configuration_resolver.rb +28 -0
- data/lib/olyx/guardrails/integrations/openai/dependency_contracts.rb +28 -0
- data/lib/olyx/guardrails/integrations/openai/input_builder.rb +39 -0
- data/lib/olyx/guardrails/integrations/openai/member_reader.rb +21 -0
- data/lib/olyx/guardrails/integrations/openai/model_identifier.rb +28 -0
- data/lib/olyx/guardrails/integrations/openai/refusal_guard.rb +28 -0
- data/lib/olyx/guardrails/integrations/openai/request_builder.rb +36 -0
- data/lib/olyx/guardrails/integrations/openai/request_configuration.rb +25 -0
- data/lib/olyx/guardrails/integrations/openai/request_values.rb +33 -0
- data/lib/olyx/guardrails/integrations/openai/response_contents.rb +22 -0
- data/lib/olyx/guardrails/integrations/openai/response_option_keys.rb +32 -0
- data/lib/olyx/guardrails/integrations/openai/response_options.rb +23 -0
- data/lib/olyx/guardrails/integrations/openai/schema_registry.rb +46 -0
- data/lib/olyx/guardrails/integrations/openai/sdk.rb +26 -0
- data/lib/olyx/guardrails/integrations/openai/signal_summary.rb +40 -0
- data/lib/olyx/guardrails/integrations/openai_analyzer.rb +107 -0
- data/lib/olyx/guardrails/integrations/openai_analyzer_configuration.rb +38 -0
- data/lib/olyx/guardrails/integrations/openai_response_parser.rb +34 -0
- data/lib/olyx/guardrails/message_check_runner.rb +24 -0
- data/lib/olyx/guardrails/message_check_set.rb +20 -0
- data/lib/olyx/guardrails/message_content.rb +27 -0
- data/lib/olyx/guardrails/message_source.rb +16 -0
- data/lib/olyx/guardrails/multi_turn_injection_detector.rb +18 -0
- data/lib/olyx/guardrails/multi_turn_pair_scanner.rb +35 -0
- data/lib/olyx/guardrails/multi_turn_variant_pairs.rb +25 -0
- data/lib/olyx/guardrails/notification/base_event.rb +35 -0
- data/lib/olyx/guardrails/notification/deep_freezer.rb +25 -0
- data/lib/olyx/guardrails/notification/delivery_dispatcher.rb +38 -0
- data/lib/olyx/guardrails/notification/delivery_summary.rb +17 -0
- data/lib/olyx/guardrails/notification/handler.rb +33 -0
- data/lib/olyx/guardrails/notification/handler_collection.rb +25 -0
- data/lib/olyx/guardrails/notification/handler_collection_validator.rb +23 -0
- data/lib/olyx/guardrails/notification/key.rb +19 -0
- data/lib/olyx/guardrails/notification/metadata.rb +34 -0
- data/lib/olyx/guardrails/notification/notifier_setup.rb +19 -0
- data/lib/olyx/guardrails/notification/preview.rb +27 -0
- data/lib/olyx/guardrails/notification/scrubber.rb +22 -0
- data/lib/olyx/guardrails/notification/violation_labels.rb +19 -0
- data/lib/olyx/guardrails/notification_event_builder.rb +41 -0
- data/lib/olyx/guardrails/notification_sanitizer.rb +33 -0
- data/lib/olyx/guardrails/notifier.rb +53 -0
- data/lib/olyx/guardrails/notifier_configuration.rb +30 -0
- data/lib/olyx/guardrails/pii/ambiguous_numeric_date.rb +32 -0
- data/lib/olyx/guardrails/pii/block_scrubber.rb +31 -0
- data/lib/olyx/guardrails/pii/content_scrubber.rb +33 -0
- data/lib/olyx/guardrails/pii/date_validator.rb +25 -0
- data/lib/olyx/guardrails/pii/hash_key.rb +19 -0
- data/lib/olyx/guardrails/pii/iban_remainder.rb +25 -0
- data/lib/olyx/guardrails/pii/iban_validator.rb +34 -0
- data/lib/olyx/guardrails/pii/ipv4_validator.rb +17 -0
- data/lib/olyx/guardrails/pii/ipv6_validator.rb +20 -0
- data/lib/olyx/guardrails/pii/luhn_checksum.rb +29 -0
- data/lib/olyx/guardrails/pii/luhn_validator.rb +21 -0
- data/lib/olyx/guardrails/pii/message_scrubber.rb +31 -0
- data/lib/olyx/guardrails/pii/named_date_validator.rb +28 -0
- data/lib/olyx/guardrails/pii/numeric_date_validator.rb +26 -0
- data/lib/olyx/guardrails/pii/pattern_catalog.rb +41 -0
- data/lib/olyx/guardrails/pii/sin_validator.rb +24 -0
- data/lib/olyx/guardrails/pii/ssn_validator.rb +21 -0
- data/lib/olyx/guardrails/pii/text_scrubber.rb +28 -0
- data/lib/olyx/guardrails/pii/year_first_date.rb +18 -0
- data/lib/olyx/guardrails/pii_scrubber.rb +23 -0
- data/lib/olyx/guardrails/pii_validators.rb +26 -0
- data/lib/olyx/guardrails/policy/ai_failure_mode.rb +15 -0
- data/lib/olyx/guardrails/policy/configuration.rb +62 -0
- data/lib/olyx/guardrails/policy/configuration_hash.rb +20 -0
- data/lib/olyx/guardrails/policy/finding_order.rb +20 -0
- data/lib/olyx/guardrails/policy/finding_presenter.rb +41 -0
- data/lib/olyx/guardrails/policy/match_collector.rb +20 -0
- data/lib/olyx/guardrails/policy/name.rb +23 -0
- data/lib/olyx/guardrails/policy/normalized_pattern_matcher.rb +34 -0
- data/lib/olyx/guardrails/policy/pattern_matcher.rb +19 -0
- data/lib/olyx/guardrails/policy/redaction_result.rb +20 -0
- data/lib/olyx/guardrails/policy/redaction_spans.rb +32 -0
- data/lib/olyx/guardrails/policy/rule_collection.rb +34 -0
- data/lib/olyx/guardrails/policy/rule_matcher.rb +29 -0
- data/lib/olyx/guardrails/policy/rule_normalizer.rb +21 -0
- data/lib/olyx/guardrails/policy/scan_result.rb +21 -0
- data/lib/olyx/guardrails/policy/secret_pattern_collection.rb +22 -0
- data/lib/olyx/guardrails/policy/unmatched_segment_builder.rb +28 -0
- data/lib/olyx/guardrails/policy/unmatched_transformer.rb +20 -0
- data/lib/olyx/guardrails/policy.rb +46 -0
- data/lib/olyx/guardrails/policy_aware_redactor.rb +42 -0
- data/lib/olyx/guardrails/policy_redactor.rb +28 -0
- data/lib/olyx/guardrails/policy_rule/configuration.rb +46 -0
- data/lib/olyx/guardrails/policy_rule/description_value.rb +24 -0
- data/lib/olyx/guardrails/policy_rule/match_mode.rb +15 -0
- data/lib/olyx/guardrails/policy_rule/name_value.rb +22 -0
- data/lib/olyx/guardrails/policy_rule/pattern_compiler.rb +28 -0
- data/lib/olyx/guardrails/policy_rule/regexp_compiler.rb +31 -0
- data/lib/olyx/guardrails/policy_rule/replacement_value.rb +26 -0
- data/lib/olyx/guardrails/policy_rule/term_compiler.rb +33 -0
- data/lib/olyx/guardrails/policy_rule/text_values.rb +23 -0
- data/lib/olyx/guardrails/policy_rule/values.rb +33 -0
- data/lib/olyx/guardrails/policy_rule.rb +30 -0
- data/lib/olyx/guardrails/policy_scanner.rb +44 -0
- data/lib/olyx/guardrails/rails/action_cable.rb +21 -0
- data/lib/olyx/guardrails/rails/active_job_handler.rb +27 -0
- data/lib/olyx/guardrails/rails/active_model_validator.rb +23 -0
- data/lib/olyx/guardrails/rails/check_telemetry.rb +19 -0
- data/lib/olyx/guardrails/rails/configuration.rb +68 -0
- data/lib/olyx/guardrails/rails/configuration_finalizer.rb +30 -0
- data/lib/olyx/guardrails/rails/configuration_registry.rb +41 -0
- data/lib/olyx/guardrails/rails/configuration_values.rb +30 -0
- data/lib/olyx/guardrails/rails/constant_resolver.rb +18 -0
- data/lib/olyx/guardrails/rails/controller.rb +34 -0
- data/lib/olyx/guardrails/rails/controller_metadata.rb +22 -0
- data/lib/olyx/guardrails/rails/decision_service.rb +26 -0
- data/lib/olyx/guardrails/rails/enforcer.rb +33 -0
- data/lib/olyx/guardrails/rails/evaluation_lifecycle.rb +23 -0
- data/lib/olyx/guardrails/rails/evaluation_service.rb +12 -0
- data/lib/olyx/guardrails/rails/filter_parameters.rb +26 -0
- data/lib/olyx/guardrails/rails/graphql.rb +21 -0
- data/lib/olyx/guardrails/rails/ingress.rb +26 -0
- data/lib/olyx/guardrails/rails/input_runtime.rb +25 -0
- data/lib/olyx/guardrails/rails/instrumentation.rb +39 -0
- data/lib/olyx/guardrails/rails/instrumentation_payloads.rb +25 -0
- data/lib/olyx/guardrails/rails/instrumentation_publisher.rb +24 -0
- data/lib/olyx/guardrails/rails/integration_configuration.rb +27 -0
- data/lib/olyx/guardrails/rails/job.rb +37 -0
- data/lib/olyx/guardrails/rails/job_argument.rb +41 -0
- data/lib/olyx/guardrails/rails/job_reference.rb +36 -0
- data/lib/olyx/guardrails/rails/message_evaluation_service.rb +13 -0
- data/lib/olyx/guardrails/rails/message_runtime.rb +20 -0
- data/lib/olyx/guardrails/rails/notification_dispatcher.rb +22 -0
- data/lib/olyx/guardrails/rails/output_runtime.rb +26 -0
- data/lib/olyx/guardrails/rails/path_value.rb +30 -0
- data/lib/olyx/guardrails/rails/policy_configuration.rb +25 -0
- data/lib/olyx/guardrails/rails/policy_document.rb +40 -0
- data/lib/olyx/guardrails/rails/policy_file.rb +29 -0
- data/lib/olyx/guardrails/rails/policy_file_error.rb +25 -0
- data/lib/olyx/guardrails/rails/policy_rule_names.rb +19 -0
- data/lib/olyx/guardrails/rails/policy_yaml.rb +22 -0
- data/lib/olyx/guardrails/rails/queue_name.rb +21 -0
- data/lib/olyx/guardrails/rails/redaction_payload.rb +36 -0
- data/lib/olyx/guardrails/rails/redaction_service.rb +21 -0
- data/lib/olyx/guardrails/rails/result_summary.rb +36 -0
- data/lib/olyx/guardrails/rails/runtime.rb +30 -0
- data/lib/olyx/guardrails/rails/timer.rb +27 -0
- data/lib/olyx/guardrails/rails/upload.rb +34 -0
- data/lib/olyx/guardrails/rails.rb +35 -0
- data/lib/olyx/guardrails/railtie.rb +19 -0
- data/lib/olyx/guardrails/redaction/content_result.rb +32 -0
- data/lib/olyx/guardrails/redaction/input_validator.rb +17 -0
- data/lib/olyx/guardrails/redaction/public_result.rb +23 -0
- data/lib/olyx/guardrails/redaction/unrestricted_text.rb +17 -0
- data/lib/olyx/guardrails/redactor.rb +29 -0
- data/lib/olyx/guardrails/risk/ai_score.rb +19 -0
- data/lib/olyx/guardrails/risk/check_weights.rb +18 -0
- data/lib/olyx/guardrails/risk/deterministic_score.rb +20 -0
- data/lib/olyx/guardrails/risk/weights.rb +18 -0
- data/lib/olyx/guardrails/risk_scorer.rb +28 -0
- data/lib/olyx/guardrails/secret_finding_collector.rb +31 -0
- data/lib/olyx/guardrails/secret_scanner.rb +42 -0
- data/lib/olyx/guardrails/secrets/blocked.rb +17 -0
- data/lib/olyx/guardrails/secrets/catalog_source.rb +28 -0
- data/lib/olyx/guardrails/secrets/cloud_credential_patterns.rb +16 -0
- data/lib/olyx/guardrails/secrets/confidentiality_source.rb +21 -0
- data/lib/olyx/guardrails/secrets/custom_pattern_compiler.rb +23 -0
- data/lib/olyx/guardrails/secrets/custom_pattern_source.rb +30 -0
- data/lib/olyx/guardrails/secrets/finding_order.rb +17 -0
- data/lib/olyx/guardrails/secrets/finding_presenter.rb +34 -0
- data/lib/olyx/guardrails/secrets/generic_credential_patterns.rb +15 -0
- data/lib/olyx/guardrails/secrets/internal_endpoint_source.rb +28 -0
- data/lib/olyx/guardrails/secrets/network_patterns.rb +13 -0
- data/lib/olyx/guardrails/secrets/normalized_source_set.rb +27 -0
- data/lib/olyx/guardrails/secrets/pattern_catalog.rb +37 -0
- data/lib/olyx/guardrails/secrets/private_network_validator.rb +19 -0
- data/lib/olyx/guardrails/secrets/redaction_spans.rb +32 -0
- data/lib/olyx/guardrails/secrets/redactor.rb +27 -0
- data/lib/olyx/guardrails/secrets/regexp_finding_source.rb +21 -0
- data/lib/olyx/guardrails/secrets/source_set.rb +19 -0
- data/lib/olyx/guardrails/single_message_injection_detector.rb +35 -0
- data/lib/olyx/guardrails/supplemental_violation_labels.rb +22 -0
- data/lib/olyx/guardrails/text/base64_decoder.rb +45 -0
- data/lib/olyx/guardrails/text/detection_variants.rb +28 -0
- data/lib/olyx/guardrails/text/html_decoder.rb +18 -0
- data/lib/olyx/guardrails/text/mapped_builder.rb +33 -0
- data/lib/olyx/guardrails/text/mapped_normalization.rb +27 -0
- data/lib/olyx/guardrails/text/normalizer.rb +35 -0
- data/lib/olyx/guardrails/text/unicode_escape_decoder.rb +20 -0
- data/lib/olyx/guardrails/text/url_decoder.rb +20 -0
- data/lib/olyx/guardrails/validation.rb +33 -0
- data/lib/olyx/guardrails/version.rb +8 -0
- data/lib/olyx/guardrails/violation_labels.rb +24 -0
- data/lib/olyx/guardrails.rb +63 -0
- metadata +283 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Olyx
|
|
4
|
+
module Guardrails
|
|
5
|
+
# Derives violation labels that depend on individual check records.
|
|
6
|
+
module SupplementalViolationLabels
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
def call(result)
|
|
10
|
+
labels = []
|
|
11
|
+
labels << 'input_length_exceeded' if disallowed_check?(result, 'length')
|
|
12
|
+
labels << 'analyzer_error' if disallowed_check?(result, 'ai')
|
|
13
|
+
labels
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def disallowed_check?(result, type)
|
|
17
|
+
Array(result[:checks]).any? { |check| check[:type] == type && !check[:allowed] }
|
|
18
|
+
end
|
|
19
|
+
private_class_method :disallowed_check?
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'base64'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
module Text
|
|
8
|
+
# Decodes one bounded layer of standalone Base64-looking runs. A run is
|
|
9
|
+
# only substituted when it both decodes cleanly and produces printable
|
|
10
|
+
# text, so ordinary alphanumeric text (hex hashes, identifiers) is never
|
|
11
|
+
# corrupted by a coincidental decode.
|
|
12
|
+
module Base64Decoder
|
|
13
|
+
RUN = %r{(?<![A-Za-z0-9+/=])[A-Za-z0-9+/]{16,}={0,2}(?![A-Za-z0-9+/=])}
|
|
14
|
+
|
|
15
|
+
# Padding needed to reach a multiple of 4, keyed by length % 4.
|
|
16
|
+
# Unpadded base64 can only end on remainder 0 (none needed), 2, or 3;
|
|
17
|
+
# remainder 1 is not a valid unpadded length and maps to no padding
|
|
18
|
+
# rather than guessing, so decode simply fails for it below.
|
|
19
|
+
PADDING_FOR_REMAINDER = { 0 => '', 2 => '==', 3 => '=' }.freeze
|
|
20
|
+
|
|
21
|
+
module_function
|
|
22
|
+
|
|
23
|
+
def call(value)
|
|
24
|
+
value.gsub(RUN) { |run| decode(run) || run }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def decode(run)
|
|
28
|
+
decoded = Base64.strict_decode64(pad(run))
|
|
29
|
+
decoded if printable?(decoded)
|
|
30
|
+
rescue ArgumentError
|
|
31
|
+
nil
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def pad(run) = run + PADDING_FOR_REMAINDER.fetch(run.length % 4, '')
|
|
35
|
+
|
|
36
|
+
# [:print:] already covers space; \t/\n/\r are the only extra
|
|
37
|
+
# whitespace worth tolerating, listed explicitly to avoid an overlap
|
|
38
|
+
# with [:print:] inside the negated class.
|
|
39
|
+
def printable?(text) = text.valid_encoding? && !text.match?(/[^[:print:]\t\n\r]/)
|
|
40
|
+
|
|
41
|
+
private_class_method :decode, :pad, :printable?
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base64_decoder'
|
|
4
|
+
require_relative 'html_decoder'
|
|
5
|
+
require_relative 'normalizer'
|
|
6
|
+
require_relative 'unicode_escape_decoder'
|
|
7
|
+
require_relative 'url_decoder'
|
|
8
|
+
|
|
9
|
+
module Olyx
|
|
10
|
+
module Guardrails
|
|
11
|
+
module Text
|
|
12
|
+
# Produces bounded single-layer variants for evasion-resistant detection.
|
|
13
|
+
module DetectionVariants
|
|
14
|
+
WINDOW = 20_000
|
|
15
|
+
DECODERS = [HtmlDecoder, UrlDecoder, UnicodeEscapeDecoder, Base64Decoder].freeze
|
|
16
|
+
|
|
17
|
+
module_function
|
|
18
|
+
|
|
19
|
+
def call(value)
|
|
20
|
+
source = value.to_s[0...WINDOW]
|
|
21
|
+
normalized = Normalizer.call(source)
|
|
22
|
+
decoded = DECODERS.map { |decoder| decoder.call(normalized) }
|
|
23
|
+
[source, normalized, *decoded].uniq
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'cgi'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
module Text
|
|
8
|
+
# Decodes one bounded layer of HTML entities.
|
|
9
|
+
module HtmlDecoder
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def call(value)
|
|
13
|
+
CGI.unescapeHTML(value)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'normalizer'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
module Text
|
|
8
|
+
# Builds normalized text with indexes back to the original String.
|
|
9
|
+
module MappedBuilder
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def call(source)
|
|
13
|
+
text = +''
|
|
14
|
+
starts = []
|
|
15
|
+
endings = []
|
|
16
|
+
source.each_char.with_index do |character, index|
|
|
17
|
+
append(text, starts, endings, Normalizer.normalize_character(character), index)
|
|
18
|
+
end
|
|
19
|
+
[text, starts.freeze, endings.freeze]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def append(text, starts, endings, normalized, index)
|
|
23
|
+
normalized.to_s.each_char do |character|
|
|
24
|
+
text << character
|
|
25
|
+
starts << index
|
|
26
|
+
endings << (index + 1)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
private_class_method :append
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'mapped_builder'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
module Text
|
|
8
|
+
# Holds normalized detector text and translates matches to original spans.
|
|
9
|
+
class MappedNormalization
|
|
10
|
+
attr_reader :text
|
|
11
|
+
|
|
12
|
+
def initialize(source)
|
|
13
|
+
@source = source
|
|
14
|
+
@text, @starts, @endings = MappedBuilder.call(source)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def changed?
|
|
18
|
+
@text != @source
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def original_span(starting, ending)
|
|
22
|
+
[@starts.fetch(starting), @endings.fetch(ending - 1)]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Olyx
|
|
4
|
+
module Guardrails
|
|
5
|
+
module Text
|
|
6
|
+
# Produces a bounded comparison form for common Unicode evasions.
|
|
7
|
+
module Normalizer
|
|
8
|
+
ZERO_WIDTH = /[\u200B-\u200D\u2060\uFEFF]/
|
|
9
|
+
HOMOGLYPHS = {
|
|
10
|
+
'Α' => 'A', 'А' => 'A', 'Β' => 'B', 'В' => 'B', 'Ε' => 'E', 'Е' => 'E',
|
|
11
|
+
'Η' => 'H', 'Н' => 'H', 'Ι' => 'I', 'І' => 'I', 'Κ' => 'K', 'К' => 'K',
|
|
12
|
+
'Μ' => 'M', 'М' => 'M', 'Ν' => 'N', 'О' => 'O', 'Ρ' => 'P', 'Р' => 'P',
|
|
13
|
+
'С' => 'C', 'Τ' => 'T', 'Т' => 'T', 'Χ' => 'X', 'Х' => 'X',
|
|
14
|
+
'а' => 'a', 'е' => 'e', 'і' => 'i', 'о' => 'o', 'р' => 'p', 'с' => 'c',
|
|
15
|
+
'х' => 'x', 'у' => 'y'
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
module_function
|
|
19
|
+
|
|
20
|
+
def call(value)
|
|
21
|
+
value.to_s.each_char.filter_map { |character| normalize_character(character) }.join
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def normalize_character(character)
|
|
25
|
+
return if character.match?(ZERO_WIDTH)
|
|
26
|
+
|
|
27
|
+
normalized = character.unicode_normalize(:nfkc)
|
|
28
|
+
HOMOGLYPHS.fetch(normalized, normalized)
|
|
29
|
+
rescue Encoding::CompatibilityError, ArgumentError
|
|
30
|
+
character
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Olyx
|
|
4
|
+
module Guardrails
|
|
5
|
+
module Text
|
|
6
|
+
# Decodes one layer of JSON-style Unicode escapes.
|
|
7
|
+
module UnicodeEscapeDecoder
|
|
8
|
+
ESCAPE = /\\u([0-9a-fA-F]{4})/
|
|
9
|
+
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def call(value)
|
|
13
|
+
value.gsub(ESCAPE) { [::Regexp.last_match(1).to_i(16)].pack('U') }
|
|
14
|
+
rescue RangeError
|
|
15
|
+
value
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
module Text
|
|
8
|
+
# Decodes one layer of URL-encoded text.
|
|
9
|
+
module UrlDecoder
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def call(value)
|
|
13
|
+
URI.decode_www_form_component(value)
|
|
14
|
+
rescue ArgumentError
|
|
15
|
+
value
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Olyx
|
|
4
|
+
module Guardrails
|
|
5
|
+
# Shared internal validators for public collection arguments.
|
|
6
|
+
module Validation
|
|
7
|
+
def self.array_of!(value, item_class, name:)
|
|
8
|
+
valid = value.is_a?(Array) && value.all?(item_class)
|
|
9
|
+
return value if valid
|
|
10
|
+
|
|
11
|
+
raise ArgumentError, "#{name} must be an Array of #{item_class} values"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.boolean!(value, name:)
|
|
15
|
+
return value if [true, false].include?(value)
|
|
16
|
+
|
|
17
|
+
raise ArgumentError, "#{name} must be true or false"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.non_negative_integer!(value, name:)
|
|
21
|
+
return value if value.is_a?(Integer) && value >= 0
|
|
22
|
+
|
|
23
|
+
raise ArgumentError, "#{name} must be a non-negative Integer"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.callable_or_nil!(value, name:)
|
|
27
|
+
return value if value.nil? || value.respond_to?(:call)
|
|
28
|
+
|
|
29
|
+
raise ArgumentError, "#{name} must respond to call"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'supplemental_violation_labels'
|
|
4
|
+
|
|
5
|
+
module Olyx
|
|
6
|
+
module Guardrails
|
|
7
|
+
# Derives shared machine-readable violation labels from a decision.
|
|
8
|
+
module ViolationLabels
|
|
9
|
+
MAPPINGS = {
|
|
10
|
+
injection_attempt: 'injection_attempt',
|
|
11
|
+
secret_leaked: 'secret_leaked',
|
|
12
|
+
pii_detected: 'pii_detected',
|
|
13
|
+
policy_violated: 'restricted_content'
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
module_function
|
|
17
|
+
|
|
18
|
+
def call(result)
|
|
19
|
+
labels = MAPPINGS.filter_map { |field, label| label if result[field] }
|
|
20
|
+
labels.concat(SupplementalViolationLabels.call(result))
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'guardrails/version'
|
|
4
|
+
require_relative 'guardrails/errors'
|
|
5
|
+
require_relative 'guardrails/validation'
|
|
6
|
+
require_relative 'guardrails/risk/weights'
|
|
7
|
+
require_relative 'guardrails/pii_scrubber'
|
|
8
|
+
require_relative 'guardrails/injection_detector'
|
|
9
|
+
require_relative 'guardrails/secret_scanner'
|
|
10
|
+
require_relative 'guardrails/policy'
|
|
11
|
+
require_relative 'guardrails/check_runner'
|
|
12
|
+
require_relative 'guardrails/message_check_runner'
|
|
13
|
+
require_relative 'guardrails/redactor'
|
|
14
|
+
require_relative 'guardrails/notifier'
|
|
15
|
+
require_relative 'guardrails/rails' if defined?(Rails::Railtie)
|
|
16
|
+
|
|
17
|
+
module Olyx
|
|
18
|
+
# Guardrails is a standalone, in-process AI safety toolkit: custom policy
|
|
19
|
+
# enforcement, PII redaction, prompt-injection detection, and secret scanning,
|
|
20
|
+
# unified behind explicit decision and transformation entry points.
|
|
21
|
+
module Guardrails
|
|
22
|
+
INJECTION_RISK_WEIGHT = Risk::Weights::FINDINGS.fetch(:injection).last
|
|
23
|
+
SECRET_RISK_WEIGHT = Risk::Weights::FINDINGS.fetch(:secret).last
|
|
24
|
+
PII_RISK_WEIGHT = Risk::Weights::FINDINGS.fetch(:pii).last
|
|
25
|
+
POLICY_RISK_WEIGHT = Risk::Weights::FINDINGS.fetch(:policy).last
|
|
26
|
+
BLOCKED_RISK_WEIGHT = Risk::Weights::BLOCKED
|
|
27
|
+
|
|
28
|
+
# Runs the full guardrail suite on one input, optionally enriched by a
|
|
29
|
+
# caller-supplied AI analyzer. AI findings can add violations but cannot
|
|
30
|
+
# clear deterministic findings.
|
|
31
|
+
#
|
|
32
|
+
# @param input [#to_s] the content to check.
|
|
33
|
+
# @param policy [Policy] reusable enforcement and restricted-content rules.
|
|
34
|
+
# @param ai_analyzer [#call, nil] optional semantic analyzer receiving
|
|
35
|
+
# `(text, context)`.
|
|
36
|
+
# @return [Hash] the aggregate decision, findings, score, and check details.
|
|
37
|
+
def self.check(input, policy: Policy.default, ai_analyzer: nil)
|
|
38
|
+
CheckRunner.call(input, policy: policy, ai_analyzer: ai_analyzer)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Runs guardrails against structured chat messages, including adjacent-turn detection.
|
|
42
|
+
def self.check_messages(messages, policy: Policy.default, ai_analyzer: nil)
|
|
43
|
+
MessageCheckRunner.call(messages, policy: policy, ai_analyzer: ai_analyzer)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Redacts regex-detected PII, secrets, and restricted policy matches without
|
|
47
|
+
# making an allow/block decision.
|
|
48
|
+
#
|
|
49
|
+
# @param input [#to_s] the content to redact.
|
|
50
|
+
# @param policy [Policy] reusable limits and restricted-content rules.
|
|
51
|
+
# @return [Hash] redacted text, detection flags, and safe findings.
|
|
52
|
+
# @raise [ArgumentError] when an option is invalid or input is oversized.
|
|
53
|
+
def self.redact(input, policy: Policy.default)
|
|
54
|
+
Redactor.call(input, policy: policy)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class << self
|
|
58
|
+
# Explicit completed-output entry points; streaming enforcement belongs to the proxy platform.
|
|
59
|
+
alias check_output check
|
|
60
|
+
alias redact_output redact
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: olyx-guardrails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Moses Njoroge
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: 'Standalone Ruby library for completed AI input and output safety. Detects
|
|
13
|
+
and redacts PII, identifies prompt injection attacks (including multi-turn patterns),
|
|
14
|
+
scans for leaked secrets, enforces reusable custom restricted-content policies,
|
|
15
|
+
and provides explicit Rails boundary adapters and sanitized application-defined
|
|
16
|
+
notifications — no external dependencies for the core checks, runs entirely in-process.
|
|
17
|
+
Ships with a pluggable ai_analyzer: hook for LLM-backed semantic evaluation.'
|
|
18
|
+
email:
|
|
19
|
+
- mosesnjoroge@olyxai.io
|
|
20
|
+
executables: []
|
|
21
|
+
extensions: []
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
files:
|
|
24
|
+
- CHANGELOG.md
|
|
25
|
+
- CODE_OF_CONDUCT.md
|
|
26
|
+
- CONTRIBUTING.md
|
|
27
|
+
- LICENSE
|
|
28
|
+
- README.md
|
|
29
|
+
- SECURITY.md
|
|
30
|
+
- docs/API.md
|
|
31
|
+
- examples/claude_analyzer.rb
|
|
32
|
+
- examples/custom_policy.rb
|
|
33
|
+
- examples/notifier.rb
|
|
34
|
+
- examples/openai_analyzer.rb
|
|
35
|
+
- examples/rails_opt_in.rb
|
|
36
|
+
- examples/ruby_only.rb
|
|
37
|
+
- lib/generators/olyx_guardrails/install_generator.rb
|
|
38
|
+
- lib/generators/olyx_guardrails/templates/initializer.rb.tt
|
|
39
|
+
- lib/generators/olyx_guardrails/templates/policy.yml.tt
|
|
40
|
+
- lib/olyx/guardrails.rb
|
|
41
|
+
- lib/olyx/guardrails/ai/analysis_normalizer.rb
|
|
42
|
+
- lib/olyx/guardrails/ai/analysis_pipeline.rb
|
|
43
|
+
- lib/olyx/guardrails/ai/boolean_validator.rb
|
|
44
|
+
- lib/olyx/guardrails/ai/flag_finding_merger.rb
|
|
45
|
+
- lib/olyx/guardrails/ai/result_sanitizer.rb
|
|
46
|
+
- lib/olyx/guardrails/ai/secret_finding_merger.rb
|
|
47
|
+
- lib/olyx/guardrails/ai/standard_finding_merger.rb
|
|
48
|
+
- lib/olyx/guardrails/ai_analysis.rb
|
|
49
|
+
- lib/olyx/guardrails/ai_context_builder.rb
|
|
50
|
+
- lib/olyx/guardrails/ai_failure_handler.rb
|
|
51
|
+
- lib/olyx/guardrails/ai_finding_merger.rb
|
|
52
|
+
- lib/olyx/guardrails/check_analyzer.rb
|
|
53
|
+
- lib/olyx/guardrails/check_base_result.rb
|
|
54
|
+
- lib/olyx/guardrails/check_pipeline.rb
|
|
55
|
+
- lib/olyx/guardrails/check_result_builder.rb
|
|
56
|
+
- lib/olyx/guardrails/check_runner.rb
|
|
57
|
+
- lib/olyx/guardrails/check_set.rb
|
|
58
|
+
- lib/olyx/guardrails/checks/injection_check.rb
|
|
59
|
+
- lib/olyx/guardrails/checks/injection_result.rb
|
|
60
|
+
- lib/olyx/guardrails/checks/length_check.rb
|
|
61
|
+
- lib/olyx/guardrails/checks/message_injection_check.rb
|
|
62
|
+
- lib/olyx/guardrails/checks/pii_check.rb
|
|
63
|
+
- lib/olyx/guardrails/checks/policy_check.rb
|
|
64
|
+
- lib/olyx/guardrails/checks/secret_check.rb
|
|
65
|
+
- lib/olyx/guardrails/checks/skipped_checks.rb
|
|
66
|
+
- lib/olyx/guardrails/enum_value.rb
|
|
67
|
+
- lib/olyx/guardrails/errors.rb
|
|
68
|
+
- lib/olyx/guardrails/injection_detector.rb
|
|
69
|
+
- lib/olyx/guardrails/injection_patterns.rb
|
|
70
|
+
- lib/olyx/guardrails/integrations/openai/analyzer_setup.rb
|
|
71
|
+
- lib/olyx/guardrails/integrations/openai/configuration_resolver.rb
|
|
72
|
+
- lib/olyx/guardrails/integrations/openai/dependency_contracts.rb
|
|
73
|
+
- lib/olyx/guardrails/integrations/openai/input_builder.rb
|
|
74
|
+
- lib/olyx/guardrails/integrations/openai/member_reader.rb
|
|
75
|
+
- lib/olyx/guardrails/integrations/openai/model_identifier.rb
|
|
76
|
+
- lib/olyx/guardrails/integrations/openai/refusal_guard.rb
|
|
77
|
+
- lib/olyx/guardrails/integrations/openai/request_builder.rb
|
|
78
|
+
- lib/olyx/guardrails/integrations/openai/request_configuration.rb
|
|
79
|
+
- lib/olyx/guardrails/integrations/openai/request_values.rb
|
|
80
|
+
- lib/olyx/guardrails/integrations/openai/response_contents.rb
|
|
81
|
+
- lib/olyx/guardrails/integrations/openai/response_option_keys.rb
|
|
82
|
+
- lib/olyx/guardrails/integrations/openai/response_options.rb
|
|
83
|
+
- lib/olyx/guardrails/integrations/openai/schema_registry.rb
|
|
84
|
+
- lib/olyx/guardrails/integrations/openai/sdk.rb
|
|
85
|
+
- lib/olyx/guardrails/integrations/openai/signal_summary.rb
|
|
86
|
+
- lib/olyx/guardrails/integrations/openai_analyzer.rb
|
|
87
|
+
- lib/olyx/guardrails/integrations/openai_analyzer_configuration.rb
|
|
88
|
+
- lib/olyx/guardrails/integrations/openai_response_parser.rb
|
|
89
|
+
- lib/olyx/guardrails/message_check_runner.rb
|
|
90
|
+
- lib/olyx/guardrails/message_check_set.rb
|
|
91
|
+
- lib/olyx/guardrails/message_content.rb
|
|
92
|
+
- lib/olyx/guardrails/message_source.rb
|
|
93
|
+
- lib/olyx/guardrails/multi_turn_injection_detector.rb
|
|
94
|
+
- lib/olyx/guardrails/multi_turn_pair_scanner.rb
|
|
95
|
+
- lib/olyx/guardrails/multi_turn_variant_pairs.rb
|
|
96
|
+
- lib/olyx/guardrails/notification/base_event.rb
|
|
97
|
+
- lib/olyx/guardrails/notification/deep_freezer.rb
|
|
98
|
+
- lib/olyx/guardrails/notification/delivery_dispatcher.rb
|
|
99
|
+
- lib/olyx/guardrails/notification/delivery_summary.rb
|
|
100
|
+
- lib/olyx/guardrails/notification/handler.rb
|
|
101
|
+
- lib/olyx/guardrails/notification/handler_collection.rb
|
|
102
|
+
- lib/olyx/guardrails/notification/handler_collection_validator.rb
|
|
103
|
+
- lib/olyx/guardrails/notification/key.rb
|
|
104
|
+
- lib/olyx/guardrails/notification/metadata.rb
|
|
105
|
+
- lib/olyx/guardrails/notification/notifier_setup.rb
|
|
106
|
+
- lib/olyx/guardrails/notification/preview.rb
|
|
107
|
+
- lib/olyx/guardrails/notification/scrubber.rb
|
|
108
|
+
- lib/olyx/guardrails/notification/violation_labels.rb
|
|
109
|
+
- lib/olyx/guardrails/notification_event_builder.rb
|
|
110
|
+
- lib/olyx/guardrails/notification_sanitizer.rb
|
|
111
|
+
- lib/olyx/guardrails/notifier.rb
|
|
112
|
+
- lib/olyx/guardrails/notifier_configuration.rb
|
|
113
|
+
- lib/olyx/guardrails/pii/ambiguous_numeric_date.rb
|
|
114
|
+
- lib/olyx/guardrails/pii/block_scrubber.rb
|
|
115
|
+
- lib/olyx/guardrails/pii/content_scrubber.rb
|
|
116
|
+
- lib/olyx/guardrails/pii/date_validator.rb
|
|
117
|
+
- lib/olyx/guardrails/pii/hash_key.rb
|
|
118
|
+
- lib/olyx/guardrails/pii/iban_remainder.rb
|
|
119
|
+
- lib/olyx/guardrails/pii/iban_validator.rb
|
|
120
|
+
- lib/olyx/guardrails/pii/ipv4_validator.rb
|
|
121
|
+
- lib/olyx/guardrails/pii/ipv6_validator.rb
|
|
122
|
+
- lib/olyx/guardrails/pii/luhn_checksum.rb
|
|
123
|
+
- lib/olyx/guardrails/pii/luhn_validator.rb
|
|
124
|
+
- lib/olyx/guardrails/pii/message_scrubber.rb
|
|
125
|
+
- lib/olyx/guardrails/pii/named_date_validator.rb
|
|
126
|
+
- lib/olyx/guardrails/pii/numeric_date_validator.rb
|
|
127
|
+
- lib/olyx/guardrails/pii/pattern_catalog.rb
|
|
128
|
+
- lib/olyx/guardrails/pii/sin_validator.rb
|
|
129
|
+
- lib/olyx/guardrails/pii/ssn_validator.rb
|
|
130
|
+
- lib/olyx/guardrails/pii/text_scrubber.rb
|
|
131
|
+
- lib/olyx/guardrails/pii/year_first_date.rb
|
|
132
|
+
- lib/olyx/guardrails/pii_scrubber.rb
|
|
133
|
+
- lib/olyx/guardrails/pii_validators.rb
|
|
134
|
+
- lib/olyx/guardrails/policy.rb
|
|
135
|
+
- lib/olyx/guardrails/policy/ai_failure_mode.rb
|
|
136
|
+
- lib/olyx/guardrails/policy/configuration.rb
|
|
137
|
+
- lib/olyx/guardrails/policy/configuration_hash.rb
|
|
138
|
+
- lib/olyx/guardrails/policy/finding_order.rb
|
|
139
|
+
- lib/olyx/guardrails/policy/finding_presenter.rb
|
|
140
|
+
- lib/olyx/guardrails/policy/match_collector.rb
|
|
141
|
+
- lib/olyx/guardrails/policy/name.rb
|
|
142
|
+
- lib/olyx/guardrails/policy/normalized_pattern_matcher.rb
|
|
143
|
+
- lib/olyx/guardrails/policy/pattern_matcher.rb
|
|
144
|
+
- lib/olyx/guardrails/policy/redaction_result.rb
|
|
145
|
+
- lib/olyx/guardrails/policy/redaction_spans.rb
|
|
146
|
+
- lib/olyx/guardrails/policy/rule_collection.rb
|
|
147
|
+
- lib/olyx/guardrails/policy/rule_matcher.rb
|
|
148
|
+
- lib/olyx/guardrails/policy/rule_normalizer.rb
|
|
149
|
+
- lib/olyx/guardrails/policy/scan_result.rb
|
|
150
|
+
- lib/olyx/guardrails/policy/secret_pattern_collection.rb
|
|
151
|
+
- lib/olyx/guardrails/policy/unmatched_segment_builder.rb
|
|
152
|
+
- lib/olyx/guardrails/policy/unmatched_transformer.rb
|
|
153
|
+
- lib/olyx/guardrails/policy_aware_redactor.rb
|
|
154
|
+
- lib/olyx/guardrails/policy_redactor.rb
|
|
155
|
+
- lib/olyx/guardrails/policy_rule.rb
|
|
156
|
+
- lib/olyx/guardrails/policy_rule/configuration.rb
|
|
157
|
+
- lib/olyx/guardrails/policy_rule/description_value.rb
|
|
158
|
+
- lib/olyx/guardrails/policy_rule/match_mode.rb
|
|
159
|
+
- lib/olyx/guardrails/policy_rule/name_value.rb
|
|
160
|
+
- lib/olyx/guardrails/policy_rule/pattern_compiler.rb
|
|
161
|
+
- lib/olyx/guardrails/policy_rule/regexp_compiler.rb
|
|
162
|
+
- lib/olyx/guardrails/policy_rule/replacement_value.rb
|
|
163
|
+
- lib/olyx/guardrails/policy_rule/term_compiler.rb
|
|
164
|
+
- lib/olyx/guardrails/policy_rule/text_values.rb
|
|
165
|
+
- lib/olyx/guardrails/policy_rule/values.rb
|
|
166
|
+
- lib/olyx/guardrails/policy_scanner.rb
|
|
167
|
+
- lib/olyx/guardrails/rails.rb
|
|
168
|
+
- lib/olyx/guardrails/rails/action_cable.rb
|
|
169
|
+
- lib/olyx/guardrails/rails/active_job_handler.rb
|
|
170
|
+
- lib/olyx/guardrails/rails/active_model_validator.rb
|
|
171
|
+
- lib/olyx/guardrails/rails/check_telemetry.rb
|
|
172
|
+
- lib/olyx/guardrails/rails/configuration.rb
|
|
173
|
+
- lib/olyx/guardrails/rails/configuration_finalizer.rb
|
|
174
|
+
- lib/olyx/guardrails/rails/configuration_registry.rb
|
|
175
|
+
- lib/olyx/guardrails/rails/configuration_values.rb
|
|
176
|
+
- lib/olyx/guardrails/rails/constant_resolver.rb
|
|
177
|
+
- lib/olyx/guardrails/rails/controller.rb
|
|
178
|
+
- lib/olyx/guardrails/rails/controller_metadata.rb
|
|
179
|
+
- lib/olyx/guardrails/rails/decision_service.rb
|
|
180
|
+
- lib/olyx/guardrails/rails/enforcer.rb
|
|
181
|
+
- lib/olyx/guardrails/rails/evaluation_lifecycle.rb
|
|
182
|
+
- lib/olyx/guardrails/rails/evaluation_service.rb
|
|
183
|
+
- lib/olyx/guardrails/rails/filter_parameters.rb
|
|
184
|
+
- lib/olyx/guardrails/rails/graphql.rb
|
|
185
|
+
- lib/olyx/guardrails/rails/ingress.rb
|
|
186
|
+
- lib/olyx/guardrails/rails/input_runtime.rb
|
|
187
|
+
- lib/olyx/guardrails/rails/instrumentation.rb
|
|
188
|
+
- lib/olyx/guardrails/rails/instrumentation_payloads.rb
|
|
189
|
+
- lib/olyx/guardrails/rails/instrumentation_publisher.rb
|
|
190
|
+
- lib/olyx/guardrails/rails/integration_configuration.rb
|
|
191
|
+
- lib/olyx/guardrails/rails/job.rb
|
|
192
|
+
- lib/olyx/guardrails/rails/job_argument.rb
|
|
193
|
+
- lib/olyx/guardrails/rails/job_reference.rb
|
|
194
|
+
- lib/olyx/guardrails/rails/message_evaluation_service.rb
|
|
195
|
+
- lib/olyx/guardrails/rails/message_runtime.rb
|
|
196
|
+
- lib/olyx/guardrails/rails/notification_dispatcher.rb
|
|
197
|
+
- lib/olyx/guardrails/rails/output_runtime.rb
|
|
198
|
+
- lib/olyx/guardrails/rails/path_value.rb
|
|
199
|
+
- lib/olyx/guardrails/rails/policy_configuration.rb
|
|
200
|
+
- lib/olyx/guardrails/rails/policy_document.rb
|
|
201
|
+
- lib/olyx/guardrails/rails/policy_file.rb
|
|
202
|
+
- lib/olyx/guardrails/rails/policy_file_error.rb
|
|
203
|
+
- lib/olyx/guardrails/rails/policy_rule_names.rb
|
|
204
|
+
- lib/olyx/guardrails/rails/policy_yaml.rb
|
|
205
|
+
- lib/olyx/guardrails/rails/queue_name.rb
|
|
206
|
+
- lib/olyx/guardrails/rails/redaction_payload.rb
|
|
207
|
+
- lib/olyx/guardrails/rails/redaction_service.rb
|
|
208
|
+
- lib/olyx/guardrails/rails/result_summary.rb
|
|
209
|
+
- lib/olyx/guardrails/rails/runtime.rb
|
|
210
|
+
- lib/olyx/guardrails/rails/timer.rb
|
|
211
|
+
- lib/olyx/guardrails/rails/upload.rb
|
|
212
|
+
- lib/olyx/guardrails/railtie.rb
|
|
213
|
+
- lib/olyx/guardrails/redaction/content_result.rb
|
|
214
|
+
- lib/olyx/guardrails/redaction/input_validator.rb
|
|
215
|
+
- lib/olyx/guardrails/redaction/public_result.rb
|
|
216
|
+
- lib/olyx/guardrails/redaction/unrestricted_text.rb
|
|
217
|
+
- lib/olyx/guardrails/redactor.rb
|
|
218
|
+
- lib/olyx/guardrails/risk/ai_score.rb
|
|
219
|
+
- lib/olyx/guardrails/risk/check_weights.rb
|
|
220
|
+
- lib/olyx/guardrails/risk/deterministic_score.rb
|
|
221
|
+
- lib/olyx/guardrails/risk/weights.rb
|
|
222
|
+
- lib/olyx/guardrails/risk_scorer.rb
|
|
223
|
+
- lib/olyx/guardrails/secret_finding_collector.rb
|
|
224
|
+
- lib/olyx/guardrails/secret_scanner.rb
|
|
225
|
+
- lib/olyx/guardrails/secrets/blocked.rb
|
|
226
|
+
- lib/olyx/guardrails/secrets/catalog_source.rb
|
|
227
|
+
- lib/olyx/guardrails/secrets/cloud_credential_patterns.rb
|
|
228
|
+
- lib/olyx/guardrails/secrets/confidentiality_source.rb
|
|
229
|
+
- lib/olyx/guardrails/secrets/custom_pattern_compiler.rb
|
|
230
|
+
- lib/olyx/guardrails/secrets/custom_pattern_source.rb
|
|
231
|
+
- lib/olyx/guardrails/secrets/finding_order.rb
|
|
232
|
+
- lib/olyx/guardrails/secrets/finding_presenter.rb
|
|
233
|
+
- lib/olyx/guardrails/secrets/generic_credential_patterns.rb
|
|
234
|
+
- lib/olyx/guardrails/secrets/internal_endpoint_source.rb
|
|
235
|
+
- lib/olyx/guardrails/secrets/network_patterns.rb
|
|
236
|
+
- lib/olyx/guardrails/secrets/normalized_source_set.rb
|
|
237
|
+
- lib/olyx/guardrails/secrets/pattern_catalog.rb
|
|
238
|
+
- lib/olyx/guardrails/secrets/private_network_validator.rb
|
|
239
|
+
- lib/olyx/guardrails/secrets/redaction_spans.rb
|
|
240
|
+
- lib/olyx/guardrails/secrets/redactor.rb
|
|
241
|
+
- lib/olyx/guardrails/secrets/regexp_finding_source.rb
|
|
242
|
+
- lib/olyx/guardrails/secrets/source_set.rb
|
|
243
|
+
- lib/olyx/guardrails/single_message_injection_detector.rb
|
|
244
|
+
- lib/olyx/guardrails/supplemental_violation_labels.rb
|
|
245
|
+
- lib/olyx/guardrails/text/base64_decoder.rb
|
|
246
|
+
- lib/olyx/guardrails/text/detection_variants.rb
|
|
247
|
+
- lib/olyx/guardrails/text/html_decoder.rb
|
|
248
|
+
- lib/olyx/guardrails/text/mapped_builder.rb
|
|
249
|
+
- lib/olyx/guardrails/text/mapped_normalization.rb
|
|
250
|
+
- lib/olyx/guardrails/text/normalizer.rb
|
|
251
|
+
- lib/olyx/guardrails/text/unicode_escape_decoder.rb
|
|
252
|
+
- lib/olyx/guardrails/text/url_decoder.rb
|
|
253
|
+
- lib/olyx/guardrails/validation.rb
|
|
254
|
+
- lib/olyx/guardrails/version.rb
|
|
255
|
+
- lib/olyx/guardrails/violation_labels.rb
|
|
256
|
+
homepage: https://github.com/Olyx-labs/olyx-guardrails
|
|
257
|
+
licenses:
|
|
258
|
+
- Apache-2.0
|
|
259
|
+
metadata:
|
|
260
|
+
source_code_uri: https://github.com/Olyx-labs/olyx-guardrails
|
|
261
|
+
changelog_uri: https://github.com/Olyx-labs/olyx-guardrails/blob/master/CHANGELOG.md
|
|
262
|
+
documentation_uri: https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/API.md
|
|
263
|
+
bug_tracker_uri: https://github.com/Olyx-labs/olyx-guardrails/issues
|
|
264
|
+
allowed_push_host: https://rubygems.org
|
|
265
|
+
rubygems_mfa_required: 'true'
|
|
266
|
+
rdoc_options: []
|
|
267
|
+
require_paths:
|
|
268
|
+
- lib
|
|
269
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
270
|
+
requirements:
|
|
271
|
+
- - ">="
|
|
272
|
+
- !ruby/object:Gem::Version
|
|
273
|
+
version: '3.4'
|
|
274
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
|
+
requirements:
|
|
276
|
+
- - ">="
|
|
277
|
+
- !ruby/object:Gem::Version
|
|
278
|
+
version: '0'
|
|
279
|
+
requirements: []
|
|
280
|
+
rubygems_version: 3.6.9
|
|
281
|
+
specification_version: 4
|
|
282
|
+
summary: In-process AI guardrails for Ruby and Rails with configurable policies.
|
|
283
|
+
test_files: []
|