[5.21.0] - 2026-04-21
๐ Features
PKCS#11 Enhancements
cosmian_pkcs11_verifydiagnostic binary: new standalone tool that dynamically loadslibcosmian_pkcs11.sovia the standard PKCS#11 C API and validatesckms.tomlloading and KMS server reachability; enumerates all supported object classes with per-class counts; supports OIDC/JWT bearer-token auth via--token <JWT>orCOSMIAN_PKCS11_TOKENenv var- Oracle TDE wallet migration support: remove
CKF_WRITE_PROTECTEDfrom token flags; addCKM_AES_KEY_GEN,CKM_AES_CBC,CKM_AES_CBC_PADto the supported mechanism list; enables both forward (software โ HSM) and reverse (HSM โ software) wallet migrations - Standalone PKCS#11 ZIP package:
cosmian_pkcs11_verify,libcosmian_pkcs11.{so,dylib}, and signing key bundled in a signed cross-platform ZIP and published topackage.cosmian.com
Web UI
- Formalised connection states: the UI now explicitly handles five states โ DEV unrestricted mode, no KMS server reachable, server with no auth, mTLS (certificate) auth, and JWT/OIDC auth (including combined JWT+mTLS)
- No-auth warning banner: displays a clear banner when the KMS is started without authentication
- mTLS login page: shows a clear error when no valid client certificate is provided, instead of silently looping
๐ Security
- EXT2-1/A04-1: Reduce HTTP payload size limit from 10 GB to 64 MB (
PayloadConfigandJsonConfig) to prevent memory exhaustion DoS - EXT2-2/A03-2: Add recursion depth limit (
MAX_TTLV_DEPTH = 64) to TTLV binary parser to prevent stack-overflow DoS via deeply-nested structures - EXT2-3/A03-3: Add stack-depth limit (
MAX_XML_STACK_DEPTH = 64) to TTLV XML deserializer to prevent DoS via deeply-nested XML - EXT2-4/A04-3: Add
MAX_LOCATE_ITEMS = 1000server-side cap inlocate.rs; effective limit ismin(client_requested_max, 1000) - EXT2-5/A04-2: Add rate-limiting middleware (
actix-governor) controlled byKMS_RATE_LIMIT_PER_SECOND/rate_limit_per_second; disabled by default - EXT1-1: Change
derive_pbkdf2andderive_hkdfreturn types toZeroizing<Vec<u8>>so derived key bytes are scrubbed from memory on drop - TTLV OOM guard: Add
MAX_TTLV_FIELD_BYTES = 64 MiBper-field length guard toTTLVBytesDeserializer;ByteString,TextString, andBigIntegerreject oversized length claims before any allocation - A01-1/A05-1: Replace
Cors::permissive()on the main KMIP scope withCors::default()restricted tocors_allowed_origins; addcors_allowed_originsconfig field (envKMS_CORS_ALLOWED_ORIGINS) - A07-1: Reject symmetric JWT algorithms (HS256/HS384/HS512) via an explicit asymmetric-only allowlist; explicitly pin
validation.algorithmsto prevent confusion attacks - A07-2: Replace plain
==API-token comparison with constant-timesubtle::ConstantTimeEqto eliminate timing side-channel - A07-4: Change session cookie
SameSiteattribute fromNonetoStrictto prevent CSRF attacks - A07-5: Add
validate_jwks_uris_are_https()startup guard; any non-HTTPS JWKS URI causes the server to refuse to start (gated behind#[cfg(not(feature = "insecure"))]) - A08-2: Emit a startup
warn!whenui_session_saltis not configured - A09-1: Mask database URL passwords in
MainDBConfig::Displayusing a URL-parser-basedmask_db_url_password()helper - A09-2: Replace dot-only TLS P12 password masking with a proper
[****]redaction - A09-3: Change
debug!towarn!for all 401-unauthorized paths injwt_token_auth.rs - A10-2/A10-3: Build
reqwestHTTP client withredirect::Policy::none()in the JWKS fetcher and UI OAuth token exchange to prevent SSRF via crafted redirects - SSDF PW.5.1: Add
[[bans.features]]entry indeny.tomlbanningserde_json::unbounded_depth
๐ Bug Fixes
Server / Auth
- Stale session cookie warnings: session cookie key is now derived deterministically from the public URL instead of being regenerated randomly each start; configure
ui_session_saltfor multi-instance deployments - Header crash on partial server-info response: guard
serverInfo?.hsmbefore accessinghsm.configured
Web UI
- E2E test race condition: fixed non-deterministic sitemap test failures caused by the initial render briefly showing the error page before auth resolved
- Dev setup login crash: fixed a crash in the dev setup OAuth flow despite valid credentials
- OAuth/OIDC: multiple fixes to the OAuth interface, mostly dev-only scenarios; removed misleading "JWT is enabled" message
Logging / Startup
HttpConfig::Display: no longer hardcodeshttp://; a newscheme()helper returns the correct scheme based on TLS config;ClapConfig::Debugnow logs the correcthttps://orhttp://URL
๐ Documentation
Oracle TDE / PKCS#11
- Rewrite Mode 1 and Mode 2 architecture diagrams (Mermaid); expand "HSM Identity and Authentication" section clarifying
libcosmian_pkcs11.soproxy role; add environment variable reference table; add "OIDC / JWT Keystore Authentication" section; add "Wallet Migration" section covering forward and reverse migrations
Web UI
configuration/ui.md: document the five UI connection states and the Certificate Authentication (mTLS) setup
๐งช Testing
- PKCS#11: add integration tests
test_pkcs11_oidc_login_full_sequence,test_pkcs11_migrate_software_to_hsm, andtest_pkcs11_reverse_migrate_hsm_to_software(non-fips) - KMIP wire edge cases: 25 binary wire tests (W1โW25), 3 TTLV OOM-guard tests (W26โW28), and 18 XML edge-case tests (X1โX18)
- Security regression tests: JWT algorithm allowlist (A1โA6), CORS no-wildcard policy (C1โC3), privilege bypass (PB1โPB4), KMIP batch abuse (B1โB5), JWKS SSRF (SR1โSR2), DB URL masking (N1โN5), JWKS HTTPS startup guard (J1โJ4)
- CLI adversarial payloads: 15 wire-payload tests (S1โS15) โ empty, truncated, garbage, deeply-nested TTLV, malformed JSON, 1 MB random binary
- HSM: fix flaky SIGSEGV in
test_hsm_*_allby sharing a singleBaseHsmandArc<SlotManager>instance per test run instead of repeatedC_Initialize/C_Finalize/dlopen/dlclosecycles
๐ Refactor
- Move CLI crates to
crate/clients/subdirectory; flattenkms/subdirectory under actions and tests; renamecosmian_kms_cliโcosmian_kms_cli_actions
๐ง CI
- Automated release workflow (
release.yml): newworkflow_dispatchworkflow that fully automates the release flow โ creates therelease/<version>branch, bumps all versions viarelease.sh --ci, regenerates the CBOM, updates Nix vendor hashes, triggers packaging, retrieves SBOMs, pushes the annotated tag, and performs git-flow finalisation - PKCS#11 build fix: add explicit
cargo build -p cosmian_pkcs11 --features non-fipsstep before workspace lib tests inmain_base.yml,cargo_test.ps1, andcommon.shsolibcosmian_pkcs11.{so,dylib,dll}exists at test time - Oracle TDE CI: fix migration test order (reverse before forward), handle
ORA-28354(wallet already open) as non-fatal, removeWITH BACKUPfrom SWโHSM migration to avoidORA-46623 - Pin pnpm to
10.17.1across all CI environments (ui/package.json,test_ui.sh,build_ui.sh,test_wasm.sh,test_windows.yml) to preventERR_PNPM_LOCKFILE_CONFIG_MISMATCH - Windows
test_ui.ps1: fix KMS log file paths, add--frozen-lockfiletopnpm install, fix PowerShell 7+ readiness check (Invoke-WebRequestexception handling) pkcs11-zipadded to default Linux package types innix.shso ZIP artifacts are built and published correctly- Update macOS Nix CLI vendor hash files (
cli.vendor.*.darwin.sha256) after PKCS#11 loader dependency additions