Conversation
Contributor
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit dec2ca3. ⛔ Hard block: Issues at High severity or above will block this PR from merging.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
Introduces gradle/fips.gradle as the single place where FIPS mode is decided and applied to the build's test surface: which test classes exist in each mode and the JVM arguments test workers need to actually be in FIPS mode. Mode is driven by the OPENSEARCH_FIPS_MODE environment variable, surfaced to production code through the new FipsMode enum. BC FIPS artifacts move to compileOnly in both modes (they are provided by OpenSearch core), bctls-fips is added, and the securityadmin standalone bundles now ship the BC FIPS jars in deps/. Because java_test.security registers BouncyCastleFipsProvider in every test JVM -- including non-FIPS runs -- any suite that touches JCA now leaves a "BC FIPS Entropy Daemon" thread behind, which RandomizedRunner reports as a leak. BCFipsEntropyDaemonFilter covers it; the framework's BouncyCastleThreadFilter does not. It is applied to the suites that trip over it here, and reused by later FIPS work. No FIPS variant test classes exist yet, so this otherwise lands inert: the default build is unchanged and fips.gradle currently selects nothing. Signed-off-by: Iwan Igonin <iigonin@sternad.de> Co-authored-by: Benny Goerzig <benny.goerzig@sap.com> Co-authored-by: Karsten Schnitter <k.schnitter@sap.com> Co-authored-by: Kai Sternad <k.sternad@sternad.de>
Replaces the isPkcs11()-style branching in the SSL configuration layer with sealed pem/jdk/pkcs11 records for both key stores and trust stores, and moves PKCS#11 dispatch into those records. Store passwords are wrapped in a StorePassword type so they are redacted in toString() rather than leaking into logs. A PKCS#11 store lives on the token rather than on disk, so the path becomes optional throughout: KeyStoreUtils loads such stores with a null stream, and error messages name the token instead of a file. PemKeyReader learns the PKCS11 store type and validates that a PKCS#11 provider is actually registered. Trust store settings that a PKCS#11 configuration ignores now produce a warning instead of being silently dropped. Signed-off-by: Iwan Igonin <iigonin@sternad.de> Co-authored-by: Benny Goerzig <benny.goerzig@sap.com> Co-authored-by: Karsten Schnitter <k.schnitter@sap.com> Co-authored-by: Kai Sternad <k.sternad@sternad.de>
…ader JNDI's LDAP provider never passes the target hostname to the SSLSocketFactory it instantiates (bcgit/bc-java#460), so an ldaps connection could not present an SNI extension and servers doing name-based virtual hosting returned the wrong certificate. SNISettingTLSSocketFactory carries the hostname through a ThreadLocal for the duration of the connect and sets it on the socket's SSL parameters; SniAwareConnection and HostnameAwareConnectionFactory drive it for the pooled and unpooled paths. The Java9CL classloader that worked around the provider's inability to see ldaptive's socket factory was private to LDAPAuthorizationBackend, so a reconnect from the ldap2 backend raised ClassNotFoundException. It is extracted as SocketFactoryClassLoader and shared by both backends. LDAPAuthorizationBackend also builds its PEM credentials through a keystore rather than createX509CredentialConfig, and stops setting the global com.sun.jndi.ldap.object.disableEndpointIdentification system property, which disabled hostname verification process-wide as a side effect of one connection. Signed-off-by: Iwan Igonin <iigonin@sternad.de> Co-authored-by: Benny Goerzig <benny.goerzig@sap.com> Co-authored-by: Karsten Schnitter <k.schnitter@sap.com> Co-authored-by: Kai Sternad <k.sternad@sternad.de>
…ypto The on-behalf-of signing/encryption secret could previously only be supplied as a base64 string in the cluster configuration. KeyUtils.loadKeyFromKeystore adds a keystore-backed alternative, configured through <prefix>_keystore_path / _keystore_type / _keystore_alias / _keystore_password / _keystore_key_password, with relative paths resolved against the node config directory. PemKeyReader.loadSecretKeyFromKeystore does the actual lookup and rejects entries that are not SecretKeys. EncryptionDecryptionUtil now derives its key lazily and fails closed, enforces a minimum input-keying-material length, and zeroizes key material after use. Its toString is redacted so the secret cannot reach a log through an accidental interpolation. BREAKING: the AES-GCM encryption format has changed, so on-behalf-of tokens issued by an earlier version can no longer be decrypted and must be reissued. Signed-off-by: Iwan Igonin <iigonin@sternad.de> Co-authored-by: Benny Goerzig <benny.goerzig@sap.com> Co-authored-by: Karsten Schnitter <k.schnitter@sap.com> Co-authored-by: Kai Sternad <k.sternad@sternad.de>
iigonin
force-pushed
the
fips-split/4-obo-keystore
branch
from
September 16, 2026 16:29
5bd14ff to
dec2ca3
Compare
5 tasks
beanuwave
marked this pull request as ready for review
September 17, 2026 07:18
beanuwave
requested review from
DarshitChanpura,
Rishav9852Kumar,
RyanL1997,
cwperks,
derek-ho,
finnegancarroll,
nibix,
reta,
shikharj05 and
willyborankin
as code owners
September 17, 2026 07:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Category: Bug fix, Enhancement
The OBO key path was audited end to end. The encryption rewrite is the FIPS trigger; the rest are weaknesses found alongside it.
Key changes
EncryptionDecryptionUtilbuilt its cipher with a bareCipher.getInstance("AES")and a key forced to 16 bytes viaArrays.copyOf(silently truncating or zero-padding). Now AES-256-GCM (random 12-byte IV, 128-bit tag) with the key derived via HKDF-SHA256. A bare"AES"transformation resolves to the provider's default mode — ECB — which for data confidentiality violates NIST SP 800-38A[2] (ECB is approved only for key wrapping, SP 800-38F[3]). The mode was never spelled out or configurable, and BC FIPS permits the ECB primitive at runtime, so this had to be caught by review rather than by the provider.encryption_keywould yield a nominal AES-256 key with sub-112-bit strength. A FIPS guard rejects input keying material < 32 bytes and zeroes the IKM after derivation.OnBehalfOfAuthenticatorinitialises lazily and atomically: the constructor is inert, the first token request triggers init, and a failure logs once and declines. A bad key can no longer throw out of the constructor, propagate through config reload and retry forever. MirrorsApiTokenAuthenticator.KeyUtils.loadKeyFromKeystore→PemKeyReader.loadSecretKeyFromKeystore) instead of inline config, keeping secrets out of cluster state. Relative*_keystore_pathvalues resolve against the node config dir, consistent with other security file settings. This is SP 800-57[6] key-at-rest hardening, not a FIPS 140-3[1] requirement.OnBehalfOfSettings.toString()redactssigning_key/encryption_keyso they no longer leak into logs.Reviewer call-outs
< 10 min, self-heals shortly after rollout), but worth a release note for
hot/rolling deployments.
SecretKeyentries (engineSetKeyEntryrequires aPrivateKey), which is why the JWT-signing-key path needs BCFKS — the only FIPS-approved store that holds secret keys.Testing
./gradlew test integrationTestManual test: OnBehalfOf (OBO) token, non-FIPS
Exercises OBO token issuance and verification against an already-running non-FIPS cluster, in three modes: keys inline in the dynamic config (Scenario A), held in a PKCS#12 keystore out of cluster state (Scenario B), or in a BCFKS keystore (Scenario C — works on a non-FIPS node too, because the plugin still registers the BC FIPS provider at load on this branch). No restart needed —
-t configpushes only the dynamicon_behalf_ofblock, picked up live. Pick ONE scenario, editconfig.yml, then run the apply / issue / use steps. All paths are relative to$OPENSEARCH_HOME.Negative checks (each one, then restore a working config):
usestep returns no credentials.signing_key_keystore_alias: "nope").applystill succeeds and the cluster stays healthy (_cluster/health); on the first OBO request the node logsOn-behalf-of authentication is misconfigured; OBO tokens will be rejected: ... No key found at alias 'nope' in keystoreonce, and OBO requests are declined.openssl rand 48 | base64 -w0— 64 Base64 chars, 384 bits) is rejected withSigning key size was 384 bits, which is not secure enough.encryption_key(e.g.ZW5jcnlwdGlvbktleQ==, 13 bytes) is accepted here; the 32-byte floor applies only in FIPS mode (tested in PR 5).Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.