Repository navigation
fix(operator): default fips140 to off via go.mod, not the chart - #350
Conversation
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>
There was a problem hiding this comment.
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
What does this PR do?
Follow-up to the
v0.2FIPS 140-3 backport (#348): fixes the same bug thatwas fixed on
mainin #349.fipsMode: off(the chart default) silently ran the operator with FIPS modeenabled instead of disabled.
GOFIPS140=v1.0.0at build time makes theoperator binary's own compiled-in
GODEBUGdefaultfips140=on(per Go'sown docs:
GOFIPS140"enable[s] FIPS 140-3 mode by default", and thefips140GODEBUG option "defaults to off unless GOFIPS140 is set at buildtime").
deployment.yaml's{{- if ne .Values.fipsMode "off" }}guardaround the
GODEBUGenv var meantfipsMode=offset noGODEBUGat all, sothe binary fell through to its compiled-in
ondefault:offandonwereidentical.
Fix: add a
godebug fips140=offdirective tooperator/go.mod, whichoverrides
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:Found by Aviad Hayumi in review after #335 (the
mainsource of thebackport) merged.
Related issue(s)
Relates to #334
Checklist
git commit -s)make check)