mirror of
https://github.com/pgsty/minio.git
synced 2026-12-03 12:26:39 +03:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e72442427 | |||
| 1203f068c8 | |||
| 5e94a48dcc | |||
| 35e33762cb | |||
| 9acba8560c | |||
| 840615c357 | |||
| 5da5f0a342 | |||
| c1d0e866d9 |
@@ -14,7 +14,7 @@ RUN mkdir -p /prep/data && chmod 0777 /prep/data
|
|||||||
# Debian's bundle in distroless still trusts the roots the classic image
|
# Debian's bundle in distroless still trusts the roots the classic image
|
||||||
# blocklists. Build the same bundle as Dockerfile.goreleaser so both variants
|
# blocklists. Build the same bundle as Dockerfile.goreleaser so both variants
|
||||||
# trust the same roots; it is architecture-neutral, so build it natively.
|
# trust the same roots; it is architecture-neutral, so build it natively.
|
||||||
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:latest@sha256:8b212f75a0e5a156ac28b1c5c030d2e8a07715254e19d522286118279399af81 AS certs
|
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:latest@sha256:1e9f0ed9fceafb40878bc1705ff124aa150e3fed873f18c42cdc2dded319e0a8 AS certs
|
||||||
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
|
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
|
||||||
RUN dnf -y install ca-certificates && \
|
RUN dnf -y install ca-certificates && \
|
||||||
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
|
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ RUN apk add -U --no-cache \
|
|||||||
mkdir -p /go/share/mcli && \
|
mkdir -p /go/share/mcli && \
|
||||||
cp /tmp/mcli-extract/LICENSE /tmp/mcli-extract/NOTICE /tmp/mcli-extract/CREDITS /go/share/mcli/
|
cp /tmp/mcli-extract/LICENSE /tmp/mcli-extract/NOTICE /tmp/mcli-extract/CREDITS /go/share/mcli/
|
||||||
|
|
||||||
FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:8b212f75a0e5a156ac28b1c5c030d2e8a07715254e19d522286118279399af81 AS certs
|
FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:1e9f0ed9fceafb40878bc1705ff124aa150e3fed873f18c42cdc2dded319e0a8 AS certs
|
||||||
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
|
# Native root blocklist mitigation: https://access.redhat.com/security/vulnerabilities/RHSB-2026-012
|
||||||
RUN dnf -y install ca-certificates && \
|
RUN dnf -y install ca-certificates && \
|
||||||
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
|
if [ -d /etc/pki/ca-trust/source/blocklist ]; then \
|
||||||
@@ -88,7 +88,7 @@ RUN dnf -y install ca-certificates && \
|
|||||||
dnf clean all && \
|
dnf clean all && \
|
||||||
rm -rf /var/cache/dnf
|
rm -rf /var/cache/dnf
|
||||||
|
|
||||||
FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:b59ac4f291d86027c2681f7a7b1cbf7448972fc55a6cb8e25cab5aa5eef5ce5f
|
FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:dbd325b96bcd432dd42816d31412bdf1dc0fb973b79ed310344bc23c76c068db
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="Silo" \
|
LABEL org.opencontainers.image.title="Silo" \
|
||||||
org.opencontainers.image.description="S3-Interface Libre Object Storage" \
|
org.opencontainers.image.description="S3-Interface Libre Object Storage" \
|
||||||
|
|||||||
@@ -370,7 +370,11 @@ func trimAwsChunkedContentEncoding(contentEnc string) (trimmedContentEnc string)
|
|||||||
}
|
}
|
||||||
var newEncs []string
|
var newEncs []string
|
||||||
for enc := range strings.SplitSeq(contentEnc, ",") {
|
for enc := range strings.SplitSeq(contentEnc, ",") {
|
||||||
if enc != streamingContentEncoding {
|
// Content-Encoding is a comma separated list with optional
|
||||||
|
// whitespace around each coding, and coding names are
|
||||||
|
// case-insensitive, e.g. "gzip, aws-chunked".
|
||||||
|
enc = strings.TrimSpace(enc)
|
||||||
|
if !strings.EqualFold(enc, streamingContentEncoding) {
|
||||||
newEncs = append(newEncs, enc)
|
newEncs = append(newEncs, enc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,3 +392,30 @@ func TestGetResource(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test trimAwsChunkedContentEncoding() removes the aws-chunked coding wherever
|
||||||
|
// it appears in the Content-Encoding list, regardless of the optional
|
||||||
|
// whitespace after the commas or the case of the coding name.
|
||||||
|
func TestTrimAwsChunkedContentEncoding(t *testing.T) {
|
||||||
|
testCases := []struct {
|
||||||
|
in string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{"", ""},
|
||||||
|
{"aws-chunked", ""},
|
||||||
|
{"aws-chunked,gzip", "gzip"},
|
||||||
|
{"gzip,aws-chunked", "gzip"},
|
||||||
|
{"aws-chunked, gzip", "gzip"},
|
||||||
|
{"gzip, aws-chunked", "gzip"},
|
||||||
|
{"gzip , aws-chunked", "gzip"},
|
||||||
|
{"AWS-Chunked", ""},
|
||||||
|
{"gzip, AWS-Chunked", "gzip"},
|
||||||
|
{"gzip", "gzip"},
|
||||||
|
{"gzip, br", "gzip,br"},
|
||||||
|
}
|
||||||
|
for i, test := range testCases {
|
||||||
|
if got := trimAwsChunkedContentEncoding(test.in); got != test.expected {
|
||||||
|
t.Errorf("test %d: input %q: expected %q got %q", i+1, test.in, test.expected, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ func TestExtractReplicationMetadataPreservesNormalizedMetadata(t *testing.T) {
|
|||||||
{name: "gzip", wire: []string{"gzip"}, want: "gzip"},
|
{name: "gzip", wire: []string{"gzip"}, want: "gzip"},
|
||||||
{name: "transport-last", wire: []string{"gzip,aws-chunked"}, want: "gzip"},
|
{name: "transport-last", wire: []string{"gzip,aws-chunked"}, want: "gzip"},
|
||||||
{name: "multiple-values", wire: []string{"aws-chunked", "gzip"}, want: "gzip"},
|
{name: "multiple-values", wire: []string{"aws-chunked", "gzip"}, want: "gzip"},
|
||||||
// Preserve the existing exact-token grammar; whitespace is not normalized here.
|
{name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: "gzip"},
|
||||||
{name: "space-before-gzip", wire: []string{"aws-chunked, gzip"}, want: " gzip"},
|
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip"},
|
||||||
{name: "space-before-transport", wire: []string{"gzip, aws-chunked"}, want: "gzip, aws-chunked"},
|
|
||||||
} {
|
} {
|
||||||
for _, lowercase := range []bool{false, true} {
|
for _, lowercase := range []bool{false, true} {
|
||||||
name := tc.name + "/canonical"
|
name := tc.name + "/canonical"
|
||||||
|
|||||||
+1
-1
@@ -3366,7 +3366,7 @@ func (s *xlStorage) CleanAbandonedData(ctx context.Context, volume string, path
|
|||||||
newBuf, err := xl.AppendTo(metaDataPoolGet())
|
newBuf, err := xl.AppendTo(metaDataPoolGet())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
defer metaDataPoolPut(newBuf)
|
defer metaDataPoolPut(newBuf)
|
||||||
return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf)
|
return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), newBuf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1643,6 +1643,81 @@ func TestXLStorageRenameFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestXLStorageCleanAbandonedInlineData(t *testing.T) {
|
||||||
|
disk, _, err := newXLStorageTestSetup(t)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer disk.Close()
|
||||||
|
ctx := t.Context()
|
||||||
|
const volume, object = "test-bucket", "inline-object"
|
||||||
|
if err := disk.MakeVol(ctx, volume); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
versions := []struct {
|
||||||
|
id, body string
|
||||||
|
legacy bool
|
||||||
|
}{
|
||||||
|
{nullVersionID, "null version", false},
|
||||||
|
{mustGetUUID(), "named version", false},
|
||||||
|
{mustGetUUID(), "legacy data-dir key", true},
|
||||||
|
}
|
||||||
|
var meta xlMetaV2
|
||||||
|
for _, v := range versions {
|
||||||
|
fi := newFileInfo(object, 2, 2)
|
||||||
|
fi.VersionID = v.id
|
||||||
|
fi.DataDir = mustGetUUID()
|
||||||
|
fi.Erasure.Index = 1
|
||||||
|
fi.ModTime = UTCNow()
|
||||||
|
fi.Data = []byte(v.body)
|
||||||
|
fi.Size = int64(len(fi.Data))
|
||||||
|
fi.AddObjectPart(1, "", fi.Size, fi.Size, fi.ModTime, nil, nil)
|
||||||
|
if !v.legacy {
|
||||||
|
fi.SetInlineData()
|
||||||
|
}
|
||||||
|
if err := meta.AddVersion(fi); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if v.legacy && !meta.data.rename(v.id, fi.DataDir) {
|
||||||
|
t.Fatal("failed to store legacy inline data by data directory")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orphan := mustGetUUID()
|
||||||
|
meta.data.replace(orphan, []byte("abandoned data"))
|
||||||
|
buf, err := meta.AppendTo(nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
metaPath := pathJoin(object, xlStorageFormatFile)
|
||||||
|
if err := disk.WriteAll(ctx, volume, metaPath, buf); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for pass := 1; pass <= 2; pass++ {
|
||||||
|
if err := disk.CleanAbandonedData(ctx, volume, object); err != nil {
|
||||||
|
t.Fatalf("cleanup %d: %v", pass, err)
|
||||||
|
}
|
||||||
|
raw, err := disk.ReadAll(ctx, volume, metaPath)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var saved xlMetaV2
|
||||||
|
if err := saved.Load(raw); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if saved.data.find(orphan) != nil {
|
||||||
|
t.Fatalf("cleanup %d left orphan %s in xl.meta", pass, orphan)
|
||||||
|
}
|
||||||
|
for _, v := range versions {
|
||||||
|
fi, err := disk.ReadVersion(ctx, "", volume, object, v.id, ReadOptions{ReadData: true})
|
||||||
|
if err != nil || string(fi.Data) != v.body {
|
||||||
|
t.Fatalf("after cleanup %d, read version %s: got %q, %v; want %q", pass, v.id, fi.Data, err, v.body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestXLStorageDeleteVersion will test if version deletes and bulk deletes work as expected.
|
// TestXLStorageDeleteVersion will test if version deletes and bulk deletes work as expected.
|
||||||
func TestXLStorageDeleteVersion(t *testing.T) {
|
func TestXLStorageDeleteVersion(t *testing.T) {
|
||||||
// create xlStorage test setup
|
// create xlStorage test setup
|
||||||
|
|||||||
Reference in New Issue
Block a user