Files
83b0f0782e Bump Go version to v1.27.3 (#39301)
* Bump Go version to v1.27.3

Move the toolchain pin, the module go directives, the build image and
the Cursor agent image to Go 1.27.3. The FIPS image is handled
separately, since it needs a different base image.

* Update lint and mock tooling for Go 1.27

golangci-lint v2.12.2 cannot analyze Go 1.27 code, so move to v2.15.0
and mockery to v2.53.8, and enable exhaustruct_v5.

Go 1.27 also ships new modernize and go fix analyzers (embedlit,
errorsastype, reflecttypeassert, stringscut). Turn them off in
golangci-lint and check-go-fix: adopting them touches unrelated code,
so it belongs in its own change, not in the toolchain bump.

* Fix tests and OAuth body handling for Go 1.27

- imaging: compress/flate output changed in Go 1.27, so the encoded PNG
  bytes differ from the fixture. Compare decoded pixels instead.
- elasticsearch: go vet's new printf check flags wrapping the error
  through %w when Error is declared on the value type. Wrap it through
  an error variable.
- oauth: read the token response up front and unmarshal it, instead of
  teeing it through the JSON decoder, so error details always carry the
  complete response body.

* Regenerate mocks with mockery v2.53.8

Output of the make *-mocks targets after the mockery bump. The changes
are the version header and import grouping only.

* Build FIPS images with Chainguard go-openssl-fips

Replace go-msft-fips, which has no Go 1.27 release, with Chainguard's
go-openssl-fips toolchain image. It selects the OpenSSL backend via
GODEBUG=cgr_fips=openssl, and sets tarinsecurepath=0 and
zipinsecurepath=0 itself, which the archive extraction tests do not
expect, so override GODEBUG in the build env.

The binaries no longer carry GOEXPERIMENT=systemcrypto, so verify
microsoft_systemcrypto=1 in the release targets instead.

Keep the OpenSSL 3 glibc-openssl-fips runtime digests. The newer ones
move the runtime to OpenSSL 4 (libcrypto.so.4), which the prepackaged
FIPS plugins cannot load, so Playbooks panicked at startup and the
Cypress FIPS server never became healthy.

* Run TOTP computation without FIPS enforcement

TOTP (RFC 6238) is defined over HMAC-SHA1. The Microsoft Go fork only
rejects it under fips140=only, but the Chainguard toolchain also does
under fips140=on, which the FIPS images enable by default. Every TOTP
computation then panics, breaking MFA on FIPS builds.

Route every dgoogauth call through helpers in the mfa package that
lift the enforcement for the duration of the call, and use them from
the tests too. Inside the helpers the call runs on Go's own crypto
module instead of OpenSSL.

* Remove versions in .cursor/README.md

Just so that we don't need to maintain that up to date.

* Simplify error handling

* Name return vars instead of declaring them upfront

* Limit the size of the OAuth token response read

Cap the token endpoint response at 1MB so a misbehaving provider cannot
make the server buffer an unbounded body now that it is read up front.

* Only disable the modernize analyzer that still has findings

errorsastype, reflecttypeassert and stringscut are clean after the
golangci-lint upgrade; only embedlit still reports findings (722), so
keep just that one disabled.

* Set GODEBUG=cgr_fips=openssl in the FIPS runtime image

The Chainguard toolchain bakes cgr_fips=openssl+geomys into the binary as
its default. Override it at runtime so the image uses only the OpenSSL
FIPS provider, as the build environment does.

* Wrap the Elasticsearch error with %w in the template error test

* Pass requirefips to the config generator in FIPS builds

The previous FIPS build image set GOFLAGS=-tags=requirefips, which the
Chainguard go-openssl-fips image does not. The config generator was run
without tags, so it fell back to the non-FIPS default of 8 for
PasswordSettings.MinimumLength, and the FIPS server refused to start with
the packaged config.json.

* Document TOTP as an exception to the FIPS boundary

The FIPS page claimed all application code uses only FIPS-approved
algorithms, which is not true for MFA: TOTP is HMAC-SHA1, which the
FIPS module rejects, so codes are computed with Go's own crypto.

Add an "Exceptions to the FIPS boundary" section describing the TOTP
exception and its scope, so admins can record it in their own FIPS
boundary documentation, and qualify the two blanket claims.

* Warn about TOTP on FIPS servers in the MFA page

TOTP uses HMAC-SHA1 outside the validated FIPS module, so MFA is not
strictly FIPS compliant. Admins should learn that where they enable
it, not only from the docs.

Show a warning banner on System Console > Authentication > MFA when
the server reports IsFipsEnabled, linking to the new exceptions
section of the FIPS documentation.

* Keep go fix from rewriting the connSet loop

Under Go 1.27, go fix's slicesbackward analyzer rewrites the reverse
loop in connSet.all to slices.Backward, which check-go-fix then
reports. That rewrite adds a second closure on every channel event,
36 allocations more per event, and go fix ignores the nolint comment
on the loop.

Write the loop as i > 0 over small[i-1]. It visits the same elements
in the same order but is not the pattern the analyzer matches, so the
check passes without disabling slicesbackward for the whole codebase.

* Skip DSA weak-key test under FIPS

crypto/dsa refuses to generate keys in FIPS 140 mode, so the test setup
failed before reaching verifyBinarySignature. Skip the subtest when
model.FIPSEnabled; non-FIPS builds still run it.

* docs: document FIPS SAML SHA-1 rejection and required RSA-OAEP settings

From v12.2, FIPS builds reject SAML responses that use SHA-1. Document the
IdP settings that work for encrypted assertions (RSA-OAEP-11, SHA-256 digest,
MGF1-SHA256), the rsa-oaep-mgf1p pitfall, and add upgrade and Keycloak notes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Gate DSA weak-key test skip on fips140.Enabled()

model.FIPSEnabled reflects the requirefips build tag, which the server
test targets do not pass, so it was false in the FIPS CI run while the
runtime was in FIPS mode and crypto/dsa refused to generate keys.

* docs: drop FIPS SAML SHA-1 note from important upgrade notes

It will be added as part of the v12.2 release process; the note moves to
the PR's release note block instead.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: mattermost-code <matty-code@mattermost.com>
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 14:03:46 +01:00

20 lines
520 B
AMPL

module github.com/mattermost/mattermost/api/internal
go 1.27.3
require (
github.com/pb33f/libopenapi v0.36.4
golang.org/x/tools v0.45.0
)
require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.2.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/pb33f/jsonpath v0.8.2 // indirect
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/sync v0.20.0 // indirect
)