Skip to content

fix(operator): default fips140 to off via go.mod, not the chart - #350

Open
nshidlansik wants to merge 1 commit into
v0.2from
fix/v0.2-operator-fips-default-on-when-off
Open

fix(operator): default fips140 to off via go.mod, not the chart#350
nshidlansik wants to merge 1 commit into
v0.2from
fix/v0.2-operator-fips-default-on-when-off

Conversation

@nshidlansik

Copy link
Copy Markdown
Contributor

What does this PR do?

Follow-up to the v0.2 FIPS 140-3 backport (#348): fixes the same bug that
was fixed on main in #349.

fipsMode: off (the chart default) silently ran the operator with FIPS mode
enabled instead of disabled. GOFIPS140=v1.0.0 at build time makes the
operator binary's own compiled-in GODEBUG default fips140=on (per Go's
own docs: GOFIPS140 "enable[s] FIPS 140-3 mode by default", and the
fips140 GODEBUG option "defaults to off unless GOFIPS140 is set at build
time"). deployment.yaml's {{- if ne .Values.fipsMode "off" }} guard
around the GODEBUG env var meant fipsMode=off set no GODEBUG at all, so
the binary fell through to its compiled-in on default: off and on were
identical.

Fix: add a godebug fips140=off directive to operator/go.mod, which
overrides GOFIPS140's default back to off at compile time. The chart's
{{- if ne .Values.fipsMode "off" }} guard is kept as-is.

Verified with crypto/fips140.Enabled() run inside the operator module:

GOFIPS140=v1.0.0, no GODEBUG at runtime -> Enabled() == false (was true before this fix)
GOFIPS140=v1.0.0, GODEBUG=fips140=on    -> Enabled() == true
GOFIPS140=v1.0.0, GODEBUG=fips140=only  -> Enabled() == true

Found by Aviad Hayumi in review after #335 (the main source of the
backport) merged.

Related issue(s)

Relates to #334

Checklist

  • All commits are signed off with DCO (git commit -s)
  • New/modified files have SPDX license and copyright headers
  • Documentation updated (if applicable)
  • Tests pass (make check)
  • No proprietary or internal information included

Same fix as the main-branch source (see the equivalent PR against
main). GOFIPS140=v1.0.0 at build time overrides the fips140 GODEBUG
default to on, so the {{- if ne .Values.fipsMode "off" }} guard around
the GODEBUG env var (merged in the v0.2 backport) meant fipsMode=off
set no GODEBUG at all and fell through to the compiled-in on default:
off and on were identical.

Add a "godebug fips140=off" directive to operator/go.mod, which
overrides GOFIPS140's default back to off at compile time, and restore
the chart's original {{- if ne .Values.fipsMode "off" }} guard.

Verified with crypto/fips140.Enabled() run inside the operator module:

  GOFIPS140=v1.0.0, no GODEBUG at runtime -> Enabled() == false (was
  true before this fix)
  GOFIPS140=v1.0.0, GODEBUG=fips140=on    -> Enabled() == true
  GOFIPS140=v1.0.0, GODEBUG=fips140=only  -> Enabled() == true

Found by Aviad Hayumi in review after #335 (the main-branch source of
this backport) merged.

Signed-off-by: Nir Shidlansik <nshidlansik@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants