Add FIPS build mode and the *FipsTests/*FipsIT test-selection convention - #6394
Draft
beanuwave wants to merge 1 commit into
Draft
Add FIPS build mode and the *FipsTests/*FipsIT test-selection convention#6394beanuwave wants to merge 1 commit into
beanuwave wants to merge 1 commit into
Conversation
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>
Contributor
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 4d66436. ⛔ 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. |
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: Enhancement
Establishes how FIPS mode is decided and applied, with no behaviour change to the
default build. Nothing in this PR turns FIPS on for users; it makes FIPS a build
and test mode the rest of the stack can rely on.
Key changes
FipsMode.isEnabled()(envOPENSEARCH_FIPS_MODE=true)replaces
CryptoServicesRegistrar.isInApprovedOnlyMode()as the way the pluginasks "are we in FIPS mode". Intent is decoupled from provider state; later PRs
cross-check the two at startup.
compileOnlyin both modes (the jars are shipped bycore); the compile-time
FipsBuildParamsfork is gone.bctls-fipsis added,and the
securityadminstandalone bundles ship the BC FIPS jars underdeps/.java.security, not code. No provider is registeredprogrammatically. The runtime launcher merges in
fips_java.securitywhenOPENSEARCH_FIPS_MODE=true; tests swap the file wholesale via-Djava.security.properties==<file>.gradle/fips.gradleis the single place where the mode is decided andapplied to the test surface: which classes exist in each mode, and the JVM args
the workers need. Keeping both together matters — selecting the FIPS classes
without the matching JVM args produces a suite that looks FIPS-shaped but runs
on ordinary providers.
<Base>FipsTests(unit) or<Base>FipsIT(integration): it extends its baseline, overrides what the FIPS providers
change, and adds FIPS-only assertions. The two modes select disjoint sets —
outside FIPS the variants are excluded from compilation and from every
Testtask; inside FIPS each baseline that has a variant is excluded so the variant
replaces it. Baselines therefore stay free of
FipsMode.isEnabled()branches.This follows core's convention (
gradle/fips.gradlethere).BCFipsEntropyDaemonFilter. Becausejava_test.securityregistersBouncyCastleFipsProvider in every test JVM including non-FIPS runs, any suite
touching JCA leaves a "BC FIPS Entropy Daemon" thread behind, which
RandomizedRunner reports as a leak. The framework's
BouncyCastleThreadFilterdoes not cover it. Applied to the suites that trip over it here and reused by
later PRs.
Reviewer notes
fips.gradleselectsnothing and the default build is unchanged. The machinery is exercised from
PR 5 onward.
BCFipsEntropyDaemonFilterarguably belongs in core's test framework ratherthan this plugin — see Core / distribution follow-ups at the end of this
document.
Testing
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.