olyx-guardrails 1.0.0 → 1.1.1
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 +4 -4
- data/CHANGELOG.md +63 -23
- data/README.md +192 -531
- data/lib/generators/olyx_guardrails/templates/initializer.rb.tt +8 -8
- data/lib/generators/olyx_guardrails/templates/policy.yml.tt +19 -15
- data/lib/olyx/guardrails/check_analyzer.rb +9 -6
- data/lib/olyx/guardrails/check_pipeline.rb +2 -2
- data/lib/olyx/guardrails/check_result_builder.rb +34 -7
- data/lib/olyx/guardrails/check_runner.rb +4 -7
- data/lib/olyx/guardrails/errors.rb +20 -8
- data/lib/olyx/guardrails/injection_detector.rb +22 -2
- data/lib/olyx/guardrails/{ai → llm}/analysis_normalizer.rb +1 -1
- data/lib/olyx/guardrails/llm/analysis_pipeline.rb +37 -0
- data/lib/olyx/guardrails/{ai → llm}/boolean_validator.rb +2 -2
- data/lib/olyx/guardrails/{ai → llm}/result_sanitizer.rb +2 -2
- data/lib/olyx/guardrails/llm_analysis.rb +26 -0
- data/lib/olyx/guardrails/{ai_context_builder.rb → llm_context_builder.rb} +2 -2
- data/lib/olyx/guardrails/llm_failure_handler.rb +17 -0
- data/lib/olyx/guardrails/llm_finding_merger.rb +39 -0
- data/lib/olyx/guardrails/message_check_runner.rb +3 -3
- data/lib/olyx/guardrails/notification/delivery_dispatcher.rb +3 -1
- data/lib/olyx/guardrails/notification_event_builder.rb +5 -6
- data/lib/olyx/guardrails/notification_sanitizer.rb +1 -2
- data/lib/olyx/guardrails/notifier.rb +49 -22
- data/lib/olyx/guardrails/notifier_configuration.rb +1 -2
- data/lib/olyx/guardrails/pii/sin_validator.rb +2 -2
- data/lib/olyx/guardrails/pii_scrubber.rb +22 -2
- data/lib/olyx/guardrails/policy/configuration.rb +11 -5
- data/lib/olyx/guardrails/policy/redaction_result.rb +5 -1
- data/lib/olyx/guardrails/policy.rb +62 -5
- data/lib/olyx/guardrails/policy_aware_redactor.rb +1 -2
- data/lib/olyx/guardrails/policy_rule/configuration.rb +8 -2
- data/lib/olyx/guardrails/policy_rule.rb +34 -2
- data/lib/olyx/guardrails/policy_scanner.rb +0 -2
- data/lib/olyx/guardrails/rails/action_cable.rb +9 -2
- data/lib/olyx/guardrails/rails/active_job_handler.rb +16 -2
- data/lib/olyx/guardrails/rails/active_model_validator.rb +8 -1
- data/lib/olyx/guardrails/rails/configuration.rb +79 -19
- data/lib/olyx/guardrails/rails/configuration_finalizer.rb +0 -2
- data/lib/olyx/guardrails/rails/configuration_registry.rb +6 -3
- data/lib/olyx/guardrails/rails/configuration_values.rb +4 -2
- data/lib/olyx/guardrails/rails/controller.rb +19 -4
- data/lib/olyx/guardrails/rails/decision_service.rb +1 -1
- data/lib/olyx/guardrails/rails/enforcer.rb +22 -8
- data/lib/olyx/guardrails/rails/graphql.rb +11 -2
- data/lib/olyx/guardrails/rails/ingress.rb +2 -0
- data/lib/olyx/guardrails/rails/job.rb +38 -5
- data/lib/olyx/guardrails/rails/policy_document.rb +1 -1
- data/lib/olyx/guardrails/rails/runtime.rb +36 -10
- data/lib/olyx/guardrails/rails/upload.rb +21 -7
- data/lib/olyx/guardrails/rails.rb +75 -3
- data/lib/olyx/guardrails/railtie.rb +5 -2
- data/lib/olyx/guardrails/redactor.rb +2 -2
- data/lib/olyx/guardrails/risk/{ai_score.rb → llm_score.rb} +4 -4
- data/lib/olyx/guardrails/risk_scorer.rb +8 -8
- data/lib/olyx/guardrails/secret_scanner.rb +25 -2
- data/lib/olyx/guardrails/secrets/blocked.rb +17 -2
- data/lib/olyx/guardrails/supplemental_violation_labels.rb +1 -1
- data/lib/olyx/guardrails/validation.rb +6 -0
- data/lib/olyx/guardrails/version.rb +1 -1
- data/lib/olyx/guardrails.rb +77 -27
- metadata +44 -61
- data/CODE_OF_CONDUCT.md +0 -28
- data/CONTRIBUTING.md +0 -63
- data/SECURITY.md +0 -35
- data/docs/API.md +0 -460
- data/examples/claude_analyzer.rb +0 -53
- data/examples/custom_policy.rb +0 -41
- data/examples/notifier.rb +0 -37
- data/examples/openai_analyzer.rb +0 -45
- data/examples/rails_opt_in.rb +0 -99
- data/examples/ruby_only.rb +0 -53
- data/lib/olyx/guardrails/ai/analysis_pipeline.rb +0 -26
- data/lib/olyx/guardrails/ai/flag_finding_merger.rb +0 -16
- data/lib/olyx/guardrails/ai/secret_finding_merger.rb +0 -19
- data/lib/olyx/guardrails/ai/standard_finding_merger.rb +0 -24
- data/lib/olyx/guardrails/ai_analysis.rb +0 -29
- data/lib/olyx/guardrails/ai_failure_handler.rb +0 -17
- data/lib/olyx/guardrails/ai_finding_merger.rb +0 -30
- data/lib/olyx/guardrails/check_base_result.rb +0 -32
- data/lib/olyx/guardrails/integrations/openai/analyzer_setup.rb +0 -21
- data/lib/olyx/guardrails/integrations/openai/configuration_resolver.rb +0 -28
- data/lib/olyx/guardrails/integrations/openai/dependency_contracts.rb +0 -28
- data/lib/olyx/guardrails/integrations/openai/input_builder.rb +0 -39
- data/lib/olyx/guardrails/integrations/openai/member_reader.rb +0 -21
- data/lib/olyx/guardrails/integrations/openai/model_identifier.rb +0 -28
- data/lib/olyx/guardrails/integrations/openai/refusal_guard.rb +0 -28
- data/lib/olyx/guardrails/integrations/openai/request_builder.rb +0 -36
- data/lib/olyx/guardrails/integrations/openai/request_configuration.rb +0 -25
- data/lib/olyx/guardrails/integrations/openai/request_values.rb +0 -33
- data/lib/olyx/guardrails/integrations/openai/response_contents.rb +0 -22
- data/lib/olyx/guardrails/integrations/openai/response_option_keys.rb +0 -32
- data/lib/olyx/guardrails/integrations/openai/response_options.rb +0 -23
- data/lib/olyx/guardrails/integrations/openai/schema_registry.rb +0 -46
- data/lib/olyx/guardrails/integrations/openai/sdk.rb +0 -26
- data/lib/olyx/guardrails/integrations/openai/signal_summary.rb +0 -40
- data/lib/olyx/guardrails/integrations/openai_analyzer.rb +0 -107
- data/lib/olyx/guardrails/integrations/openai_analyzer_configuration.rb +0 -38
- data/lib/olyx/guardrails/integrations/openai_response_parser.rb +0 -34
- data/lib/olyx/guardrails/notification/delivery_summary.rb +0 -17
- data/lib/olyx/guardrails/policy/ai_failure_mode.rb +0 -15
- data/lib/olyx/guardrails/policy_redactor.rb +0 -28
- data/lib/olyx/guardrails/policy_rule/match_mode.rb +0 -15
- data/lib/olyx/guardrails/rails/evaluation_service.rb +0 -12
- data/lib/olyx/guardrails/rails/input_runtime.rb +0 -25
- data/lib/olyx/guardrails/rails/integration_configuration.rb +0 -27
- data/lib/olyx/guardrails/rails/message_evaluation_service.rb +0 -13
- data/lib/olyx/guardrails/rails/message_runtime.rb +0 -20
- data/lib/olyx/guardrails/rails/output_runtime.rb +0 -26
- data/lib/olyx/guardrails/rails/path_value.rb +0 -30
- data/lib/olyx/guardrails/rails/policy_configuration.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 789eb5e71a301345c3fd0d28e59ffee0b0d9cf67ee9686f0912e5a743ccd093b
|
|
4
|
+
data.tar.gz: d89fc57b450761fe6e530fa116e39413eeb17edeb9c73023fbd8247ace98a727
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17390bf8cbd4961a4e4a669a5ca0b8f80afcf2663fceaea85e5fe31050e789252b5952ef8063ef80d8ffaa5b78f7e69d4a4c96dba8ce1724fcfe090ccb5f3e50
|
|
7
|
+
data.tar.gz: d3e28269e0760c9c09c83f25f8499b74391ee1d7ebf5d3d9ab1a4fe9236d56c2f90b63daa6c603068f6a40fa2398577d08a2f8631d1c05c37e01a478d9ec3a2a
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
All notable changes to olyx-guardrails are documented here.
|
|
4
4
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
|
|
6
|
+
## [1.1.1] - 2026-07-24
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- The published gem now contains only runtime code, generator templates, and
|
|
11
|
+
its README, changelog, and license. Guides and runnable examples remain
|
|
12
|
+
available from the canonical repository.
|
|
13
|
+
- Removed two internal, one-use indirection layers from Rails policy-path
|
|
14
|
+
normalization and policy redaction. Public behavior is unchanged.
|
|
15
|
+
- The package manifest is now tested as an exact consumer-facing contract, and
|
|
16
|
+
path-like Rails policy configuration has direct boundary coverage.
|
|
17
|
+
|
|
18
|
+
## [1.1.0] - 2026-07-23
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Rails metadata now validates consistently as a Hash at every facade and
|
|
23
|
+
adapter boundary.
|
|
24
|
+
- Blocking exceptions use boundary-neutral wording, Active Job selectors
|
|
25
|
+
validate when declared, and inherited job declarations remain effective.
|
|
26
|
+
- Notifier misuse raises `ArgumentError`; `nil` now means only that a valid
|
|
27
|
+
decision has zero risk.
|
|
28
|
+
- The Rails generator provides copyable policy customization instructions and
|
|
29
|
+
tests the customized YAML path.
|
|
30
|
+
- Contributor setup, complete local quality validation, and maintainer release
|
|
31
|
+
verification have canonical commands and documentation.
|
|
32
|
+
- Closely coupled proxy objects were folded into their owning runtime,
|
|
33
|
+
configuration, result-building, and notification components.
|
|
34
|
+
- Provider risk scores now require a finite Numeric value; numeric strings are
|
|
35
|
+
ignored instead of being coerced across the untrusted provider boundary.
|
|
36
|
+
- Contributor and Rails appraisal locks use the current `net-imap` patch.
|
|
37
|
+
- CI refreshes the Ruby advisory database and blocks known-vulnerable locked
|
|
38
|
+
dependencies without making the offline local quality gate network-dependent.
|
|
39
|
+
|
|
6
40
|
## [1.0.0] - 2026-07-21
|
|
7
41
|
|
|
8
42
|
Initial public release.
|
|
@@ -13,7 +47,7 @@ Initial public release.
|
|
|
13
47
|
prompt-injection, secret, and restricted-policy findings without
|
|
14
48
|
transforming the input. Returns `allowed`, per-category detection flags,
|
|
15
49
|
`risk_score`, and a `checks` array with one entry per category. The
|
|
16
|
-
`length` check runs first; content and
|
|
50
|
+
`length` check runs first; content and LLM checks are skipped (not just
|
|
17
51
|
failed) when it does, so an oversized payload never pays their cost.
|
|
18
52
|
- `Olyx::Guardrails.redact` — transforms text by removing every
|
|
19
53
|
regex-detected PII, secret, and restricted-policy match, without making an
|
|
@@ -33,9 +67,9 @@ Initial public release.
|
|
|
33
67
|
monitoring-only restricted-content rules, `substring`/`whole_word`/`regexp`
|
|
34
68
|
term matching, case-aware regex support, configurable safe replacements,
|
|
35
69
|
and `Policy.from_h` for YAML/JSON-style Hash loading.
|
|
36
|
-
- `
|
|
37
|
-
(default, keeps the deterministic result), `:block` (adds a failed `
|
|
38
|
-
check and rejects), or `:raise` (`
|
|
70
|
+
- `llm_failure_mode:` controls how a provider failure is handled: `:allow`
|
|
71
|
+
(default, keeps the deterministic result), `:block` (adds a failed `llm`
|
|
72
|
+
check and rejects), or `:raise` (`LlmProviderError`).
|
|
39
73
|
- Invalid configuration — duplicate rule names, empty-matching or invalid
|
|
40
74
|
patterns, malformed message arrays, invalid custom regexes — raises
|
|
41
75
|
`ArgumentError` at construction time rather than silently degrading into a
|
|
@@ -61,31 +95,29 @@ Initial public release.
|
|
|
61
95
|
span. Custom patterns extend detection and are classified as secrets; use
|
|
62
96
|
`PolicyRule` for named business restrictions instead.
|
|
63
97
|
|
|
64
|
-
###
|
|
98
|
+
### LLM provider hook
|
|
65
99
|
|
|
66
|
-
- Optional `
|
|
100
|
+
- Optional `llm_provider:` callable receives `(text, context)` and returns a
|
|
67
101
|
Hash or a schema-model object implementing `deep_to_h`/`to_h`. Findings
|
|
68
102
|
can add a violation but cannot clear a deterministic one. Boolean fields
|
|
69
103
|
must be actual `true`/`false` values; non-finite risk scores are ignored
|
|
70
104
|
rather than crashing. Exceptions and malformed responses are bounded under
|
|
71
|
-
`result[:
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
identifier and relies on Structured Outputs support as the compatibility
|
|
77
|
-
check. Refusals, API failures, and missing parsed output degrade into the
|
|
78
|
-
same `result[:ai_analysis][:error]` path. The `openai` gem is optional and
|
|
79
|
-
loaded lazily.
|
|
105
|
+
`result[:llm_analysis][:error]` and handled per `llm_failure_mode`.
|
|
106
|
+
- Provider transport is application-owned. The gem has no vendor SDK adapters,
|
|
107
|
+
endpoint assumptions, model allowlists, or model-specific parameters.
|
|
108
|
+
A framework-free local HTTP example demonstrates an open-source-first
|
|
109
|
+
classifier boundary using only Ruby standard-library HTTP and JSON support.
|
|
80
110
|
|
|
81
111
|
### Notifications
|
|
82
112
|
|
|
83
113
|
- Vendor-neutral `Notifier` dispatches one sanitized, deeply frozen,
|
|
84
114
|
versioned event to named callable handlers. Handlers run synchronously and
|
|
85
115
|
independently — one failure doesn't stop the others, and errors are
|
|
86
|
-
returned per handler rather than raised. Input previews,
|
|
116
|
+
returned per handler rather than raised. Input previews, LLM reasons,
|
|
87
117
|
metadata keys/values, and handler errors are bounded and redacted with the
|
|
88
118
|
policy's restricted-content rules and the built-in PII/secret detectors.
|
|
119
|
+
- Notification events expose optional provider reasoning as `llm_reason`;
|
|
120
|
+
the pre-release `ai_reason` field is not retained.
|
|
89
121
|
|
|
90
122
|
### Rails integration
|
|
91
123
|
|
|
@@ -103,15 +135,23 @@ Initial public release.
|
|
|
103
135
|
- `Rails::ActiveJobHandler` enqueues sanitized notification events through
|
|
104
136
|
any Active Job backend, resolving a reload-safe String/Symbol job
|
|
105
137
|
constant at delivery time.
|
|
138
|
+
- The initial compatibility window covers Rails 8.0 and 8.1. Only listed Rails
|
|
139
|
+
series are tested and supported; subsequent gem releases may remove a series
|
|
140
|
+
after its upstream security support ends.
|
|
106
141
|
|
|
107
142
|
### Quality and security posture
|
|
108
143
|
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
- CI enforces RuboCop
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
matrix across Rails
|
|
144
|
+
- The core has one lightweight runtime dependency, Ruby's `base64` bundled gem.
|
|
145
|
+
Rails remains optional and is loaded only when used.
|
|
146
|
+
- CI enforces RuboCop — including calibrated structural-complexity cops
|
|
147
|
+
(`Metrics/AbcSize`, `CyclomaticComplexity`, `PerceivedComplexity`,
|
|
148
|
+
`ClassLength`) in place of a separate complexity tool — and a RubyCritic
|
|
149
|
+
maintainability gate, alongside the Appraisal matrix across Rails 8.0
|
|
150
|
+
and 8.1.
|
|
151
|
+
- Native RDoc covers every supported public class, module, constant, attribute,
|
|
152
|
+
and method. CI blocks undocumented additions to the explicit public API
|
|
153
|
+
manifest while leaving implementation-only constants outside the
|
|
154
|
+
compatibility contract.
|
|
115
155
|
- Least-privilege, SHA-pinned CI actions; CodeQL and OpenSSF Scorecard
|
|
116
156
|
scanning; a private vulnerability-reporting process (see
|
|
117
|
-
[
|
|
157
|
+
[security policy](https://github.com/Olyx-labs/olyx-guardrails/security/policy)).
|