Repository navigation
feat(crypto): add a system OpenSSL backend and dependency guardrails - #4843
varshaprasad96 wants to merge 7 commits into
Conversation
|
Update: PR is ready for review. |
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
f4d8476 to
7197360
Compare
There was a problem hiding this comment.
Another iteration needed: 3 major, 16 minor (inline, 2 below)
The deciding items are the unvalidated RSA public exponent in the JWT adapter (a malformed JWK makes signatures forgeable), the unchecked EC key import, and the reachable startup panic on the OpenSSL path. The rest is consistency and guardrail polish.
Outside the diff:
- Major:
crates/openshell-crypto/src/tls.rs:69and:85: with the OpenSSL backend selected, a host whose OpenSSL config leaves no usable cipher suites makes the first facadeclient_builder()/server_builder()call hit.expect("selected TLS provider must support the requested protocol versions"), aborting the process instead of returning a config error, across ~17 runtime call sites (gateway TLS, sandbox boundary server, vault driver). The AWS-LC default can't hit this because its cipher list is static. The README documents the assert as a tradeoff, so either confirm that's intended for this backend or add a fallible variant. - Minor: process: #4809 is
state:triage-neededrather thanstate:accepted, so the PR Issue Acceptance gate fails and Branch Checks, including this PR's new CI steps, have never run on any push. A maintainer needs to accept the issue before merge.
How this was reviewed
- Commit
71973605b, round 1 - Deep review, because the change touches crypto primitives and protocol adapters, CI workflows, and build/dependency tooling (
crates/openshell-crypto/**,.github/workflows/branch-checks.yml,deny.toml,tasks/**) - Passes: architecture, performance, security, scalability, rust, kernel, supply-chain, then correctness
- Independent skeptics checked each candidate finding (1 per minor candidate); 6 of 8 held up
- Repo rules read from
origin/main: AGENTS.md, CLAUDE.md, CONTRIBUTING.md, docs/CONTRIBUTING.mdx - Not covered: Linux CI and downstream RHEL validation (not run for this branch, per the PR description); Branch Checks on any push (the acceptance gate blocks
/ok to test), so the new CI lanes are unexercised; local compile, clippy, and cargo-deny runs stood in
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
|
RSA certificate-key import appears to have another validation gap: the Id::RSA arm in Key::wrap extracts the public key without enforcing a minimum key size. I tested a 1024-bit RSA key: both PEM and PKCS#8 DER imports succeed with OpenSSL, while the existing AWS-LC backend rejects both. The imported OpenSSL key can also successfully issue a certificate. Could we preserve the existing minimum RSA key size here and add rejection tests for both import formats? The JWT adapter already enforces a 2048-bit minimum, but that check does not cover certificate-key imports. |
Ygnas
left a comment
There was a problem hiding this comment.
One issue remains in the RSA PKI import path: imported keys are wrapped without enforcing the established 2048–8192-bit range. SandboxCa::from_pem uses those keys to sign proxy leaf certificates, so an OpenSSL-selected deployment can accept a weaker CA key than the existing AWS-LC path. Could we enforce the same range on RSA imports and cover PEM and PKCS#8 paths with regression tests?
|
Thanks for this. The backend is careful in the places that usually go wrong: zeroizing the tentative plaintext on Correctness questions
Test coverage
CI and linkage
Scope
Dependencies
|
@2000krysztof Thanks for catching this. You’re right—the JWT validation doesn’t cover RSA certificate-key imports. I checked the current code, and this gap remains. I’ll add the 2048-bit minimum at the shared PKI import boundary, with rejection tests for 1024-bit keys in both PEM and PKCS#8 DER formats and positive coverage for valid keys. |
Thanks, Ignas. Agreed, the PKI import path should enforce the full 2048–8192-bit range. I’ve added that check at the shared wrapping boundary, with regression coverage for both PEM and PKCS#8 DER imports |
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
|
@politerealism Thanks for the review comments: Addressed the requests:
RSA import bounds and bidirectional RSA/PSS coverage were already fixed. |
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
|
@EmilienM thanks for the detailed review. I’ve pushed fixes for the RSA exponent validation, EC key consistency checks, and fallible TLS setup, along with the minor code, test, and CI improvements. The upstream stderr limitation is documented, and the expected unused-wrapper warning is explicitly acknowledged. Local tests and checks pass; CI still needs maintainer acceptance of #4809 (it would be helpful if a maintainer can add that label). Reg the cargo-deny rules to be split in separate PR: I had intentionally introduced it here as it was also raised in an earlier architecture discussion, and enforcing the openshell-crypto boundary is part of the intended design. Keeping it alongside the OpenSSL backend helps prevent new dependencies from bypassing that boundary. To keep the scope bounded, further crypto migrations, policy expansion, and the remaining adapter limitations can follow in separate PRs. Does that work fine? |
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Summary
Add an opt-in system-OpenSSL implementation of the crypto interface merged in #3351. Embedders can enable
openssland install anOpenSslcontext before crypto initialization; AWS-LC remains the application default.This implements the backend foundation demonstrated by the PoC. Application-wide transport selection, downstream packaging, and Red Hat FIPS qualification remain follow-ups; strict FIPS requests continue to fail closed.
Related Issue
Closes #4809
Changes
Release Notes
Embedders can opt into the system-OpenSSL backend; AWS-LC remains the application default.
Testing
libssl.3.dylibandlibcrypto.3.dylib.Local verification used macOS ARM64. Pre-commit hooks passed when the commits were created; after rebasing onto upstream
ea13dfce4, OpenSSL-only and dual-backend tests, dependency-policy checks, and all tracked lockfiles were revalidated. No whole-application or cluster E2E claim is made. P-521 certificate keys remain unsupported by this backend because the rcgen descriptor is AWS-LC-gated. Protocol adapters retain infallible callbacks and provider-ownership limitations documented in the crypto README.Checklist