Skip to content

security: remediate two review passes + harden REST/JSON-RPC macros - #25

Open
JedimEmO wants to merge 2 commits into
masterfrom
security/review-remediation-2026-08
Open

security: remediate two review passes + harden REST/JSON-RPC macros#25
JedimEmO wants to merge 2 commits into
masterfrom
security/review-remediation-2026-08

Conversation

@JedimEmO

Copy link
Copy Markdown
Owner

Summary

Consolidates three security/quality workstreams onto one branch. The tree is green throughout: 855 tests pass, clippy -D warnings clean, cargo deny check advisories + cargo audit clean. Crate versions are bumped and the { path, version } requirements cascaded per VERSIONING.md.

1. External security review remediation (H1–H4, M1–M6, L1–L3, D1)

Every code-level claim in the review was verified true; overstated severities were downscoped rather than inflated.

  • H1 OAuth2 reserved-parameter denylist · H2 cookie auth requires CSRF (validate() fails closed; with_cookie / generated auth_cookie auto-install a default CsrfConfig) · H3 WebSocket/upgrade errors sanitized (ServerError::client_message()) · H4 oauth2-demo hardened (fragment token delivery, binding cookie, CORS pinned, admin gated on email_verified).
  • M1 JSON-RPC 403 no longer leaks the caller's grant set · M2 default OAuth start-flow binds against login CSRF · M3 optional iss/aud on JWT sessions · M4 an empty permission group can no longer grant any authenticated user (runtime deny + compile error in all four macros) · M5 WS bearer extraction matches HTTP · M6 id_token issuer/sub/azp fail closed.
  • L1 redacting Debug for secrets · L2 constant-time CSRF compare · L3 README wording.

2. rest_service! hardening + jsonrpc_service! parity

From a device-integration adopter's feedback, then mirrored in JSON-RPC:

  • Content-Type enforcement (415, opt-out require_json_content_type), malformed-body and rejection logging, docs_require_auth gate, per-endpoint body_limit and opt-in headers, empty 204/205 body, 413-vs-400 split, and a build-time auth-provider assertion.

3. Multi-agent review remediation

A 4-agent review of the branch surfaced 28 findings (0 critical, no auth bypass in the default stack). Fixed the real ones:

  • 204 empty body no longer breaks the generated client for non-unit response types (deserializes empty as null).
  • OAuth2 request-object denylist (request/request_uri/response_mode/…) + id_token sub requirement (fail-closed binding).
  • CsrfConfig::validate() rejects CORS-safelisted header names (the header_presence_only footgun).
  • REST generated code logs via a ras_rest_core::tracing re-export — no undeclared consumer dependency (parity with the JSON-RPC fix).
  • All documented dependency version pins re-synced; six re-exporting crates bumped to 0.2.0 + cascade.

Verification

cargo test --workspace            # 855 passed, 0 failed
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo deny check advisories       # advisories ok
cargo audit                       # exit 0

🤖 Generated with Claude Code

JedimEmO and others added 2 commits August 18, 2026 22:19
Consolidates the security/review-remediation-2026-08 branch: remediation of an
external security review, device-integration hardening of rest_service! with
jsonrpc_service! parity, and the follow-up fixes from a multi-agent code review.
Version bumps + cascaded {path,version} requirements per VERSIONING.md.

External security review (H1-H4, M1-M6, L1-L3, D1):
- H1 OAuth2 reserved-parameter denylist; H2 cookie auth requires CSRF
  (validate() fails closed; builders auto-install a default CsrfConfig);
  H3 WebSocket/upgrade errors sanitized; H4 oauth2-demo hardened.
- M1 JSON-RPC 403 no longer leaks the caller's grant set; M2 default OAuth
  start-flow binds against login CSRF; M3 optional iss/aud on JWT sessions;
  M4 an empty permission group can no longer grant any authenticated user
  (runtime deny + compile error in all four macros); M5 WS bearer extraction
  matches HTTP; M6 id_token issuer/sub/azp checks fail closed.
- L1 redacting Debug for secrets; L2 constant-time CSRF compare; L3 doc fix.

rest_service! hardening + jsonrpc_service! parity:
- Content-Type enforcement (415, opt-out require_json_content_type); rejection
  and malformed-body logging; docs_require_auth gate; per-endpoint body_limit
  and opt-in headers; 204/205 empty body; 413-vs-400 split; build-time
  auth-provider assertion.

Multi-agent review remediation:
- 204 empty body no longer breaks the generated client for non-unit response
  types; OAuth2 request-object denylist + id_token `sub` requirement; CsrfConfig
  rejects CORS-safelisted header names; REST logs via a ras_rest_core::tracing
  re-export (no undeclared consumer dependency); documented version pins
  re-synced; six re-exporting crates bumped to 0.2.0 + cascade.

Full workspace: 855 tests pass, clippy -D warnings clean, cargo deny/audit clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Ingests the one library-relevant open Dependabot advisory: opentelemetry_sdk
0.32.0 -> 0.32.1, used by the published ras-observability-otel crate.
quinn-proto was already bumped to 0.11.16 (>= the 0.11.15 fix) earlier on this
branch. The remaining open alerts are npm build-tooling in the wasm-ui-demo
example only (vite/postcss/brace-expansion/tar), not on any published crate.

cargo deny check advisories + cargo audit clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

1 participant