feat(fips): add per-module FIPS compliance gate and update elastic-agent-libs - #7395
feat(fips): add per-module FIPS compliance gate and update elastic-agent-libs#7395macdewee wants to merge 1 commit into
Conversation
…ent-libs - Add fips_compliance_test.go to each Go module (cmd/fleet, pkg/api, testing/e2e): uses fipsscan.CheckViolations (from elastic-agent-libs) to assert no transitive non-FIPS crypto imports when built with the requirefips tag. - Add mage check:FIPSComplianceGate target that enforces every module in the repo (excluding dev-tools) carries a fips_compliance_test.go, preventing new modules from silently bypassing the gate. - Upgrade elastic-agent-libs to v0.46.2-0.20260717072702-02294d812c7d across all go.mod files; add it as a direct dependency of pkg/api (required by fipsscan). - Fix instrumentation.go: pass explicit logger to tlscommon.LoadCertificateAuthorities, which now requires one after the global-logger removal in elastic-agent-libs v0.46.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request does not have a backport label. Could you fix it @macdewee? 🙏
|
TL;DRThe Remediation
Investigation detailsRoot CauseAt Evidence
Verification
What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
This pull request is now in conflicts. Could you fix it @macdewee? 🙏 |
What is the problem this PR solves?
Fleet Server had no automated check to verify that FIPS builds are free of non-FIPS crypto imports. Any new binary or module added to the repository could silently pull in a forbidden crypto library (e.g.
crypto/md5,golang.org/x/cryptonon-FIPS paths) and only be discovered at release time.Additionally,
elastic-agent-libsneeded to be updated to a version that includesfipsscan— the helper used by the new compliance tests — and thetlscommon.LoadCertificateAuthoritiescall ininstrumentation.goneeded to be adapted to the new API (logger parameter required since v0.46.1).How does this PR solve the problem?
fips_compliance_test.go, gated onrequirefipsbuild tag) added to every Go module in the repo (cmd/fleet,pkg/api,testing/e2e). Each test discovers allpackage mainbinaries in its module and callsfipsscan.CheckViolationsto assert no transitive non-FIPS crypto imports exist. TheknownViolationsmap is empty — any new violation fails the test immediately.mage check:FIPSComplianceGatetarget added tomagefile.go. It walks the repo forgo.modfiles and verifies each module (exceptdev-tools, which has no Go packages) contains afips_compliance_test.go. This prevents a new module from being added without the test.elastic-agent-libsbumped tov0.46.2-0.20260717072702-02294d812c7dacrossgo.mod,pkg/api/go.mod, andtesting/go.mod. Added as a direct dependency ofpkg/api(required byfipsscan).instrumentation.gofix: passes an explicit logger totlscommon.LoadCertificateAuthorities, which now requires one after the global-logger removal inelastic-agent-libs v0.46.1.How to test this PR locally
To verify the gate catches a missing file: temporarily rename one
fips_compliance_test.goand runmage check:FIPSComplianceGate— it should fail with the module path listed.Design Checklist
I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragmentsusing the changelog tool