Skip to content

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

Merged
nshidlansik merged 1 commit into
v0.2from
fix/v0.2-operator-fips-default-on-when-off
Sep 9, 2026
Merged

nshidlansik merged 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>

@AviadHayumi AviadHayumi left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix , verified it - off really disables fips now ( built the probe with GOFIPS140=v1.0.0 : off -> false , on / only -> true , and the bug comes back if i drop the go.mod directive )

super duper nit , not a blocker : the whole env: block now sits under the fipsMode != off guard , so adding a second env var later will need a small template restructure

example - say later we want to add a second env var like LOG_FORMAT :

{{- if ne .Values.fipsMode "off" }}
env:
  - name: GODEBUG
    value: "fips140={{ .Values.fipsMode }}"
  - name: LOG_FORMAT
    value: "json"
{{- end }}

the problem : the whole env: block only renders when fipsMode != off. so with fipsMode=off ( the default ) there is no env: at all , and LOG_FORMAT just disappears. someone has to notice the guard and restructure

the fix - always render env: , guard only the GODEBUG item :

env:
  {{- if ne .Values.fipsMode "off" }}
  - name: GODEBUG
    value: "fips140={{ .Values.fipsMode }}"
  {{- end }}
  - name: LOG_FORMAT
    value: "json"

nothing to change now - the current form is correct while GODEBUG is the only env var. its only a heads up for whoever adds the next one

@nshidlansik
nshidlansik merged commit 8aaa89f into v0.2 Sep 9, 2026
1 check passed
@nshidlansik
nshidlansik deleted the fix/v0.2-operator-fips-default-on-when-off branch September 9, 2026 11:43
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.

3 participants