* util: SHA-256 stands in for MD5 and SHA-1 under fips140=only
GODEBUG=fips140=only panics on MD5 and SHA-1. NewMd5 and NewSha1 return
those hashes as before, and under fips140=only SHA-256 cut to the same
size, so digests keep their length. Md5, HashStringToLong and HashToInt32
use NewMd5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer stores: hash directory keys with NewMd5 and NewSha1
leveldb2, leveldb3, rocksdb and arangodb hash directory keys with MD5,
tikv with SHA-1, which GODEBUG=fips140=only refuses, so the filer
panicked at startup. They now use util.NewMd5 and util.NewSha1.
Keys made under fips140=only differ from MD5 keys, so leveldb2 and
leveldb3 mark an empty database opened under fips140=only and refuse a
database whose keys are of the other kind instead of showing it empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* operation, volume: no Content-MD5 checks under fips140=only
Under GODEBUG=fips140=only the uploader's digest is not an MD5, so it is
no longer sent as Content-MD5, which volume servers outside that mode
would reject; the digest still becomes the chunk ETag. A Go volume
server in that mode keeps a client's Content-MD5 unchecked instead of
panicking.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api, filer: ETags and content digests with util.NewMd5
ETags, entry Md5 attributes and chunk digests now use util.Md5 and
util.NewMd5, so under GODEBUG=fips140=only they are SHA-256 cut to 16
bytes instead of panicking. That digest cannot check a client's
Content-MD5, so in that mode Content-MD5 is accepted unchecked, and the
filer stops returning Content-MD5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api, iam, master: SHA-1 names with util.NewSha1
Multipart upload ids, IAM policy ids, the OIDC provider, audit and
session revocation file names, and the master's read-only copy dir hash
names with SHA-1. They now use util.NewSha1, which GODEBUG=fips140=only
turns into truncated SHA-256.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* postgres, oidc, update: refuse MD5 and SHA-1 checks under fips140=only
PostgreSQL md5 authentication, OIDC TLS thumbprints (SHA-1 by
definition) and weed update's MD5 check of the download cannot run
under GODEBUG=fips140=only. They now fail with an error saying so
instead of panicking.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: no empty-body MD5 when Content-MD5 is not checked
Under fips140=only a bodyless signed request still reached md5.Sum(nil)
before the nil check and panicked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: empty copy part ETag from the digest it stores
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* util: skip the native MD5 test under fips140=only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3sink: no Content-MD5 under fips140=only
The entry's Md5 attribute is truncated SHA-256 there, which an S3
destination checking Content-MD5 would reject.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iam: move OIDC provider and revocation records to this mode's name
The record names hash the ARN or JTI with util.NewSha1, which differs
under GODEBUG=fips140=only. On the first use of a filer, each store
renames records whose name does not match the one derived from their
content, so lookups, revocation checks and deletes find records written
in the other mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iam: test the rename with the names each fips140 mode derives
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* iam: rename a record only if it is unchanged, under its new name's lock
Two processes renaming after a mode switch could both list a record; if
one renamed it and the provider was then deleted, the other wrote it
back. The rename is now one filer transaction locked on the new name,
like the stores' conditional writes, that requires the old entry to be
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: verify signed request bodies against the signed payload hash
A SigV4 signature covers the declared x-amz-content-sha256, but only
getRequestDataReader (PutObject, UploadPart) compared the body with it.
Every other handler parsed the body as received, so a signed request,
DeleteObjects for example, could be replayed with a different body.
After a V4 signature verifies, wrap the body so it is handed out only
once all of it has been read and matched against the hash the signature
covered; a decoder that stops reading early never sees unverified bytes.
getRequestDataReader unwraps it and keeps verifying uploads as they
stream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: answer XAmzContentSHA256Mismatch for refused DeleteObjects bodies
DeleteObjects answered a body that failed its payload-hash check with
InternalError and CompleteMultipartUpload with MalformedXML. Name the
check that failed instead, as PutObject does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check Content-MD5 on signed request bodies
Signature V2 signs Content-MD5 rather than a payload hash, and a V4
request sent with UNSIGNED-PAYLOAD may still sign it, but bodies read
outside the upload path never compared it with the body. Check it with
the payload hash once a V2 or V4 signature verifies: BadDigest on a
mismatch, InvalidDigest when it is malformed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: verify presigned uploads against a signed payload hash
A presigned V4 URL can sign X-Amz-Content-Sha256 as a query parameter,
but getRequestDataReader compared upload bodies only with the header of
that name, so the signed hash went unchecked. Verify uploads against the
hash the signature covered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check Content-MD5 on bodies buffered for their payload hash
IAM and other non-S3 requests signed without x-amz-content-sha256 have
their body buffered and hashed during signature verification. That
buffer counted as already bound, so their Content-MD5 was never checked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: check Content-MD5 on directory marker bodies
A PUT of a key ending in "/" stores its body on the directory entry
without going through putToFiler, so its Content-MD5 was never compared
with the body. Answer BadDigest on a mismatch, as putToFiler does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* s3api: wrap and unwrap signed bodies through helpers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>