olyx-guardrails 1.1.0 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c330386f60e14497f63e1e07978fa28aa3b21b028685662fd524964689d6b340
4
- data.tar.gz: 052c2af355cc8351a69052e1e07e5e8655c723b4f17b46c86f0d9726b4978d1d
3
+ metadata.gz: 3beec90de1af339d911ceeb8efd92759f478198cef96679313608caad32b20fa
4
+ data.tar.gz: e812ebb1c97a9d359a4cf98e93bbd28724356c80a72d94b0ae1b6fbeffa6a3cf
5
5
  SHA512:
6
- metadata.gz: 94dbcc7502ced8d907c5154c585ab735330b33fa4b8a7cd0f3d74e4ec6cc1d325991ecb15fbcb9a00a5033b263486e4c040285fa0243e8a92540c7ec171c1647
7
- data.tar.gz: fd53482fe7bb8c4f977d01cc0ea0064b10ef29ca5d722b024862b7d581d54647fb7e7d6b6a935b4874bc80f67c5fbd152b004d5454c925a54287084cd2b763b0
6
+ metadata.gz: ab91be7e1659df86895cb9a011f01bb782b48e7d4f153936570e95734b4ef72a86a6abdc5494f78f09f669a2ad4e05a1173d8e92a0fd584b5423de9a83f5a73b
7
+ data.tar.gz: 67861f12b3535faa4e52b50c440ef8d1696488ab88a32bfeda8ef16c50e99e90223b270177696730c99ee8ffb74a32e23fb35977beb7cd43e48507051525e320
data/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
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.3] - 2026-08-07
7
+
8
+ ### Changed
9
+
10
+ - Added the Bundler release task expected by the trusted publishing workflow.
11
+
12
+ ## [1.1.2] - 2026-08-07
13
+
14
+ ### Changed
15
+
16
+ - Added a tag-based RubyGems release workflow using trusted publishing.
17
+
18
+ ## [1.1.1] - 2026-07-24
19
+
20
+ ### Changed
21
+
22
+ - The published gem now contains only runtime code, generator templates, and
23
+ its README, changelog, and license. Guides and runnable examples remain
24
+ available from the canonical repository.
25
+ - Removed two internal, one-use indirection layers from Rails policy-path
26
+ normalization and policy redaction. Public behavior is unchanged.
27
+ - The package manifest is now tested as an exact consumer-facing contract, and
28
+ path-like Rails policy configuration has direct boundary coverage.
29
+
6
30
  ## [1.1.0] - 2026-07-23
7
31
 
8
32
  ### Changed
@@ -142,4 +166,4 @@ Initial public release.
142
166
  compatibility contract.
143
167
  - Least-privilege, SHA-pinned CI actions; CodeQL and OpenSSF Scorecard
144
168
  scanning; a private vulnerability-reporting process (see
145
- [SECURITY.md](SECURITY.md)).
169
+ [security policy](https://github.com/Olyx-labs/olyx-guardrails/security/policy)).
data/README.md CHANGED
@@ -97,8 +97,9 @@ The default policy:
97
97
  - has no custom restricted-content rules.
98
98
 
99
99
  Production applications should construct an explicit policy instead of relying
100
- on defaults. See the [Policies guide](docs/POLICIES.md) for the complete rule
101
- language and YAML examples.
100
+ on defaults. See the
101
+ [Policies guide](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/POLICIES.md)
102
+ for the complete rule language and YAML examples.
102
103
 
103
104
  ## Rails quick start
104
105
 
@@ -137,9 +138,10 @@ end
137
138
  Rails enforcement is opt-in. The gem does not scan parameters, callbacks,
138
139
  uploads, jobs, GraphQL operations, or Action Cable messages globally.
139
140
 
140
- The [Rails integration guide](docs/RAILS.md) covers every adapter, boot-time
141
- configuration, safe YAML loading, instrumentation payloads, and notification
142
- delivery.
141
+ The
142
+ [Rails integration guide](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/RAILS.md)
143
+ covers every adapter, boot-time configuration, safe YAML loading,
144
+ instrumentation payloads, and notification delivery.
143
145
 
144
146
  ## Choose the right entry point
145
147
 
@@ -191,31 +193,34 @@ The gem owns normalization, validation, failure handling, and safe result
191
193
  merging. The application owns model selection, prompting, authentication,
192
194
  timeouts, retries, and transport. LLM analysis findings can add a violation but cannot clear a deterministic finding.
193
195
 
194
- See the [provider contract](docs/API.md#llm-provider-contract) and the
195
- [local HTTP example](examples/local_llm_provider.rb). The example works with
196
- an application-owned classifier sidecar backed by any inference runtime. Read
197
- the [model-suitability criteria](docs/OPERATIONS.md#model-suitability) before
198
- using semantic analysis as a blocking production control.
196
+ See the
197
+ [provider contract](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/API.md#llm-provider-contract)
198
+ and
199
+ [local HTTP example](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/local_llm_provider.rb).
200
+ The example works with an application-owned classifier sidecar backed by any
201
+ inference runtime. Read the
202
+ [model-suitability criteria](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/OPERATIONS.md#model-suitability)
203
+ before using semantic analysis as a blocking production control.
199
204
 
200
205
  ## Documentation
201
206
 
202
- - [Documentation index](docs/README.md)
203
- - [Policies and restricted content](docs/POLICIES.md)
204
- - [Rails integration](docs/RAILS.md)
205
- - [Operations and production behavior](docs/OPERATIONS.md)
206
- - [API reference](docs/API.md)
207
- - [Release runbook](docs/RELEASING.md)
208
- - [Security policy](SECURITY.md)
209
- - [Contributing](CONTRIBUTING.md)
207
+ - [Documentation index](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/README.md)
208
+ - [Policies and restricted content](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/POLICIES.md)
209
+ - [Rails integration](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/RAILS.md)
210
+ - [Operations and production behavior](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/OPERATIONS.md)
211
+ - [API reference](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/API.md)
212
+ - [Release runbook](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/RELEASING.md)
213
+ - [Security policy](https://github.com/Olyx-labs/olyx-guardrails/security/policy)
214
+ - [Contributing](https://github.com/Olyx-labs/olyx-guardrails/blob/master/CONTRIBUTING.md)
210
215
  - [Changelog](CHANGELOG.md)
211
216
 
212
217
  Examples:
213
218
 
214
- - [Framework-free Ruby](examples/ruby_only.rb)
215
- - [Custom policy](examples/custom_policy.rb)
216
- - [Rails opt-in boundaries](examples/rails_opt_in.rb)
217
- - [Local LLM provider](examples/local_llm_provider.rb)
218
- - [Notifier handlers](examples/notifier.rb)
219
+ - [Framework-free Ruby](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/ruby_only.rb)
220
+ - [Custom policy](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/custom_policy.rb)
221
+ - [Rails opt-in boundaries](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/rails_opt_in.rb)
222
+ - [Local LLM provider](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/local_llm_provider.rb)
223
+ - [Notifier handlers](https://github.com/Olyx-labs/olyx-guardrails/blob/master/examples/notifier.rb)
219
224
 
220
225
  The framework-free, custom-policy, and notifier examples run directly. The
221
226
  Rails example is application-context code, and the local provider example
@@ -239,9 +244,12 @@ boundary or data-loss-prevention system.
239
244
  centralized policy rollout, and audit retention remain application or
240
245
  platform responsibilities.
241
246
 
242
- The [operations guide](docs/OPERATIONS.md) describes failure modes, data
243
- handling, risk scores, concurrency, and deployment boundaries. Report security
244
- issues through [SECURITY.md](SECURITY.md), not the public issue tracker.
247
+ The
248
+ [operations guide](https://github.com/Olyx-labs/olyx-guardrails/blob/master/docs/OPERATIONS.md)
249
+ describes failure modes, data handling, risk scores, concurrency, and
250
+ deployment boundaries. Report security issues through the
251
+ [security policy](https://github.com/Olyx-labs/olyx-guardrails/security/policy),
252
+ not the public issue tracker.
245
253
 
246
254
  ## Development
247
255
 
@@ -255,7 +263,8 @@ bin/ci
255
263
  The development bundle includes Rails so contributors exercise the integration
256
264
  from the default test suite; Rails remains an optional runtime dependency for
257
265
  gem consumers. The Rails compatibility matrix is managed with Appraisal. See
258
- [CONTRIBUTING.md](CONTRIBUTING.md) before submitting a change.
266
+ [contribution guide](https://github.com/Olyx-labs/olyx-guardrails/blob/master/CONTRIBUTING.md)
267
+ before submitting a change.
259
268
 
260
269
  ## License
261
270
 
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'finding_presenter'
4
+ require_relative 'redaction_spans'
5
+ require_relative 'unmatched_transformer'
6
+
3
7
  module Olyx
4
8
  module Guardrails
5
9
  module PolicyComponents
@@ -9,7 +13,7 @@ module Olyx
9
13
 
10
14
  def call(source, findings, transform)
11
15
  {
12
- text: PolicyRedactor.call(source, findings, transform: transform),
16
+ text: UnmatchedTransformer.call(source, RedactionSpans.call(findings), transform),
13
17
  violated: findings.any?,
14
18
  findings: FindingPresenter.call(findings)
15
19
  }
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'policy/finding_presenter'
4
3
  require_relative 'policy/match_collector'
5
4
  require_relative 'policy/redaction_result'
6
5
  require_relative 'policy/scan_result'
7
- require_relative 'policy_redactor'
8
6
 
9
7
  module Olyx
10
8
  # Policy-driven safety checks and redaction for Ruby applications.
@@ -2,7 +2,6 @@
2
2
 
3
3
  require_relative '../policy'
4
4
  require_relative 'filter_parameters'
5
- require_relative 'path_value'
6
5
 
7
6
  module Olyx
8
7
  module Guardrails
@@ -18,7 +17,10 @@ module Olyx
18
17
  end
19
18
 
20
19
  def path(value)
21
- PathValue.call(value)
20
+ normalized = value.respond_to?(:to_path) ? value.to_path : value
21
+ return normalized.dup.freeze if normalized.is_a?(String) && !normalized.empty?
22
+
23
+ raise ArgumentError, 'Rails policy_path must be a path-like value'
22
24
  end
23
25
 
24
26
  def filter_parameters(value)
@@ -3,6 +3,6 @@
3
3
  module Olyx
4
4
  module Guardrails
5
5
  # The current gem version, following semantic versioning.
6
- VERSION = '1.1.0'
6
+ VERSION = '1.1.3'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: olyx-guardrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moses Njoroge
@@ -42,30 +42,10 @@ extensions: []
42
42
  extra_rdoc_files:
43
43
  - CHANGELOG.md
44
44
  - README.md
45
- - docs/API.md
46
- - docs/OPERATIONS.md
47
- - docs/POLICIES.md
48
- - docs/RAILS.md
49
- - docs/README.md
50
- - docs/RELEASING.md
51
45
  files:
52
46
  - CHANGELOG.md
53
- - CODE_OF_CONDUCT.md
54
- - CONTRIBUTING.md
55
47
  - LICENSE
56
48
  - README.md
57
- - SECURITY.md
58
- - docs/API.md
59
- - docs/OPERATIONS.md
60
- - docs/POLICIES.md
61
- - docs/RAILS.md
62
- - docs/README.md
63
- - docs/RELEASING.md
64
- - examples/custom_policy.rb
65
- - examples/local_llm_provider.rb
66
- - examples/notifier.rb
67
- - examples/rails_opt_in.rb
68
- - examples/ruby_only.rb
69
49
  - lib/generators/olyx_guardrails/install_generator.rb
70
50
  - lib/generators/olyx_guardrails/templates/initializer.rb.tt
71
51
  - lib/generators/olyx_guardrails/templates/policy.yml.tt
@@ -158,7 +138,6 @@ files:
158
138
  - lib/olyx/guardrails/policy/unmatched_segment_builder.rb
159
139
  - lib/olyx/guardrails/policy/unmatched_transformer.rb
160
140
  - lib/olyx/guardrails/policy_aware_redactor.rb
161
- - lib/olyx/guardrails/policy_redactor.rb
162
141
  - lib/olyx/guardrails/policy_rule.rb
163
142
  - lib/olyx/guardrails/policy_rule/configuration.rb
164
143
  - lib/olyx/guardrails/policy_rule/description_value.rb
@@ -195,7 +174,6 @@ files:
195
174
  - lib/olyx/guardrails/rails/job_argument.rb
196
175
  - lib/olyx/guardrails/rails/job_reference.rb
197
176
  - lib/olyx/guardrails/rails/notification_dispatcher.rb
198
- - lib/olyx/guardrails/rails/path_value.rb
199
177
  - lib/olyx/guardrails/rails/policy_document.rb
200
178
  - lib/olyx/guardrails/rails/policy_file.rb
201
179
  - lib/olyx/guardrails/rails/policy_file_error.rb
data/CODE_OF_CONDUCT.md DELETED
@@ -1,25 +0,0 @@
1
- # Code of Conduct
2
-
3
- ## Our commitment
4
-
5
- We are committed to a welcoming, professional, and harassment-free community
6
- for everyone, regardless of background, identity, experience, or ability.
7
-
8
- ## Expected behavior
9
-
10
- - Be respectful, constructive, and specific.
11
- - Assume good intent while addressing harmful impact.
12
- - Accept technical feedback without personal attacks.
13
- - Respect privacy and confidentiality.
14
- - Focus disagreement on ideas, evidence, and project outcomes.
15
-
16
- Harassment, discrimination, threats, sexualized conduct, sustained disruption, doxing, or publication of another person's private information are not acceptable.
17
-
18
- ## Enforcement
19
-
20
- Report conduct concerns privately to `conduct@olyxai.io`. Maintainers may edit
21
- or remove contributions, issue warnings, temporarily restrict participation, or
22
- permanently ban participants when necessary. Reports will be handled as
23
- confidentially as reasonably possible, with conflicts of interest recused.
24
-
25
- This policy applies in project spaces and when someone is publicly representing the project.
data/CONTRIBUTING.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributing
2
-
3
- Thank you for improving Olyx Guardrails.
4
-
5
- ## Development setup
6
-
7
- Detection logic (`lib/olyx/guardrails/pii/`, `secrets/`, `injection_detector.rb`,
8
- `policy*`, and friends) remains independent of Rails at gem runtime. The
9
- repository installs Rails as a development and test dependency so every
10
- contributor runs the integration tests from the same default bundle. Consuming
11
- applications that use only `require "olyx/guardrails"` do not load Rails.
12
-
13
- Prepare the complete development bundle:
14
-
15
- ```bash
16
- rbenv install
17
- bin/setup
18
- ```
19
-
20
- Run the complete pre-pull-request gate:
21
-
22
- ```bash
23
- bin/ci
24
- ```
25
-
26
- `bin/ci` runs coverage-enforced tests, documentation validation, public RDoc
27
- coverage, RuboCop, RubyCritic, and the strict per-file quality gate. Individual
28
- tests remain runnable through `bundle exec ruby -Itest path/to/test_file.rb`.
29
- CI separately refreshes the Ruby advisory database and audits the committed
30
- dependency lockfile. This network-backed check stays outside `bin/ci` so the
31
- local quality gate remains reproducible offline after setup.
32
-
33
- ### Rails adapter changes
34
-
35
- ```bash
36
- bundle exec appraisal rake test
37
- ```
38
-
39
- Run this in addition to the above only when the change touches
40
- `lib/olyx/guardrails/rails/`, `lib/generators/`, or their tests. The Appraisal
41
- matrix covers Rails 8.0 and 8.1; Rails integration changes must pass every
42
- configured line while the standalone core remains free of Rails runtime
43
- dependencies.
44
-
45
- Ruby 3.4 or newer is supported. Changes must remain compatible with the oldest
46
- supported Ruby unless the same pull request deliberately changes the gem's
47
- requirement.
48
-
49
- RubyCritic is a blocking regression gate configured in `.rubycritic.yml`.
50
- Do not lower its baseline to merge a change. Refactor new hot spots and ratchet
51
- the minimum upward when sustained improvements raise the measured score.
52
- The minimum score is 95; new files must remain focused on one reason to change,
53
- and every production file must remain A-rated. RubyCritic smells, duplication,
54
- and per-file complexity are review signals, not automatic design instructions:
55
- address genuine responsibility or clarity problems, but do not introduce proxy
56
- methods, unnecessary indirection, or metaprogramming merely to silence a
57
- heuristic.
58
-
59
- RuboCop's `Metrics/AbcSize` (max 10), `Metrics/CyclomaticComplexity` (max 7),
60
- `Metrics/PerceivedComplexity` (max 7), and `Metrics/ClassLength` (max 60 lines)
61
- are the blocking structural-complexity gate, calibrated against this
62
- codebase's measured distribution rather than RuboCop's looser defaults. Do not
63
- split cohesive code, hide behavior behind dynamic dispatch, or weaken a public
64
- API merely to improve a score. A public DSL or metaprogramming macro that
65
- genuinely needs more room is a `# rubocop:disable` with an inline reason, or a
66
- file-level exclude in `.rubocop.yml` with a comment explaining the constraint
67
- — reviewed like any other exception, not a separate exemption file.
68
-
69
- ## Documentation
70
-
71
- Public documentation follows the same contract discipline as production code:
72
-
73
- - write simple, declarative sentences in the present tense;
74
- - keep the README focused on the shortest correct integration;
75
- - place task-oriented explanations in the appropriate guide;
76
- - keep signatures, defaults, return shapes, and exceptions in `docs/API.md`;
77
- - use complete, copyable examples with synthetic data;
78
- - link to one canonical explanation instead of duplicating it; and
79
- - update documentation and tests in the same change as public behavior.
80
-
81
- Run `ruby script/documentation_gate.rb` after changing Markdown. The gate checks
82
- local files and heading anchors. CI also syntax-checks every Ruby example.
83
-
84
- Public code comments use native RDoc conventions and the same concise,
85
- declarative style. Document behavior, accepted arguments, return values,
86
- exceptions, security boundaries, and non-obvious edge cases. Do not narrate
87
- implementation mechanics or repeat the method name. Add supported source files
88
- to the RDoc whitelist in `olyx-guardrails.gemspec`; implementation-only
89
- constants remain outside that manifest and are not compatibility commitments.
90
-
91
- ## Pull requests
92
-
93
- Contributions follow the same fork-and-pull-request workflow used by established
94
- open-source projects:
95
-
96
- 1. Open an issue first for substantial API, policy, or architectural changes.
97
- Small fixes may go directly to a pull request.
98
- 2. Fork the repository and create a focused branch from the latest `master`.
99
- Do not work directly on `master`.
100
- 3. Add tests for behavior changes and adversarial regression tests for
101
- security-sensitive fixes.
102
- 4. Update README, API reference, examples, and changelog when public behavior
103
- changes.
104
- 5. Run `bin/ci` locally, plus the Appraisal Rails matrix when the change touches
105
- `lib/olyx/guardrails/rails/` or `lib/generators/`.
106
- 6. Open a draft pull request early when maintainer feedback would prevent
107
- rework. Mark it ready only when its description and validation checklist are
108
- complete.
109
-
110
- Pull requests run with read-only GitHub token permissions, including
111
- contributions from forks. CI never requires repository secrets. The protected
112
- default branch requires the supported Ruby and Rails matrix, dependency audit,
113
- quality gate, CodeQL analysis, resolved review conversations, and maintainer
114
- approval. Maintainers squash approved pull requests, and GitHub deletes the
115
- source branch after merge.
116
-
117
- Maintainers may ask for a pull request to be split when unrelated behavior,
118
- refactoring, or generated dependency changes make review unsafe. Force-pushing
119
- a contributor branch is acceptable while responding to review; GitHub
120
- dismisses stale approvals when the protected branch changes.
121
-
122
- Maintainer releases follow [docs/RELEASING.md](docs/RELEASING.md). Do not
123
- publish an artifact that has not completed that runbook.
124
-
125
- Never include real credentials, personal data, production endpoints, or
126
- customer content in fixtures. Use clearly synthetic values.
127
-
128
- By submitting a contribution, you agree that it is licensed under the
129
- Apache-2.0 license used by this project.
130
-
131
- Security vulnerabilities must follow [SECURITY.md](SECURITY.md), not the public
132
- issue tracker.
data/SECURITY.md DELETED
@@ -1,61 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported versions
4
-
5
- Security fixes are provided for the latest released minor version. Users should
6
- upgrade to the latest patch release before reporting an issue.
7
-
8
- | Version | Supported |
9
- |---|---|
10
- | 1.1.x | Yes |
11
- | <= 1.0 | No |
12
-
13
- ## Reporting a vulnerability
14
-
15
- Do not open a public issue for a suspected vulnerability.
16
-
17
- Use a
18
- [private GitHub security advisory](https://github.com/Olyx-labs/olyx-guardrails/security/advisories/new)
19
- or email `mosesnjoroge@olyxai.io` with:
20
-
21
- - the affected version and component;
22
- - reproduction steps or a minimal proof of concept;
23
- - expected and observed behavior;
24
- - the potential confidentiality, integrity, or availability impact; and
25
- - any suggested remediation or disclosure constraints;
26
- - whether the issue is already public; and
27
- - a secure contact method for follow-up.
28
-
29
- You should receive an acknowledgement within three business days and an initial
30
- assessment within seven business days. We will coordinate remediation and
31
- disclosure with the reporter.
32
-
33
- ## Response process
34
-
35
- After triage, the maintainer will:
36
-
37
- 1. confirm the affected supported versions and severity;
38
- 2. reproduce the issue using synthetic data;
39
- 3. develop a fix and adversarial regression test in private;
40
- 4. prepare release notes and upgrade guidance;
41
- 5. publish a patched gem; and
42
- 6. disclose the issue after supported users can upgrade.
43
-
44
- Timelines after the initial assessment depend on severity, exploitability, and
45
- release coordination. The reporter receives material status changes through
46
- the private reporting channel.
47
-
48
- ## Safe research
49
-
50
- Good-faith research must use systems and data the researcher owns or has
51
- permission to test. Do not access another person's data, degrade a service,
52
- perform denial-of-service testing, use social engineering, or publicly disclose
53
- an unpatched issue. Reports that follow these boundaries will not be pursued
54
- for accidental, non-destructive violations of this policy.
55
-
56
- ## Scope notes
57
-
58
- Pattern-based guardrails are defense-in-depth controls, not complete semantic
59
- security boundaries. Documented detection limitations alone are not
60
- vulnerabilities, but bypasses of a documented invariant—especially redaction,
61
- blocking, or third-party data-egress guarantees—are in scope.