Skip to content

build(deps): replace serde_yaml with serde-saphyr - #144

Merged
polaz merged 2 commits into
mainfrom
build/#143-serde-saphyr
Oct 12, 2026
Merged

polaz merged 2 commits into
mainfrom
build/#143-serde-saphyr

Conversation

@polaz

@polaz polaz commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replaces the deprecated serde_yaml (and its unmaintained unsafe-libyaml, RUSTSEC-2024-0449) with serde-saphyr, a YAML deserializer in safe Rust, so cargo deny check advisories passes for consumers of this crate.
  • The accepted configuration format, the error messages and the unknown-key warnings stay as they were.

Changes

  • config::parse_yaml: the one YAML reader of every config path (ProxyConfig::from_yaml_str, ProxyServer::from_yaml_str, config::from_yaml, the binary's runtime: section). It reads with the YAML 1.2 core schema's types: booleans are true/false in any letter case (yes/on are refused), an unquoted number or boolean where text is expected is an error, repeated keys and extra documents are refused, and JSON text parses as before.
  • Errors name the key path (runtime.worker_threads: ...) through serde_path_to_error (already in the tree through axum) and stay on one line.
  • unknown_config_keys reads the top-level and streaming: keys in document order without a YAML value type, skipping number or boolean keys; moved_setting keeps the shield.trusted_proxies hint.
  • The protox dev-dependency moves to 0.10.

Testing

Formatting, clippy and the test suite pass for every CI feature set (rust_crypto, aws_lc_rs, injected verifier, all features), together with doc tests, the MSRV 1.99 check, the publish dry-run and the advisory audit; serde_yaml and unsafe-libyaml are absent from the dependency tree with every feature.

Closes #143

serde_yaml is deprecated and pulls in unsafe-libyaml, which RustSec
reports as unmaintained (RUSTSEC-2024-0449), so every consumer running
`cargo deny check advisories` failed through this crate.

- Every config path (ProxyConfig, the transcoding settings, the
  sections handed to builders, the binary's `runtime:`) reads YAML
  through one reader on serde-saphyr, safe Rust, deserialization only.
- Booleans stay YAML 1.2 (`true`/`false`; `yes`/`on` are refused), JSON
  text keeps parsing, repeated keys and extra documents are refused.
- Errors still name the key path (`runtime.worker_threads: ...`) via
  serde_path_to_error, already in the tree through axum, on one line.
- The unknown-key warnings read the keys in document order without a
  YAML value type; the moved `shield.trusted_proxies` hint is kept.
- Bump the protox dev-dependency to 0.10.

Closes #143
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T18:46:53.116499Z f4f2b7e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f6225a0b-0216-455b-b8cb-5a0e0b2eea85

📥 Commits

Reviewing files that changed from the base of the PR and between 0cb3fc5 and f4f2b7e.


📒 Files selected for processing (2)
  • src/config.rs
  • src/config/tests.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 52e3b597-0699-4497-901e-51c774bb0246

📥 Commits

Reviewing files that changed from the base of the PR and between 440dd47 and 0cb3fc5.


📒 Files selected for processing (9)
  • Cargo.toml
  • src/auth/tests.rs
  • src/config.rs
  • src/config/tests.rs
  • src/lib.rs
  • src/openapi/tests.rs
  • src/runtime.rs
  • src/tests.rs
  • src/transcode/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • Configuration
    • Configuration files now follow YAML 1.2 boolean rules: yes, no, on, and off are not treated as booleans.
    • JSON configuration input is supported.
    • Invalid configuration errors can identify the affected field and provide concise, single-line messages.
    • Repeated keys and multi-document YAML are rejected; empty documents use default settings.
    • Unknown configuration keys are reported in their original order. The existing migration error for shield.trusted_proxies continues to identify its new location.
📝 Summary
📝 Summary

Walkthrough

Configuration YAML parsing now uses serde-saphyr through a shared parser. The parser adds strict boolean handling and path-aware errors. Unknown-key inspection and moved-setting detection use deserializers, and configuration entry points and tests use the shared parser.

Changes

Configuration YAML parsing

Layer / File(s) Summary
Shared parser and configuration entry points
Cargo.toml, src/config.rs, src/runtime.rs, src/lib.rs, src/config/tests.rs
The configuration parser uses serde-saphyr, strict YAML 1.2 boolean parsing, and path-aware errors. Configuration entry points use the shared parser. Tests cover JSON input, parsing errors, empty documents, duplicate keys, and multiple documents.
Unknown keys and moved settings
src/config.rs, src/config/tests.rs
Unknown keys retain document order, and nested streaming keys include the streaming. prefix. Moved-setting detection identifies shield.trusted_proxies, including when its value is null.
Parser adoption and test updates
src/auth/tests.rs, src/openapi/tests.rs, src/tests.rs, src/transcode/tests.rs, Cargo.toml
Tests in auth, OpenAPI, server, and transcoding use the shared parser. The protox development dependency is upgraded from 0.9 to 0.10.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 0cb3f

No identified issue blocks merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check Warning The protox dev-dependency changes from 0.9 to 0.10. The reviewed evidence does not connect this test-protobuf dependency update to the YAML replacement or to issue #143. The YAML parser changes, par… Revert the protox version change unless the author provides evidence that version 0.10 is required for the YAML replacement or its in-scope tests.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #143 requires replacement of serde_yaml, preserved configuration parsing, preserved unknown-key warnings, and removal of serde_yaml and unsafe-libyaml. Cargo.toml uses serde-saphyr wit…
Docstring Coverage Passed Docstring coverage is 82.46% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 8 files. (1 skipped: 1 …
Title check Passed The title clearly and concisely identifies the main change: replacing serde_yaml with serde-saphyr.
Description check Passed The description directly explains the dependency replacement, configuration parsing changes, testing, and advisory-remediation objective.

Full details: Out of Scope Changes check

Explanation

The protox dev-dependency changes from 0.9 to 0.10. The reviewed evidence does not connect this test-protobuf dependency update to the YAML replacement or to issue #143. The YAML parser changes, parser tests, and test call-site updates are in scope.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cb3fc5968

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config.rs
Comment thread src/config.rs
The YAML reader took an unquoted scalar for the text it spells wherever
the setting is a string, so `service: { name: true }` or
`forwarded_headers: [123]` loaded as "true" and "123" instead of failing
as they did before. It now reads with the YAML 1.2 core schema's types:
such a value is an error naming its key, and quoting it keeps the text.

- The unknown-key warnings skip a number or boolean key instead of
  failing on it, so the typos beside it are still reported.
- Regression tests cover the refused scalars, the quoted forms, the
  case variants of `true`/`false` that stay accepted, and the packaged
  config template.
@polaz
polaz merged commit fe6c104 into main Oct 12, 2026
10 checks passed
@polaz
polaz deleted the build/#143-serde-saphyr branch October 12, 2026 19:34
@sw-release-bot sw-release-bot Bot mentioned this pull request Oct 12, 2026
polaz pushed a commit that referenced this pull request Oct 12, 2026
## 🤖 New release

* `structured-proxy`: 8.1.1 -> 8.1.2 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[8.1.2](v8.1.1...v8.1.2)
- 2026-10-12

### Other

- *(deps)* replace serde_yaml with serde-saphyr
([#144](#144))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: sw-release-bot[bot] <255865126+sw-release-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(deps): replace serde_yaml with serde-saphyr

1 participant