mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e439c7031a |
No files matched your search
@@ -1,6 +1,8 @@
|
||||
module github.com/seaweedfs/seaweedfs
|
||||
|
||||
go 1.24.9
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.121.6 // indirect
|
||||
@@ -34,7 +36,7 @@ require (
|
||||
github.com/golang/snappy v1.0.0
|
||||
github.com/google/btree v1.1.3
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/google/wire v0.7.0 // indirect
|
||||
github.com/google/wire v0.6.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
@@ -91,27 +93,27 @@ require (
|
||||
go.etcd.io/etcd/client/v3 v3.6.6
|
||||
go.mongodb.org/mongo-driver v1.17.6
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
gocloud.dev v0.44.0
|
||||
gocloud.dev/pubsub/natspubsub v0.44.0
|
||||
gocloud.dev v0.43.0
|
||||
gocloud.dev/pubsub/natspubsub v0.43.0
|
||||
gocloud.dev/pubsub/rabbitpubsub v0.43.0
|
||||
golang.org/x/crypto v0.46.0
|
||||
golang.org/x/exp v0.0.0-20250811191247-51f88131bc50
|
||||
golang.org/x/image v0.34.0
|
||||
golang.org/x/net v0.48.0
|
||||
golang.org/x/oauth2 v0.34.0 // indirect
|
||||
golang.org/x/oauth2 v0.32.0 // indirect
|
||||
golang.org/x/sys v0.39.0
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/tools v0.39.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
google.golang.org/api v0.258.0
|
||||
google.golang.org/api v0.247.0
|
||||
google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 // indirect
|
||||
google.golang.org/grpc v1.77.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
google.golang.org/protobuf v1.36.10
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
modernc.org/b v1.0.0 // indirect
|
||||
modernc.org/mathutil v1.7.1
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.42.2
|
||||
modernc.org/sqlite v1.39.0
|
||||
modernc.org/strutil v1.2.1
|
||||
)
|
||||
|
||||
@@ -145,13 +147,13 @@ require (
|
||||
github.com/mattn/go-sqlite3 v1.14.32
|
||||
github.com/minio/crc64nvme v1.1.1
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1
|
||||
github.com/parquet-go/parquet-go v0.26.3
|
||||
github.com/parquet-go/parquet-go v0.25.1
|
||||
github.com/pkg/sftp v1.13.10
|
||||
github.com/rabbitmq/amqp091-go v1.10.0
|
||||
github.com/rclone/rclone v1.71.2
|
||||
github.com/rdleal/intervalst v1.5.0
|
||||
github.com/redis/go-redis/v9 v9.17.2
|
||||
github.com/schollz/progressbar/v3 v3.19.0
|
||||
github.com/schollz/progressbar/v3 v3.18.0
|
||||
github.com/shirou/gopsutil/v4 v4.25.11
|
||||
github.com/tarantool/go-tarantool/v2 v2.4.1
|
||||
github.com/tikv/client-go/v2 v2.0.7
|
||||
@@ -169,7 +171,7 @@ require github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // ind
|
||||
|
||||
require (
|
||||
cloud.google.com/go/longrunning v0.6.7 // indirect
|
||||
cloud.google.com/go/pubsub/v2 v2.2.1 // indirect
|
||||
cloud.google.com/go/pubsub/v2 v2.0.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
|
||||
github.com/bazelbuild/rules_go v0.46.0 // indirect
|
||||
@@ -200,8 +202,6 @@ require (
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lithammer/shortuuid/v3 v3.0.7 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.3 // indirect
|
||||
github.com/parquet-go/bitpack v1.0.0 // indirect
|
||||
github.com/parquet-go/jsonlite v1.0.0 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
|
||||
github.com/pierrre/geohash v1.0.0 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
@@ -227,7 +227,7 @@ require (
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.24.0 // indirect
|
||||
cloud.google.com/go/auth v0.17.0 // indirect
|
||||
cloud.google.com/go/auth v0.16.5 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
cloud.google.com/go/iam v1.5.2 // indirect
|
||||
@@ -262,7 +262,7 @@ require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.18.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
|
||||
@@ -328,7 +328,7 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.7 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
|
||||
github.com/gorilla/context v1.1.2 // indirect
|
||||
github.com/gorilla/schema v1.4.1 // indirect
|
||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||
@@ -447,14 +447,14 @@ require (
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/arch v0.20.0 // indirect
|
||||
golang.org/x/term v0.38.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/time v0.12.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/validator.v2 v2.0.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
modernc.org/libc v1.66.10 // indirect
|
||||
modernc.org/libc v1.66.3 // indirect
|
||||
moul.io/http2curl/v2 v2.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
storj.io/common v0.0.0-20250808122759-804533d519c1 // indirect
|
||||
|
||||
@@ -86,8 +86,8 @@ cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVo
|
||||
cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo=
|
||||
cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0=
|
||||
cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E=
|
||||
cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4=
|
||||
cloud.google.com/go/auth v0.17.0/go.mod h1:6wv/t5/6rOPAX4fJiRjKkJCvswLwdet7G8+UGXt7nCQ=
|
||||
cloud.google.com/go/auth v0.16.5 h1:mFWNQ2FEVWAliEQWpAdH80omXFokmrnbDhUS9cBywsI=
|
||||
cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gCc2dUhQ=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
|
||||
cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=
|
||||
@@ -385,8 +385,8 @@ cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhz
|
||||
cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8=
|
||||
cloud.google.com/go/pubsub v1.50.1 h1:fzbXpPyJnSGvWXF1jabhQeXyxdbCIkXTpjXHy7xviBM=
|
||||
cloud.google.com/go/pubsub v1.50.1/go.mod h1:6YVJv3MzWJUVdvQXG081sFvS0dWQOdnV+oTo++q/xFk=
|
||||
cloud.google.com/go/pubsub/v2 v2.2.1 h1:3brZcshL3fIiD1qOxAE2QW9wxsfjioy014x4yC9XuYI=
|
||||
cloud.google.com/go/pubsub/v2 v2.2.1/go.mod h1:O5f0KHG9zDheZAd3z5rlCRhxt2JQtB+t/IYLKK3Bpvw=
|
||||
cloud.google.com/go/pubsub/v2 v2.0.0 h1:0qS6mRJ41gD1lNmM/vdm6bR7DQu6coQcVwD+VPf0Bz0=
|
||||
cloud.google.com/go/pubsub/v2 v2.0.0/go.mod h1:0aztFxNzVQIRSZ8vUr79uH2bS3jwLebwK6q1sgEub+E=
|
||||
cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg=
|
||||
cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k=
|
||||
cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4=
|
||||
@@ -675,8 +675,8 @@ github.com/aws/aws-sdk-go-v2/credentials v1.19.6 h1:F9vWao2TwjV2MyiyVS+duza0NIRt
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.6/go.mod h1:SgHzKjEVsdQr6Opor0ihgWtkWdfRAIwxYzSJ8O85VHY=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 h1:80+uETIWS1BqjnN9uJ0dBUaETh+P1XwFy5vwHwK5r9k=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16/go.mod h1:wOOsYuxYuB/7FlnVtzeBYRcjSRtQpAW0hCP7tIULMwo=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.3 h1:4GNV1lhyELGjMz5ILMRxDvxvOaeo3Ux9Z69S1EgVMMQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.3/go.mod h1:br7KA6edAAqDGUYJ+zVVPAyMrPhnN+zdt17yTUT6FPw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.18.4 h1:0SzCLoPRSK3qSydsaFQWugP+lOBCTPwfcBOm6222+UA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.18.4/go.mod h1:JAet9FsBHjfdI+TnMBX4ModNNaQHAd3dc/Bk+cNsxeM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 h1:rgGwPzb82iBYSvHMHXc8h9mRoOUBZIGFgKb9qniaZZc=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16/go.mod h1:L/UxsGeKpGoIj6DxfhOWHWQ/kGKcd4I1VncE4++IyKA=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 h1:1jtGzuV7c82xnqOVfx2F0xmJcOw5374L7N6juGW6x6U=
|
||||
@@ -1134,21 +1134,22 @@ github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/wire v0.7.0 h1:JxUKI6+CVBgCO2WToKy/nQk0sS+amI9z9EjVmdaocj4=
|
||||
github.com/google/wire v0.7.0/go.mod h1:n6YbUQD9cPKTnHXEBN2DXlOp/mVADhVErcMFb0v3J18=
|
||||
github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI=
|
||||
github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.7 h1:zrn2Ee/nWmHulBx5sAVrGgAa0f2/R35S4DJwfFaUPFQ=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.7/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
||||
@@ -1470,12 +1471,8 @@ github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q
|
||||
github.com/ory/dockertest/v3 v3.6.0/go.mod h1:4ZOpj8qBUmh8fcBSVzkH2bws2s91JdGvHUqan4GHEuQ=
|
||||
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
|
||||
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/parquet-go/bitpack v1.0.0 h1:AUqzlKzPPXf2bCdjfj4sTeacrUwsT7NlcYDMUQxPcQA=
|
||||
github.com/parquet-go/bitpack v1.0.0/go.mod h1:XnVk9TH+O40eOOmvpAVZ7K2ocQFrQwysLMnc6M/8lgs=
|
||||
github.com/parquet-go/jsonlite v1.0.0 h1:87QNdi56wOfsE5bdgas0vRzHPxfJgzrXGml1zZdd7VU=
|
||||
github.com/parquet-go/jsonlite v1.0.0/go.mod h1:nDjpkpL4EOtqs6NQugUsi0Rleq9sW/OtC1NnZEnxzF0=
|
||||
github.com/parquet-go/parquet-go v0.26.3 h1:kJY+xmjcR7BH77tyHqasJpIl3kch/6EIO3TW4tFj69M=
|
||||
github.com/parquet-go/parquet-go v0.26.3/go.mod h1:h9GcSt41Knf5qXI1tp1TfR8bDBUtvdUMzSKe26aZcHk=
|
||||
github.com/parquet-go/parquet-go v0.25.1 h1:l7jJwNM0xrk0cnIIptWMtnSnuxRkwq53S+Po3KG8Xgo=
|
||||
github.com/parquet-go/parquet-go v0.25.1/go.mod h1:AXBuotO1XiBtcqJb/FKFyjBG4aqa3aQAAWF3ZPzCanY=
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
@@ -1617,8 +1614,8 @@ github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
|
||||
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
|
||||
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
|
||||
github.com/schollz/progressbar/v3 v3.19.0 h1:Ea18xuIRQXLAUidVDox3AbwfUhD0/1IvohyTutOIFoc=
|
||||
github.com/schollz/progressbar/v3 v3.19.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
|
||||
github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
|
||||
github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
|
||||
github.com/seaweedfs/cockroachdb-parser v0.0.0-20251021184156-909763b17138 h1:bX1vBF7GQjPeFQsCAZ8gCQGS/nJQnekL7gZ4Qg/pF4E=
|
||||
github.com/seaweedfs/cockroachdb-parser v0.0.0-20251021184156-909763b17138/go.mod h1:JSKCh6uCHBz91lQYFYHCyTrSVIPge4SUFVn28iwMNB0=
|
||||
github.com/seaweedfs/goexif v1.0.3 h1:ve/OjI7dxPW8X9YQsv3JuVMaxEyF9Rvfd04ouL+Bz30=
|
||||
@@ -1891,10 +1888,10 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
|
||||
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
|
||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
gocloud.dev v0.44.0 h1:iVyMAqFl2r6xUy7M4mfqwlN+21UpJoEtgHEcfiLMUXs=
|
||||
gocloud.dev v0.44.0/go.mod h1:ZmjROXGdC/eKZLF1N+RujDlFRx3D+4Av2thREKDMVxY=
|
||||
gocloud.dev/pubsub/natspubsub v0.44.0 h1:1Us76ckkdgtiE1p1rJZ+38b9TQP051bmjAiQlFQzYrM=
|
||||
gocloud.dev/pubsub/natspubsub v0.44.0/go.mod h1:PvVAGIhL14PWGwWIXX/zAK42ixr2/PKP4Q4yMiAUraQ=
|
||||
gocloud.dev v0.43.0 h1:aW3eq4RMyehbJ54PMsh4hsp7iX8cO/98ZRzJJOzN/5M=
|
||||
gocloud.dev v0.43.0/go.mod h1:eD8rkg7LhKUHrzkEdLTZ+Ty/vgPHPCd+yMQdfelQVu4=
|
||||
gocloud.dev/pubsub/natspubsub v0.43.0 h1:k35tFoaorvD9Fa26zVEEzyXiMOEyXNHc0pBOmRYvQI0=
|
||||
gocloud.dev/pubsub/natspubsub v0.43.0/go.mod h1:xJn8TO8pGYieDn6AsRFsYfhQW8cnC+xGmG9APGNxkpQ=
|
||||
gocloud.dev/pubsub/rabbitpubsub v0.43.0 h1:6nNZFSlJ1dk2GujL8PFltfLz3vC6IbrpjGS4FTduo1s=
|
||||
gocloud.dev/pubsub/rabbitpubsub v0.43.0/go.mod h1:sEaueAGat+OASRoB3QDkghCtibKttgg7X6zsPTm1pl0=
|
||||
golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c=
|
||||
@@ -1916,6 +1913,7 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
@@ -1986,6 +1984,7 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
|
||||
@@ -2055,6 +2054,7 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
@@ -2088,8 +2088,8 @@ golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri
|
||||
golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec=
|
||||
golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=
|
||||
golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw=
|
||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
|
||||
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -2214,6 +2214,7 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
@@ -2232,6 +2233,7 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
@@ -2267,8 +2269,8 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
||||
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
@@ -2339,6 +2341,7 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
|
||||
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
|
||||
@@ -2419,8 +2422,8 @@ google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/
|
||||
google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
|
||||
google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
|
||||
google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
|
||||
google.golang.org/api v0.258.0 h1:IKo1j5FBlN74fe5isA2PVozN3Y5pwNKriEgAXPOkDAc=
|
||||
google.golang.org/api v0.258.0/go.mod h1:qhOMTQEZ6lUps63ZNq9jhODswwjkjYYguA7fA3TBFww=
|
||||
google.golang.org/api v0.247.0 h1:tSd/e0QrUlLsrwMKmkbQhYVa109qIintOls2Wh6bngc=
|
||||
google.golang.org/api v0.247.0/go.mod h1:r1qZOPmxXffXg6xS5uhx16Fa/UFY8QU/K4bfKrnvovM=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -2558,8 +2561,8 @@ google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 h1:Nt6z9UHqSlIdIGJ
|
||||
google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79/go.mod h1:kTmlBHMPqR5uCZPBvwa2B18mvubkjyY3CRLI0c6fj0s=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 h1:2I6GHUeJ/4shcDpoUlLs/2WPnhg7yJwvXtqcMJt9liA=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
@@ -2623,8 +2626,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@@ -2675,19 +2678,19 @@ modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg=
|
||||
modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
|
||||
modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
|
||||
modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
|
||||
modernc.org/cc/v4 v4.26.5 h1:xM3bX7Mve6G8K8b+T11ReenJOT+BmVqQj0FY5T4+5Y4=
|
||||
modernc.org/cc/v4 v4.26.5/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||
modernc.org/cc/v4 v4.26.2 h1:991HMkLjJzYBIfha6ECZdjrIYz2/1ayr+FL8GN+CNzM=
|
||||
modernc.org/cc/v4 v4.26.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||
modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc=
|
||||
modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw=
|
||||
modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ=
|
||||
modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ=
|
||||
modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws=
|
||||
modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo=
|
||||
modernc.org/ccgo/v4 v4.28.1 h1:wPKYn5EC/mYTqBO373jKjvX2n+3+aK7+sICCv4Fjy1A=
|
||||
modernc.org/ccgo/v4 v4.28.1/go.mod h1:uD+4RnfrVgE6ec9NGguUNdhqzNIeeomeXf6CL0GTE5Q=
|
||||
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU=
|
||||
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE=
|
||||
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
|
||||
modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA=
|
||||
modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
modernc.org/fileutil v1.3.8 h1:qtzNm7ED75pd1C7WgAGcK4edm4fvhtBsEiI/0NQ54YM=
|
||||
modernc.org/fileutil v1.3.8/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
||||
@@ -2700,8 +2703,8 @@ modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU=
|
||||
modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA=
|
||||
modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0=
|
||||
modernc.org/libc v1.17.1/go.mod h1:FZ23b+8LjxZs7XtFMbSzL/EhPxNbfZbErxEHc7cbD9s=
|
||||
modernc.org/libc v1.66.10 h1:yZkb3YeLx4oynyR+iUsXsybsX4Ubx7MQlSYEw4yj59A=
|
||||
modernc.org/libc v1.66.10/go.mod h1:8vGSEwvoUoltr4dlywvHqjtAqHBaw0j1jI7iFBTAr2I=
|
||||
modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
|
||||
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
|
||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
@@ -2720,8 +2723,8 @@ modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
||||
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
||||
modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4=
|
||||
modernc.org/sqlite v1.42.2 h1:7hkZUNJvJFN2PgfUdjni9Kbvd4ef4mNLOu0B9FGxM74=
|
||||
modernc.org/sqlite v1.42.2/go.mod h1:+VkC6v3pLOAE0A0uVucQEcbVW0I5nHCeDaBf+DpsQT8=
|
||||
modernc.org/sqlite v1.39.0 h1:6bwu9Ooim0yVYA7IZn9demiQk/Ejp0BtTjBWFLymSeY=
|
||||
modernc.org/sqlite v1.39.0/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E=
|
||||
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
|
||||
@@ -26,12 +26,9 @@ type FilerMetaBackupOptions struct {
|
||||
grpcDialOption grpc.DialOption
|
||||
filerAddress *string
|
||||
filerDirectory *string
|
||||
includePrefixes *string
|
||||
excludePrefixes *string
|
||||
restart *bool
|
||||
backupFilerConfig *string
|
||||
|
||||
pathFilter *util.PathPrefixFilter
|
||||
store filer.FilerStore
|
||||
clientId int32
|
||||
clientEpoch int32
|
||||
@@ -41,25 +38,20 @@ func init() {
|
||||
cmdFilerMetaBackup.Run = runFilerMetaBackup // break init cycle
|
||||
metaBackup.filerAddress = cmdFilerMetaBackup.Flag.String("filer", "localhost:8888", "filer hostname:port")
|
||||
metaBackup.filerDirectory = cmdFilerMetaBackup.Flag.String("filerDir", "/", "a folder on the filer")
|
||||
metaBackup.includePrefixes = cmdFilerMetaBackup.Flag.String("includePrefixes", "", "comma-separated path prefixes to include in backup (if set, only these paths are backed up)")
|
||||
metaBackup.excludePrefixes = cmdFilerMetaBackup.Flag.String("excludePrefixes", "", "comma-separated path prefixes to exclude from backup")
|
||||
metaBackup.restart = cmdFilerMetaBackup.Flag.Bool("restart", false, "copy the full metadata before async incremental backup")
|
||||
metaBackup.backupFilerConfig = cmdFilerMetaBackup.Flag.String("config", "", "path to filer.toml specifying backup filer store")
|
||||
metaBackup.clientId = util.RandomInt32()
|
||||
}
|
||||
|
||||
var cmdFilerMetaBackup = &Command{
|
||||
UsageLine: "filer.meta.backup [-filer=localhost:8888] [-filerDir=/] [-includePrefixes=...] [-excludePrefixes=...] [-restart] -config=/path/to/backup_filer.toml",
|
||||
UsageLine: "filer.meta.backup [-filer=localhost:8888] [-filerDir=/] [-restart] -config=/path/to/backup_filer.toml",
|
||||
Short: "continuously backup filer meta data changes to anther filer store specified in a backup_filer.toml",
|
||||
Long: `continuously backup filer meta data changes.
|
||||
Long: `continuously backup filer meta data changes.
|
||||
The backup writes to another filer store specified in a backup_filer.toml.
|
||||
|
||||
weed filer.meta.backup -config=/path/to/backup_filer.toml -filer="localhost:8888"
|
||||
weed filer.meta.backup -config=/path/to/backup_filer.toml -filer="localhost:8888" -restart
|
||||
|
||||
The -includePrefixes and -excludePrefixes flags accept comma-separated path prefixes.
|
||||
Paths must be absolute (start with '/'). Matching is at directory boundaries.
|
||||
When both match, the deeper prefix wins.
|
||||
`,
|
||||
}
|
||||
|
||||
@@ -83,23 +75,6 @@ func runFilerMetaBackup(cmd *Command, args []string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Initialize path filter
|
||||
metaBackup.pathFilter = util.NewPathPrefixFilter(
|
||||
*metaBackup.includePrefixes,
|
||||
*metaBackup.excludePrefixes,
|
||||
func(format string, args ...interface{}) {
|
||||
glog.Warningf(format, args...)
|
||||
},
|
||||
)
|
||||
if metaBackup.pathFilter.HasFilters() {
|
||||
if len(metaBackup.pathFilter.GetIncludePrefixes()) > 0 {
|
||||
glog.V(0).Infof("including prefixes: %v", metaBackup.pathFilter.GetIncludePrefixes())
|
||||
}
|
||||
if len(metaBackup.pathFilter.GetExcludePrefixes()) > 0 {
|
||||
glog.V(0).Infof("excluding prefixes: %v", metaBackup.pathFilter.GetExcludePrefixes())
|
||||
}
|
||||
}
|
||||
|
||||
missingPreviousBackup := false
|
||||
_, err := metaBackup.getOffset()
|
||||
if err != nil {
|
||||
@@ -152,22 +127,12 @@ func (metaBackup *FilerMetaBackupOptions) initStore(v *viper.Viper) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// shouldInclude checks if the given path should be included in backup
|
||||
// based on the configured include/exclude path prefixes.
|
||||
func (metaBackup *FilerMetaBackupOptions) shouldInclude(fullpath string) bool {
|
||||
return metaBackup.pathFilter.ShouldInclude(fullpath)
|
||||
}
|
||||
|
||||
func (metaBackup *FilerMetaBackupOptions) traverseMetadata() (err error) {
|
||||
var saveErr error
|
||||
|
||||
traverseErr := filer_pb.TraverseBfs(metaBackup, util.FullPath(*metaBackup.filerDirectory), func(parentPath util.FullPath, entry *filer_pb.Entry) {
|
||||
fullpath := string(parentPath.Child(entry.Name))
|
||||
if !metaBackup.shouldInclude(fullpath) {
|
||||
return
|
||||
}
|
||||
|
||||
println("+", fullpath)
|
||||
println("+", parentPath.Child(entry.Name))
|
||||
if err := metaBackup.store.InsertEntry(context.Background(), filer.FromPbEntry(string(parentPath), entry)); err != nil {
|
||||
saveErr = fmt.Errorf("insert entry error: %w\n", err)
|
||||
return
|
||||
@@ -202,53 +167,25 @@ func (metaBackup *FilerMetaBackupOptions) streamMetadataBackup() error {
|
||||
|
||||
if filer_pb.IsEmpty(resp) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Compute exclusion for both old and new paths
|
||||
var oldPathExcluded, newPathExcluded bool
|
||||
var oldPath, newPath string
|
||||
if message.OldEntry != nil {
|
||||
oldPath = string(util.FullPath(resp.Directory).Child(message.OldEntry.Name))
|
||||
oldPathExcluded = !metaBackup.shouldInclude(oldPath)
|
||||
}
|
||||
if message.NewEntry != nil {
|
||||
newPath = string(util.FullPath(message.NewParentPath).Child(message.NewEntry.Name))
|
||||
newPathExcluded = !metaBackup.shouldInclude(newPath)
|
||||
}
|
||||
|
||||
if filer_pb.IsCreate(resp) {
|
||||
if newPathExcluded {
|
||||
return nil
|
||||
}
|
||||
println("+", newPath)
|
||||
} else if filer_pb.IsCreate(resp) {
|
||||
println("+", util.FullPath(message.NewParentPath).Child(message.NewEntry.Name))
|
||||
entry := filer.FromPbEntry(message.NewParentPath, message.NewEntry)
|
||||
return store.InsertEntry(ctx, entry)
|
||||
} else if filer_pb.IsDelete(resp) {
|
||||
if oldPathExcluded {
|
||||
return nil
|
||||
}
|
||||
println("-", oldPath)
|
||||
println("-", util.FullPath(resp.Directory).Child(message.OldEntry.Name))
|
||||
return store.DeleteEntry(ctx, util.FullPath(resp.Directory).Child(message.OldEntry.Name))
|
||||
} else if filer_pb.IsUpdate(resp) {
|
||||
if newPathExcluded {
|
||||
return nil
|
||||
}
|
||||
println("~", newPath)
|
||||
println("~", util.FullPath(message.NewParentPath).Child(message.NewEntry.Name))
|
||||
entry := filer.FromPbEntry(message.NewParentPath, message.NewEntry)
|
||||
return store.UpdateEntry(ctx, entry)
|
||||
} else {
|
||||
// renaming - handle all four combinations
|
||||
if !oldPathExcluded {
|
||||
println("-", oldPath)
|
||||
if err := store.DeleteEntry(ctx, util.FullPath(resp.Directory).Child(message.OldEntry.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
// renaming
|
||||
println("-", util.FullPath(resp.Directory).Child(message.OldEntry.Name))
|
||||
if err := store.DeleteEntry(ctx, util.FullPath(resp.Directory).Child(message.OldEntry.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
if !newPathExcluded {
|
||||
println("+", newPath)
|
||||
return store.InsertEntry(ctx, filer.FromPbEntry(message.NewParentPath, message.NewEntry))
|
||||
}
|
||||
return nil
|
||||
println("+", util.FullPath(message.NewParentPath).Child(message.NewEntry.Name))
|
||||
return store.InsertEntry(ctx, filer.FromPbEntry(message.NewParentPath, message.NewEntry))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,12 @@ package command
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb"
|
||||
@@ -12,11 +18,6 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/replication/source"
|
||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"math"
|
||||
"math/rand"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (option *RemoteGatewayOptions) followBucketUpdatesAndUploadToRemote(filerSource *source.FilerSource) error {
|
||||
@@ -100,7 +101,7 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour
|
||||
return err
|
||||
}
|
||||
|
||||
bucketName := strings.ToLower(entry.Name)
|
||||
bucketName := entry.Name
|
||||
if *option.include != "" {
|
||||
if ok, _ := filepath.Match(*option.include, entry.Name); !ok {
|
||||
return nil
|
||||
|
||||
@@ -529,120 +529,73 @@ func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) htt
|
||||
identity, errCode := iam.authRequest(r, action)
|
||||
glog.V(3).Infof("auth error: %v", errCode)
|
||||
|
||||
iam.handleAuthResult(w, r, identity, errCode, f)
|
||||
}
|
||||
}
|
||||
|
||||
// AuthPostPolicy is a specialized authentication wrapper for PostPolicy requests.
|
||||
// It allows requests with multipart/form-data to proceed even if classified as Anonymous,
|
||||
// because the actual authentication (signature verification) for ALL PostPolicy requests is
|
||||
// performed unconditionally in PostPolicyBucketHandler.doesPolicySignatureMatch().
|
||||
// This delegation only defers the initial authentication classification; it does NOT bypass
|
||||
// signature verification, which is mandatory for all PostPolicy uploads.
|
||||
func (iam *IdentityAccessManagement) AuthPostPolicy(f http.HandlerFunc, action Action) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if !iam.isEnabled() {
|
||||
if errCode == s3err.ErrNone {
|
||||
// Store the authenticated identity in request context (secure, cannot be spoofed)
|
||||
if identity != nil && identity.Name != "" {
|
||||
ctx := s3_constants.SetIdentityNameInContext(r.Context(), identity.Name)
|
||||
// Also store the full identity object for handlers that need it (e.g., ListBuckets)
|
||||
// This is especially important for JWT users whose identity is not in the identities list
|
||||
ctx = s3_constants.SetIdentityInContext(ctx, identity)
|
||||
r = r.WithContext(ctx)
|
||||
}
|
||||
f(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
// Optimization: Use authRequestWithAuthType to avoid re-parsing headers for classification
|
||||
identity, errCode, authType := iam.authRequestWithAuthType(r, action)
|
||||
|
||||
// Special handling for PostPolicy: if AccessDenied (likely because Anonymous to private bucket)
|
||||
// AND it looks like a PostPolicy request, allow it to proceed to handler for verification.
|
||||
if errCode == s3err.ErrAccessDenied {
|
||||
if authType == authTypeAnonymous &&
|
||||
r.Method == http.MethodPost &&
|
||||
strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") {
|
||||
|
||||
glog.V(3).Infof("Delegating PostPolicy auth to handler")
|
||||
r.Header.Set(s3_constants.AmzAuthType, "PostPolicy")
|
||||
f(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
glog.V(3).Infof("auth error: %v", errCode)
|
||||
|
||||
iam.handleAuthResult(w, r, identity, errCode, f)
|
||||
s3err.WriteErrorResponse(w, r, errCode)
|
||||
}
|
||||
}
|
||||
|
||||
func (iam *IdentityAccessManagement) handleAuthResult(w http.ResponseWriter, r *http.Request, identity *Identity, errCode s3err.ErrorCode, f http.HandlerFunc) {
|
||||
if errCode == s3err.ErrNone {
|
||||
// Store the authenticated identity in request context (secure, cannot be spoofed)
|
||||
if identity != nil && identity.Name != "" {
|
||||
ctx := s3_constants.SetIdentityNameInContext(r.Context(), identity.Name)
|
||||
// Also store the full identity object for handlers that need it (e.g., ListBuckets)
|
||||
// This is especially important for JWT users whose identity is not in the identities list
|
||||
ctx = s3_constants.SetIdentityInContext(ctx, identity)
|
||||
r = r.WithContext(ctx)
|
||||
}
|
||||
f(w, r)
|
||||
return
|
||||
}
|
||||
s3err.WriteErrorResponse(w, r, errCode)
|
||||
}
|
||||
|
||||
// Wrapper to maintain backward compatibility
|
||||
func (iam *IdentityAccessManagement) authRequest(r *http.Request, action Action) (*Identity, s3err.ErrorCode) {
|
||||
identity, err, _ := iam.authRequestWithAuthType(r, action)
|
||||
return identity, err
|
||||
}
|
||||
|
||||
// check whether the request has valid access keys
|
||||
func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, action Action) (*Identity, s3err.ErrorCode, authType) {
|
||||
func (iam *IdentityAccessManagement) authRequest(r *http.Request, action Action) (*Identity, s3err.ErrorCode) {
|
||||
var identity *Identity
|
||||
var s3Err s3err.ErrorCode
|
||||
var found bool
|
||||
var amzAuthType string
|
||||
|
||||
reqAuthType := getRequestAuthType(r)
|
||||
|
||||
switch reqAuthType {
|
||||
var authType string
|
||||
switch getRequestAuthType(r) {
|
||||
case authTypeUnknown:
|
||||
glog.V(3).Infof("unknown auth type")
|
||||
r.Header.Set(s3_constants.AmzAuthType, "Unknown")
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
return identity, s3err.ErrAccessDenied
|
||||
case authTypePresignedV2, authTypeSignedV2:
|
||||
glog.V(3).Infof("v2 auth type")
|
||||
identity, s3Err = iam.isReqAuthenticatedV2(r)
|
||||
amzAuthType = "SigV2"
|
||||
authType = "SigV2"
|
||||
case authTypeStreamingSigned, authTypeSigned, authTypePresigned:
|
||||
glog.V(3).Infof("v4 auth type")
|
||||
identity, s3Err = iam.reqSignatureV4Verify(r)
|
||||
amzAuthType = "SigV4"
|
||||
authType = "SigV4"
|
||||
case authTypePostPolicy:
|
||||
glog.V(3).Infof("post policy auth type")
|
||||
r.Header.Set(s3_constants.AmzAuthType, "PostPolicy")
|
||||
return identity, s3err.ErrNone
|
||||
case authTypeStreamingUnsigned:
|
||||
glog.V(3).Infof("unsigned streaming upload")
|
||||
// no amzAuthType set for this case in original code?
|
||||
// Actually original explicitly returned ErrNone without setting identity
|
||||
return identity, s3err.ErrNone, reqAuthType
|
||||
return identity, s3err.ErrNone
|
||||
case authTypeJWT:
|
||||
glog.V(3).Infof("jwt auth type detected, iamIntegration != nil? %t", iam.iamIntegration != nil)
|
||||
r.Header.Set(s3_constants.AmzAuthType, "Jwt")
|
||||
if iam.iamIntegration != nil {
|
||||
identity, s3Err = iam.authenticateJWTWithIAM(r)
|
||||
amzAuthType = "Jwt"
|
||||
authType = "Jwt"
|
||||
} else {
|
||||
glog.V(2).Infof("IAM integration is nil, returning ErrNotImplemented")
|
||||
return identity, s3err.ErrNotImplemented, reqAuthType
|
||||
return identity, s3err.ErrNotImplemented
|
||||
}
|
||||
case authTypeAnonymous:
|
||||
amzAuthType = "Anonymous"
|
||||
authType = "Anonymous"
|
||||
if identity, found = iam.lookupAnonymous(); !found {
|
||||
r.Header.Set(s3_constants.AmzAuthType, amzAuthType)
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
r.Header.Set(s3_constants.AmzAuthType, authType)
|
||||
return identity, s3err.ErrAccessDenied
|
||||
}
|
||||
default:
|
||||
return identity, s3err.ErrNotImplemented, reqAuthType
|
||||
return identity, s3err.ErrNotImplemented
|
||||
}
|
||||
|
||||
if len(amzAuthType) > 0 {
|
||||
r.Header.Set(s3_constants.AmzAuthType, amzAuthType)
|
||||
if len(authType) > 0 {
|
||||
r.Header.Set(s3_constants.AmzAuthType, authType)
|
||||
}
|
||||
if s3Err != s3err.ErrNone {
|
||||
return identity, s3Err, reqAuthType
|
||||
return identity, s3Err
|
||||
}
|
||||
|
||||
glog.V(3).Infof("user name: %v actions: %v, action: %v", identity.Name, identity.Actions, action)
|
||||
@@ -683,7 +636,7 @@ func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, ac
|
||||
// SECURITY: Fail-close on policy evaluation errors
|
||||
// If we can't evaluate the policy, deny access rather than falling through to IAM
|
||||
glog.Errorf("Error evaluating bucket policy for %s/%s: %v - denying access", bucket, object, err)
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
return identity, s3err.ErrAccessDenied
|
||||
} else if evaluated {
|
||||
// A bucket policy exists and was evaluated with a matching statement
|
||||
if allowed {
|
||||
@@ -695,7 +648,7 @@ func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, ac
|
||||
// Policy explicitly denies this action - deny access immediately
|
||||
// Note: Explicit Deny in bucket policy overrides all other permissions
|
||||
glog.V(3).Infof("Bucket policy explicitly denies %s to %s on %s/%s", identity.Name, action, bucket, object)
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
return identity, s3err.ErrAccessDenied
|
||||
}
|
||||
}
|
||||
// If not evaluated (no policy or no matching statements), fall through to IAM/identity checks
|
||||
@@ -707,21 +660,21 @@ func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, ac
|
||||
// JWT/STS identities (no Actions) use IAM authorization
|
||||
if len(identity.Actions) > 0 {
|
||||
if !identity.canDo(action, bucket, object) {
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
return identity, s3err.ErrAccessDenied
|
||||
}
|
||||
} else if iam.iamIntegration != nil {
|
||||
if errCode := iam.authorizeWithIAM(r, identity, action, bucket, object); errCode != s3err.ErrNone {
|
||||
return identity, errCode, reqAuthType
|
||||
return identity, errCode
|
||||
}
|
||||
} else {
|
||||
return identity, s3err.ErrAccessDenied, reqAuthType
|
||||
return identity, s3err.ErrAccessDenied
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
r.Header.Set(s3_constants.AmzAccountId, identity.Account.Id)
|
||||
|
||||
return identity, s3err.ErrNone, reqAuthType
|
||||
return identity, s3err.ErrNone
|
||||
|
||||
}
|
||||
|
||||
@@ -746,7 +699,10 @@ func (iam *IdentityAccessManagement) AuthSignatureOnly(r *http.Request) (*Identi
|
||||
glog.V(3).Infof("v4 auth type")
|
||||
identity, s3Err = iam.reqSignatureV4Verify(r)
|
||||
authType = "SigV4"
|
||||
|
||||
case authTypePostPolicy:
|
||||
glog.V(3).Infof("post policy auth type")
|
||||
r.Header.Set(s3_constants.AmzAuthType, "PostPolicy")
|
||||
return identity, s3err.ErrNone
|
||||
case authTypeStreamingUnsigned:
|
||||
glog.V(3).Infof("unsigned streaming upload")
|
||||
return identity, s3err.ErrNone
|
||||
|
||||
@@ -41,6 +41,12 @@ func isRequestPresignedSignatureV2(r *http.Request) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// Verify if request has AWS Post policy Signature Version '4'.
|
||||
func isRequestPostPolicySignatureV4(r *http.Request) bool {
|
||||
return strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") &&
|
||||
r.Method == http.MethodPost
|
||||
}
|
||||
|
||||
// Verify if the request has AWS Streaming Signature Version '4'. This is only valid for 'PUT' operation.
|
||||
// Supports both with and without trailer variants:
|
||||
// - STREAMING-AWS4-HMAC-SHA256-PAYLOAD (original)
|
||||
@@ -95,6 +101,8 @@ func getRequestAuthType(r *http.Request) authType {
|
||||
authType = authTypePresigned
|
||||
} else if isRequestJWT(r) {
|
||||
authType = authTypeJWT
|
||||
} else if isRequestPostPolicySignatureV4(r) {
|
||||
authType = authTypePostPolicy
|
||||
} else if _, ok := r.Header["Authorization"]; !ok {
|
||||
authType = authTypeAnonymous
|
||||
} else {
|
||||
|
||||
@@ -431,87 +431,3 @@ func (c *customTestFilerClient) ListEntries(ctx context.Context, in *filer_pb.Li
|
||||
(*c.traversedDirs)[in.Directory] = true
|
||||
return c.testFilerClient.ListEntries(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// TestListObjectVersions_PrefixWithLeadingSlash tests that prefixes with leading slashes work correctly
|
||||
// This validates the fix for the bug where "/Veeam/Archive/" would fail to match relative paths
|
||||
func TestListObjectVersions_PrefixWithLeadingSlash(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
inputPrefix string
|
||||
expectedNormalized string
|
||||
entryPath string
|
||||
isDirectory bool
|
||||
shouldMatch bool
|
||||
}{
|
||||
{
|
||||
name: "Prefix without leading slash matches file",
|
||||
inputPrefix: "Veeam/Archive/",
|
||||
expectedNormalized: "Veeam/Archive/",
|
||||
entryPath: "Veeam/Archive/file.txt",
|
||||
isDirectory: false,
|
||||
shouldMatch: true,
|
||||
},
|
||||
{
|
||||
name: "Prefix with leading slash (bug fix test) - normalized and matches file",
|
||||
inputPrefix: "/Veeam/Archive/",
|
||||
expectedNormalized: "Veeam/Archive/",
|
||||
entryPath: "Veeam/Archive/file.txt",
|
||||
isDirectory: false,
|
||||
shouldMatch: true,
|
||||
},
|
||||
{
|
||||
name: "Normalized prefix matches subdirectory file",
|
||||
inputPrefix: "/Veeam/",
|
||||
expectedNormalized: "Veeam/",
|
||||
entryPath: "Veeam/Backup/file.txt",
|
||||
isDirectory: false,
|
||||
shouldMatch: true,
|
||||
},
|
||||
{
|
||||
name: "Normalized prefix does not match different path",
|
||||
inputPrefix: "/Veeam/Archive/",
|
||||
expectedNormalized: "Veeam/Archive/",
|
||||
entryPath: "Veeam/Backup/file.txt",
|
||||
isDirectory: false,
|
||||
shouldMatch: false,
|
||||
},
|
||||
{
|
||||
name: "Prefix with leading slash allows descending into directory",
|
||||
inputPrefix: "/Veeam/Archive/",
|
||||
expectedNormalized: "Veeam/Archive/",
|
||||
entryPath: "Veeam",
|
||||
isDirectory: true,
|
||||
shouldMatch: true, // canDescend is true
|
||||
},
|
||||
{
|
||||
name: "Prefix with leading slash matches directory with trailing slash",
|
||||
inputPrefix: "/Veeam/",
|
||||
expectedNormalized: "Veeam/",
|
||||
entryPath: "Veeam",
|
||||
isDirectory: true,
|
||||
shouldMatch: true, // isMatch becomes true
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// This is the normalization logic from ListObjectVersionsHandler (the fix)
|
||||
normalizedPrefix := strings.TrimPrefix(tt.inputPrefix, "/")
|
||||
|
||||
// Verify normalization worked correctly
|
||||
assert.Equal(t, tt.expectedNormalized, normalizedPrefix,
|
||||
"Prefix normalization should strip leading slash")
|
||||
|
||||
// This simulates the full matchesPrefixFilter logic used in findVersionsRecursively
|
||||
isMatch := strings.HasPrefix(tt.entryPath, normalizedPrefix)
|
||||
if !isMatch && tt.isDirectory {
|
||||
isMatch = strings.HasPrefix(tt.entryPath+"/", normalizedPrefix)
|
||||
}
|
||||
canDescend := tt.isDirectory && strings.HasPrefix(normalizedPrefix, tt.entryPath)
|
||||
matches := isMatch || canDescend
|
||||
|
||||
assert.Equal(t, tt.shouldMatch, matches,
|
||||
"Normalized prefix should correctly match/not match the path based on full filter logic")
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
|
||||
entry.Attributes.Mime = objectContentType
|
||||
|
||||
// Set object owner for directory objects (same as regular objects)
|
||||
s3a.setObjectOwnerFromRequest(r, bucket, entry)
|
||||
s3a.setObjectOwnerFromRequest(r, entry)
|
||||
}); err != nil {
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrInternalError)
|
||||
return
|
||||
@@ -748,44 +748,15 @@ func filerErrorToS3Error(err error) s3err.ErrorCode {
|
||||
}
|
||||
}
|
||||
|
||||
// setObjectOwnerFromRequest sets the object owner metadata based on the bucket ownership policy.
|
||||
// When BucketOwnerEnforced (the modern AWS default), the bucket owner owns all objects.
|
||||
// Otherwise, the uploader's account ID is used (ObjectWriter mode).
|
||||
func (s3a *S3ApiServer) setObjectOwnerFromRequest(r *http.Request, bucket string, entry *filer_pb.Entry) {
|
||||
var ownerId string
|
||||
|
||||
// Check if bucketRegistry is available
|
||||
if s3a.bucketRegistry == nil {
|
||||
// Fallback to uploader if registry unavailable
|
||||
ownerId = r.Header.Get(s3_constants.AmzAccountId)
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: bucketRegistry unavailable, fallback to uploader %s", ownerId)
|
||||
} else {
|
||||
// Check bucket ownership policy
|
||||
bucketMetadata, errCode := s3a.bucketRegistry.GetBucketMetadata(bucket)
|
||||
useBucketOwner := errCode == s3err.ErrNone && bucketMetadata != nil &&
|
||||
bucketMetadata.ObjectOwnership == s3_constants.OwnershipBucketOwnerEnforced &&
|
||||
bucketMetadata.Owner != nil && bucketMetadata.Owner.ID != nil
|
||||
|
||||
if useBucketOwner {
|
||||
ownerId = *bucketMetadata.Owner.ID
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: using bucket owner %s (BucketOwnerEnforced)", ownerId)
|
||||
} else {
|
||||
ownerId = r.Header.Get(s3_constants.AmzAccountId)
|
||||
if errCode != s3err.ErrNone || bucketMetadata == nil {
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: fallback to uploader %s", ownerId)
|
||||
} else if bucketMetadata.ObjectOwnership == s3_constants.OwnershipBucketOwnerEnforced {
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: BucketOwnerEnforced but no owner found, fallback to uploader %s", ownerId)
|
||||
} else {
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: using uploader %s (ObjectWriter mode)", ownerId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ownerId != "" {
|
||||
// setObjectOwnerFromRequest sets the object owner metadata based on the authenticated user
|
||||
func (s3a *S3ApiServer) setObjectOwnerFromRequest(r *http.Request, entry *filer_pb.Entry) {
|
||||
amzAccountId := r.Header.Get(s3_constants.AmzAccountId)
|
||||
if amzAccountId != "" {
|
||||
if entry.Extended == nil {
|
||||
entry.Extended = make(map[string][]byte)
|
||||
}
|
||||
entry.Extended[s3_constants.ExtAmzOwnerKey] = []byte(ownerId)
|
||||
entry.Extended[s3_constants.ExtAmzOwnerKey] = []byte(amzAccountId)
|
||||
glog.V(2).Infof("setObjectOwnerFromRequest: set object owner to %s", amzAccountId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1064,7 +1035,7 @@ func (s3a *S3ApiServer) putVersionedObject(r *http.Request, bucket, object strin
|
||||
versionEntry.Extended[s3_constants.ExtETagKey] = []byte(etag)
|
||||
|
||||
// Set object owner for versioned objects
|
||||
s3a.setObjectOwnerFromRequest(r, bucket, versionEntry)
|
||||
s3a.setObjectOwnerFromRequest(r, versionEntry)
|
||||
|
||||
// Extract and store object lock metadata from request headers
|
||||
if err := s3a.extractObjectLockMetadataFromRequest(r, versionEntry); err != nil {
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
|
||||
)
|
||||
|
||||
func TestSetObjectOwnerFromRequest(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
bucketRegistryNil bool
|
||||
bucketMetadata *BucketMetaData
|
||||
bucketMetadataError s3err.ErrorCode
|
||||
uploaderAccountId string
|
||||
expectedOwnerId string
|
||||
description string
|
||||
}{
|
||||
{
|
||||
name: "BucketOwnerEnforced - use bucket owner",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipBucketOwnerEnforced,
|
||||
Owner: &s3.Owner{
|
||||
ID: stringPtr("bucket-owner-123"),
|
||||
DisplayName: stringPtr("Bucket Owner"),
|
||||
},
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "bucket-owner-123",
|
||||
description: "Should use bucket owner when BucketOwnerEnforced",
|
||||
},
|
||||
{
|
||||
name: "ObjectWriter - use uploader",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipObjectWriter,
|
||||
Owner: &s3.Owner{
|
||||
ID: stringPtr("bucket-owner-123"),
|
||||
DisplayName: stringPtr("Bucket Owner"),
|
||||
},
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should use uploader when ObjectWriter mode",
|
||||
},
|
||||
{
|
||||
name: "BucketOwnerPreferred - use uploader",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipBucketOwnerPreferred,
|
||||
Owner: &s3.Owner{
|
||||
ID: stringPtr("bucket-owner-123"),
|
||||
DisplayName: stringPtr("Bucket Owner"),
|
||||
},
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should use uploader when BucketOwnerPreferred mode",
|
||||
},
|
||||
{
|
||||
name: "BucketOwnerEnforced but owner is nil - fallback to uploader",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipBucketOwnerEnforced,
|
||||
Owner: nil,
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should fallback to uploader when bucket owner is nil",
|
||||
},
|
||||
{
|
||||
name: "BucketOwnerEnforced but owner ID is nil - fallback to uploader",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipBucketOwnerEnforced,
|
||||
Owner: &s3.Owner{
|
||||
ID: nil,
|
||||
DisplayName: stringPtr("Bucket Owner"),
|
||||
},
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should fallback to uploader when bucket owner ID is nil",
|
||||
},
|
||||
{
|
||||
name: "Bucket metadata error - fallback to uploader",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: nil,
|
||||
bucketMetadataError: s3err.ErrNoSuchBucket,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should fallback to uploader when bucket metadata unavailable",
|
||||
},
|
||||
{
|
||||
name: "Bucket registry is nil - fallback to uploader",
|
||||
bucketRegistryNil: true,
|
||||
uploaderAccountId: "uploader-456",
|
||||
expectedOwnerId: "uploader-456",
|
||||
description: "Should fallback to uploader when bucketRegistry is nil",
|
||||
},
|
||||
{
|
||||
name: "Empty uploader account ID - no owner set",
|
||||
bucketRegistryNil: false,
|
||||
bucketMetadata: &BucketMetaData{
|
||||
Name: "test-bucket",
|
||||
ObjectOwnership: s3_constants.OwnershipObjectWriter,
|
||||
Owner: &s3.Owner{
|
||||
ID: stringPtr("bucket-owner-123"),
|
||||
DisplayName: stringPtr("Bucket Owner"),
|
||||
},
|
||||
},
|
||||
bucketMetadataError: s3err.ErrNone,
|
||||
uploaderAccountId: "",
|
||||
expectedOwnerId: "",
|
||||
description: "Should not set owner when uploader account ID is empty",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Create mock S3ApiServer
|
||||
s3a := &S3ApiServer{}
|
||||
|
||||
// Setup bucket registry with mock behavior
|
||||
if !tt.bucketRegistryNil {
|
||||
// Create a minimal BucketRegistry with overridden GetBucketMetadata
|
||||
s3a.bucketRegistry = &BucketRegistry{
|
||||
metadataCache: map[string]*BucketMetaData{},
|
||||
notFound: map[string]struct{}{},
|
||||
}
|
||||
|
||||
// Pre-populate the cache with test metadata
|
||||
if tt.bucketMetadata != nil && tt.bucketMetadataError == s3err.ErrNone {
|
||||
s3a.bucketRegistry.metadataCache["test-bucket"] = tt.bucketMetadata
|
||||
} else if tt.bucketMetadataError == s3err.ErrNoSuchBucket {
|
||||
s3a.bucketRegistry.notFound["test-bucket"] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// Create mock request with uploader account ID
|
||||
req, _ := http.NewRequest("PUT", "/test-bucket/test-object", nil)
|
||||
req.Header.Set(s3_constants.AmzAccountId, tt.uploaderAccountId)
|
||||
|
||||
// Create entry
|
||||
entry := &filer_pb.Entry{
|
||||
Name: "test-object",
|
||||
}
|
||||
|
||||
// Call the function
|
||||
s3a.setObjectOwnerFromRequest(req, "test-bucket", entry)
|
||||
|
||||
// Verify the owner ID
|
||||
if tt.expectedOwnerId == "" {
|
||||
if entry.Extended != nil {
|
||||
if _, exists := entry.Extended[s3_constants.ExtAmzOwnerKey]; exists {
|
||||
t.Errorf("%s: Expected no owner to be set, but owner was set", tt.description)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if entry.Extended == nil {
|
||||
t.Errorf("%s: Expected owner to be set, but Extended is nil", tt.description)
|
||||
return
|
||||
}
|
||||
ownerBytes, exists := entry.Extended[s3_constants.ExtAmzOwnerKey]
|
||||
if !exists {
|
||||
t.Errorf("%s: Expected owner to be set, but ExtAmzOwnerKey not found", tt.description)
|
||||
return
|
||||
}
|
||||
actualOwnerId := string(ownerBytes)
|
||||
if actualOwnerId != tt.expectedOwnerId {
|
||||
t.Errorf("%s: Expected owner ID %s, got %s", tt.description, tt.expectedOwnerId, actualOwnerId)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to create string pointers
|
||||
func stringPtr(s string) *string {
|
||||
return &s
|
||||
}
|
||||
@@ -985,7 +985,7 @@ func (s3a *S3ApiServer) ListObjectVersionsHandler(w http.ResponseWriter, r *http
|
||||
// Parse query parameters
|
||||
query := r.URL.Query()
|
||||
originalPrefix := query.Get("prefix") // Keep original prefix for response
|
||||
prefix := strings.TrimPrefix(originalPrefix, "/")
|
||||
prefix := originalPrefix // Use for internal processing
|
||||
// Note: prefix is used for filtering relative to bucket root, so no leading slash needed
|
||||
|
||||
keyMarker := query.Get("key-marker")
|
||||
|
||||
@@ -573,7 +573,7 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||
// raw buckets
|
||||
|
||||
// PostPolicy
|
||||
bucket.Methods(http.MethodPost).HeadersRegexp("Content-Type", "multipart/form-data*").HandlerFunc(track(s3a.iam.AuthPostPolicy(s3a.cb.Limit(s3a.PostPolicyBucketHandler, ACTION_WRITE)), "POST"))
|
||||
bucket.Methods(http.MethodPost).HeadersRegexp("Content-Type", "multipart/form-data*").HandlerFunc(track(s3a.iam.Auth(s3a.cb.Limit(s3a.PostPolicyBucketHandler, ACTION_WRITE)), "POST"))
|
||||
|
||||
// HeadBucket
|
||||
bucket.Methods(http.MethodHead).HandlerFunc(track(s3a.AuthWithPublicRead(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -618,8 +618,9 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||
|
||||
// STS API endpoint for AssumeRoleWithWebIdentity
|
||||
// POST /?Action=AssumeRoleWithWebIdentity&WebIdentityToken=...
|
||||
// This endpoint is unauthenticated - the JWT token in the request is the authentication
|
||||
// IMPORTANT: Register this BEFORE the general IAM route to prevent interception
|
||||
if s3a.stsHandlers != nil {
|
||||
// 1. Explicit query param match (highest priority)
|
||||
apiRouter.Methods(http.MethodPost).Path("/").Queries("Action", "AssumeRoleWithWebIdentity").
|
||||
HandlerFunc(track(s3a.stsHandlers.HandleSTSRequest, "STS"))
|
||||
glog.V(0).Infof("STS API enabled on S3 port (AssumeRoleWithWebIdentity)")
|
||||
@@ -627,30 +628,15 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||
|
||||
// Embedded IAM API endpoint
|
||||
// POST / (without specific query parameters)
|
||||
// Uses AuthIam for granular permission checking
|
||||
// This must be before ListBuckets since IAM uses POST and ListBuckets uses GET
|
||||
// Uses AuthIam for granular permission checking:
|
||||
// - Self-service operations (own access keys) don't require admin
|
||||
// - Operations on other users require admin privileges
|
||||
if s3a.embeddedIam != nil {
|
||||
// 2. Authenticated IAM requests
|
||||
// Only match if the request appears to be authenticated (AWS Signature)
|
||||
// This prevents unauthenticated STS requests (like AssumeRoleWithWebIdentity in body)
|
||||
// from being captured by the IAM handler which would reject them.
|
||||
iamMatcher := func(r *http.Request, rm *mux.RouteMatch) bool {
|
||||
return getRequestAuthType(r) != authTypeAnonymous
|
||||
}
|
||||
|
||||
apiRouter.Methods(http.MethodPost).Path("/").MatcherFunc(iamMatcher).
|
||||
HandlerFunc(track(s3a.embeddedIam.AuthIam(s3a.cb.Limit(s3a.embeddedIam.DoActions, ACTION_WRITE)), "IAM"))
|
||||
apiRouter.Methods(http.MethodPost).Path("/").HandlerFunc(track(s3a.embeddedIam.AuthIam(s3a.cb.Limit(s3a.embeddedIam.DoActions, ACTION_WRITE)), "IAM"))
|
||||
glog.V(0).Infof("Embedded IAM API enabled on S3 port")
|
||||
}
|
||||
|
||||
// 3. Fallback STS handler (lowest priority)
|
||||
// Catches unauthenticated POST / requests that didn't match specific query params.
|
||||
// This primarily handles AssumeRoleWithWebIdentity where parameters are in the POST body.
|
||||
if s3a.stsHandlers != nil {
|
||||
glog.V(1).Infof("Registering fallback STS handler for unauthenticated POST requests")
|
||||
apiRouter.Methods(http.MethodPost).Path("/").
|
||||
HandlerFunc(track(s3a.stsHandlers.HandleSTSRequest, "STS-Fallback"))
|
||||
}
|
||||
|
||||
// ListBuckets
|
||||
apiRouter.Methods(http.MethodGet).Path("/").HandlerFunc(track(s3a.iam.Auth(s3a.ListBucketsHandler, ACTION_LIST), "LIST"))
|
||||
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/seaweedfs/seaweedfs/weed/credential"
|
||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// setupRoutingTestServer creates a minimal S3ApiServer for routing tests
|
||||
func setupRoutingTestServer(t *testing.T) *S3ApiServer {
|
||||
opt := &S3ApiServerOption{EnableIam: true}
|
||||
iam := NewIdentityAccessManagementWithStore(opt, "memory")
|
||||
iam.isAuthEnabled = true
|
||||
|
||||
if iam.credentialManager == nil {
|
||||
cm, err := credential.NewCredentialManager("memory", util.GetViper(), "")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create credential manager: %v", err)
|
||||
}
|
||||
iam.credentialManager = cm
|
||||
}
|
||||
|
||||
server := &S3ApiServer{
|
||||
option: opt,
|
||||
iam: iam,
|
||||
credentialManager: iam.credentialManager,
|
||||
embeddedIam: NewEmbeddedIamApi(iam.credentialManager, iam),
|
||||
stsHandlers: &STSHandlers{},
|
||||
}
|
||||
|
||||
return server
|
||||
}
|
||||
|
||||
// TestRouting_STSWithQueryParams verifies that AssumeRoleWithWebIdentity with query params routes to STS
|
||||
func TestRouting_STSWithQueryParams(t *testing.T) {
|
||||
router := mux.NewRouter()
|
||||
s3a := setupRoutingTestServer(t)
|
||||
s3a.registerRouter(router)
|
||||
|
||||
// Create request with Action in query params (no auth header)
|
||||
req, _ := http.NewRequest("POST", "/?Action=AssumeRoleWithWebIdentity&WebIdentityToken=test-token&RoleArn=arn:aws:iam::123:role/test&RoleSessionName=test-session", nil)
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
router.ServeHTTP(rr, req)
|
||||
|
||||
// Should route to STS handler -> 503 (service not initialized) or 400 (validation error)
|
||||
assert.Contains(t, []int{http.StatusBadRequest, http.StatusServiceUnavailable}, rr.Code, "Should route to STS handler")
|
||||
}
|
||||
|
||||
// TestRouting_STSWithBodyParams verifies that AssumeRoleWithWebIdentity with body params routes to STS fallback
|
||||
func TestRouting_STSWithBodyParams(t *testing.T) {
|
||||
router := mux.NewRouter()
|
||||
s3a := setupRoutingTestServer(t)
|
||||
s3a.registerRouter(router)
|
||||
|
||||
// Create request with Action in POST body (no auth header)
|
||||
data := url.Values{}
|
||||
data.Set("Action", "AssumeRoleWithWebIdentity")
|
||||
data.Set("WebIdentityToken", "test-token")
|
||||
data.Set("RoleArn", "arn:aws:iam::123:role/test")
|
||||
data.Set("RoleSessionName", "test-session")
|
||||
|
||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(data.Encode()))
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
router.ServeHTTP(rr, req)
|
||||
|
||||
// Should route to STS fallback handler -> 503 (service not initialized in test)
|
||||
assert.Equal(t, http.StatusServiceUnavailable, rr.Code, "Should route to STS fallback handler (503 because STS not initialized)")
|
||||
}
|
||||
|
||||
// TestRouting_AuthenticatedIAM verifies that authenticated IAM requests route to IAM handler
|
||||
func TestRouting_AuthenticatedIAM(t *testing.T) {
|
||||
router := mux.NewRouter()
|
||||
s3a := setupRoutingTestServer(t)
|
||||
s3a.registerRouter(router)
|
||||
|
||||
// Create IAM request with Authorization header
|
||||
data := url.Values{}
|
||||
data.Set("Action", "CreateUser")
|
||||
data.Set("UserName", "testuser")
|
||||
|
||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(data.Encode()))
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Authorization", "AWS4-HMAC-SHA256 Credential=AKIA.../...")
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
router.ServeHTTP(rr, req)
|
||||
|
||||
// Should route to IAM handler -> 400/403 (invalid signature)
|
||||
// NOT 503 (which would indicate STS handler)
|
||||
assert.NotEqual(t, http.StatusServiceUnavailable, rr.Code, "Should NOT route to STS handler")
|
||||
assert.Contains(t, []int{http.StatusBadRequest, http.StatusForbidden}, rr.Code, "Should route to IAM handler (400/403 due to invalid signature)")
|
||||
}
|
||||
|
||||
// TestRouting_IAMMatcherLogic verifies the iamMatcher correctly distinguishes auth types
|
||||
func TestRouting_IAMMatcherLogic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
authHeader string
|
||||
queryParams string
|
||||
expectsIAM bool
|
||||
description string
|
||||
}{
|
||||
{
|
||||
name: "No auth - anonymous",
|
||||
authHeader: "",
|
||||
queryParams: "",
|
||||
expectsIAM: false,
|
||||
description: "Request with no auth should NOT match IAM",
|
||||
},
|
||||
{
|
||||
name: "AWS4 signature",
|
||||
authHeader: "AWS4-HMAC-SHA256 Credential=AKIA.../...",
|
||||
queryParams: "",
|
||||
expectsIAM: true,
|
||||
description: "Request with AWS4 signature should match IAM",
|
||||
},
|
||||
{
|
||||
name: "AWS2 signature",
|
||||
authHeader: "AWS AKIA...:signature",
|
||||
queryParams: "",
|
||||
expectsIAM: true,
|
||||
description: "Request with AWS2 signature should match IAM",
|
||||
},
|
||||
{
|
||||
name: "Presigned V4",
|
||||
authHeader: "",
|
||||
queryParams: "?X-Amz-Credential=AKIA...",
|
||||
expectsIAM: true,
|
||||
description: "Request with presigned V4 params should match IAM",
|
||||
},
|
||||
{
|
||||
name: "Presigned V2",
|
||||
authHeader: "",
|
||||
queryParams: "?AWSAccessKeyId=AKIA...",
|
||||
expectsIAM: true,
|
||||
description: "Request with presigned V2 params should match IAM",
|
||||
},
|
||||
{
|
||||
name: "AWS4 signature with STS action in body",
|
||||
authHeader: "AWS4-HMAC-SHA256 Credential=AKIA.../...",
|
||||
queryParams: "",
|
||||
expectsIAM: true,
|
||||
description: "Authenticated STS action should still route to IAM (auth takes precedence)",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
router := mux.NewRouter()
|
||||
s3a := setupRoutingTestServer(t)
|
||||
s3a.registerRouter(router)
|
||||
|
||||
data := url.Values{}
|
||||
// For the authenticated STS action test, set the STS action
|
||||
// For other tests, don't set Action to avoid STS validation errors
|
||||
if tt.name == "AWS4 signature with STS action in body" {
|
||||
data.Set("Action", "AssumeRoleWithWebIdentity")
|
||||
data.Set("WebIdentityToken", "test-token")
|
||||
data.Set("RoleArn", "arn:aws:iam::123:role/test")
|
||||
data.Set("RoleSessionName", "test-session")
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest("POST", "/"+tt.queryParams, strings.NewReader(data.Encode()))
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
if tt.authHeader != "" {
|
||||
req.Header.Set("Authorization", tt.authHeader)
|
||||
}
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
router.ServeHTTP(rr, req)
|
||||
|
||||
if tt.expectsIAM {
|
||||
// Should route to IAM (400/403 for invalid sig)
|
||||
// NOT 400 from STS (which would be missing Action parameter)
|
||||
// We distinguish by checking it's NOT a generic 400 with empty body
|
||||
assert.NotEqual(t, http.StatusServiceUnavailable, rr.Code, tt.description)
|
||||
} else {
|
||||
// Should route to STS fallback
|
||||
// Can be 503 (service not initialized) or 400 (missing/invalid Action parameter)
|
||||
assert.Contains(t, []int{http.StatusBadRequest, http.StatusServiceUnavailable}, rr.Code, tt.description)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -118,17 +118,17 @@ func diskInfoToString(diskInfo *master_pb.DiskInfo) string {
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (c *commandVolumeList) writeTopologyInfo(writer io.Writer, t *master_pb.TopologyInfo, volumeSizeLimitMb uint64, verbosityLevel int) *statistics {
|
||||
func (c *commandVolumeList) writeTopologyInfo(writer io.Writer, t *master_pb.TopologyInfo, volumeSizeLimitMb uint64, verbosityLevel int) statistics {
|
||||
output(verbosityLevel >= 0, writer, "Topology volumeSizeLimit:%d MB%s\n", volumeSizeLimitMb, diskInfosToString(t.DiskInfos))
|
||||
slices.SortFunc(t.DataCenterInfos, func(a, b *master_pb.DataCenterInfo) int {
|
||||
return strings.Compare(a.Id, b.Id)
|
||||
})
|
||||
s := newStatistics()
|
||||
var s statistics
|
||||
for _, dc := range t.DataCenterInfos {
|
||||
if *c.dataCenter != "" && *c.dataCenter != dc.Id {
|
||||
continue
|
||||
}
|
||||
s.add(c.writeDataCenterInfo(writer, dc, verbosityLevel))
|
||||
s = s.plus(c.writeDataCenterInfo(writer, dc, verbosityLevel))
|
||||
}
|
||||
output(verbosityLevel >= 0, writer, "%+v \n", s)
|
||||
return s
|
||||
@@ -144,7 +144,7 @@ func (c *commandVolumeList) writeDataCenterInfo(writer io.Writer, t *master_pb.D
|
||||
if *c.rack != "" && *c.rack != r.Id {
|
||||
continue
|
||||
}
|
||||
s.add(c.writeRackInfo(writer, r, verbosityLevel, func() {
|
||||
s = s.plus(c.writeRackInfo(writer, r, verbosityLevel, func() {
|
||||
output(verbosityLevel >= 1, writer, " DataCenter %s%s\n", t.Id, diskInfosToString(t.DiskInfos))
|
||||
}))
|
||||
if !dataCenterInfoFound && !s.isEmpty() {
|
||||
@@ -165,7 +165,7 @@ func (c *commandVolumeList) writeRackInfo(writer io.Writer, t *master_pb.RackInf
|
||||
if *c.dataNode != "" && *c.dataNode != dn.Id {
|
||||
continue
|
||||
}
|
||||
s.add(c.writeDataNodeInfo(writer, dn, verbosityLevel, func() {
|
||||
s = s.plus(c.writeDataNodeInfo(writer, dn, verbosityLevel, func() {
|
||||
outCenterInfo()
|
||||
output(verbosityLevel >= 2, writer, " Rack %s%s\n", t.Id, diskInfosToString(t.DiskInfos))
|
||||
}))
|
||||
@@ -182,7 +182,7 @@ func (c *commandVolumeList) writeDataNodeInfo(writer io.Writer, t *master_pb.Dat
|
||||
diskInfoFound := false
|
||||
for _, diskType := range sortMapKey(t.DiskInfos) {
|
||||
diskInfo := t.DiskInfos[diskType]
|
||||
s.add(c.writeDiskInfo(writer, diskInfo, verbosityLevel, func() {
|
||||
s = s.plus(c.writeDiskInfo(writer, diskInfo, verbosityLevel, func() {
|
||||
outRackInfo()
|
||||
output(verbosityLevel >= 3, writer, " DataNode %s%s\n", t.Id, diskInfosToString(t.DiskInfos))
|
||||
}))
|
||||
@@ -232,7 +232,7 @@ func (c *commandVolumeList) writeDiskInfo(writer io.Writer, t *master_pb.DiskInf
|
||||
output(verbosityLevel >= 4, writer, " Disk %s(%s) id:%d\n", diskType, diskInfoToString(t), t.DiskId)
|
||||
volumeInfosFound = true
|
||||
}
|
||||
s.add(writeVolumeInformationMessage(writer, vi, verbosityLevel))
|
||||
s = s.plus(writeVolumeInformationMessage(writer, vi, verbosityLevel))
|
||||
}
|
||||
ecShardInfoFound := false
|
||||
for _, ecShardInfo := range t.EcShardInfos {
|
||||
@@ -244,7 +244,29 @@ func (c *commandVolumeList) writeDiskInfo(writer io.Writer, t *master_pb.DiskInf
|
||||
output(verbosityLevel >= 4, writer, " Disk %s(%s) id:%d\n", diskType, diskInfoToString(t), t.DiskId)
|
||||
ecShardInfoFound = true
|
||||
}
|
||||
s.add(writeECShardInformationMessage(writer, ecShardInfo, verbosityLevel))
|
||||
var expireAtString string
|
||||
destroyTime := ecShardInfo.ExpireAtSec
|
||||
if destroyTime > 0 {
|
||||
expireAtString = fmt.Sprintf("expireAt:%s", time.Unix(int64(destroyTime), 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
// Build shard size information
|
||||
si := erasure_coding.ShardsInfoFromVolumeEcShardInformationMessage(ecShardInfo)
|
||||
var totalSize int64
|
||||
var shardSizeInfo string
|
||||
|
||||
if len(ecShardInfo.ShardSizes) > 0 {
|
||||
var shardDetails []string
|
||||
for _, shardId := range si.Ids() {
|
||||
size := int64(si.Size(shardId))
|
||||
shardDetails = append(shardDetails, fmt.Sprintf("%d:%s", shardId, util.BytesToHumanReadable(uint64(size))))
|
||||
totalSize += size
|
||||
}
|
||||
shardSizeInfo = fmt.Sprintf(" sizes:[%s] total:%s", strings.Join(shardDetails, " "), util.BytesToHumanReadable(uint64(totalSize)))
|
||||
}
|
||||
|
||||
output(verbosityLevel >= 5, writer, " ec volume id:%v collection:%v shards:%v%s %s\n",
|
||||
ecShardInfo.Id, ecShardInfo.Collection, si.Ids(), shardSizeInfo, expireAtString)
|
||||
}
|
||||
output((volumeInfosFound || ecShardInfoFound) && verbosityLevel >= 4, writer, " Disk %s %+v \n", diskType, s)
|
||||
return s
|
||||
@@ -252,42 +274,7 @@ func (c *commandVolumeList) writeDiskInfo(writer io.Writer, t *master_pb.DiskInf
|
||||
|
||||
func writeVolumeInformationMessage(writer io.Writer, t *master_pb.VolumeInformationMessage, verbosityLevel int) statistics {
|
||||
output(verbosityLevel >= 5, writer, " volume %+v \n", t)
|
||||
return statistics{
|
||||
Size: t.Size,
|
||||
FileCount: t.FileCount,
|
||||
DeletedFileCount: t.DeleteCount,
|
||||
DeletedBytes: t.DeletedByteCount,
|
||||
}
|
||||
}
|
||||
|
||||
func writeECShardInformationMessage(writer io.Writer, t *master_pb.VolumeEcShardInformationMessage, verbosityLevel int) statistics {
|
||||
var expireAtString string
|
||||
if t.ExpireAtSec > 0 {
|
||||
expireAtString = fmt.Sprintf("expireAt:%s", time.Unix(int64(t.ExpireAtSec), 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
// Build shard size information
|
||||
si := erasure_coding.ShardsInfoFromVolumeEcShardInformationMessage(t)
|
||||
var totalSize uint64
|
||||
var shardSizeInfo string
|
||||
|
||||
if len(t.ShardSizes) > 0 {
|
||||
var shardDetails []string
|
||||
for _, shardId := range si.Ids() {
|
||||
size := uint64(si.Size(shardId))
|
||||
shardDetails = append(shardDetails, fmt.Sprintf("%d:%s", shardId, util.BytesToHumanReadable(size)))
|
||||
totalSize += size
|
||||
}
|
||||
shardSizeInfo = fmt.Sprintf(" sizes:[%s] total:%s", strings.Join(shardDetails, " "), util.BytesToHumanReadable(totalSize))
|
||||
}
|
||||
|
||||
output(verbosityLevel >= 5, writer, " ec volume id:%v collection:%v shards:%v%s %s\n",
|
||||
t.Id, t.Collection, si.Ids(), shardSizeInfo, expireAtString)
|
||||
|
||||
// TODO: add file counts once available in VolumeEcShardInformationMessage.
|
||||
return statistics{
|
||||
Size: totalSize,
|
||||
}
|
||||
return newStatistics(t)
|
||||
}
|
||||
|
||||
func output(condition bool, w io.Writer, format string, a ...interface{}) {
|
||||
@@ -303,22 +290,29 @@ type statistics struct {
|
||||
DeletedBytes uint64
|
||||
}
|
||||
|
||||
func newStatistics() *statistics {
|
||||
return &statistics{}
|
||||
func newStatistics(t *master_pb.VolumeInformationMessage) statistics {
|
||||
return statistics{
|
||||
Size: t.Size,
|
||||
FileCount: t.FileCount,
|
||||
DeletedFileCount: t.DeleteCount,
|
||||
DeletedBytes: t.DeletedByteCount,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *statistics) add(t statistics) {
|
||||
s.Size += t.Size
|
||||
s.FileCount += t.FileCount
|
||||
s.DeletedFileCount += t.DeletedFileCount
|
||||
s.DeletedBytes += t.DeletedBytes
|
||||
func (s statistics) plus(t statistics) statistics {
|
||||
return statistics{
|
||||
Size: s.Size + t.Size,
|
||||
FileCount: s.FileCount + t.FileCount,
|
||||
DeletedFileCount: s.DeletedFileCount + t.DeletedFileCount,
|
||||
DeletedBytes: s.DeletedBytes + t.DeletedBytes,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *statistics) isEmpty() bool {
|
||||
func (s statistics) isEmpty() bool {
|
||||
return s.Size == 0 && s.FileCount == 0 && s.DeletedFileCount == 0 && s.DeletedBytes == 0
|
||||
}
|
||||
|
||||
func (s *statistics) String() string {
|
||||
func (s statistics) String() string {
|
||||
if s.DeletedFileCount > 0 {
|
||||
return fmt.Sprintf("total size:%d file_count:%d deleted_file:%d deleted_bytes:%d", s.Size, s.FileCount, s.DeletedFileCount, s.DeletedBytes)
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PathPrefixFilter provides filtering based on include and exclude path prefixes.
|
||||
// When both include and exclude prefixes match a path, the deepest matching prefix wins.
|
||||
// This enables fine-grained control like: exclude /buckets/legacy but include /buckets/legacy/important
|
||||
type PathPrefixFilter struct {
|
||||
includePrefixes []string // normalized with trailing /
|
||||
excludePrefixes []string // normalized with trailing /
|
||||
}
|
||||
|
||||
// NewPathPrefixFilter creates a new PathPrefixFilter from comma-separated include and exclude prefix strings.
|
||||
// Each prefix is normalized to have a trailing slash for directory boundary matching.
|
||||
// Invalid prefixes (empty or not starting with /) are skipped with a warning via the provided warn function.
|
||||
func NewPathPrefixFilter(includePrefixes, excludePrefixes string, warn func(format string, args ...interface{})) *PathPrefixFilter {
|
||||
pf := &PathPrefixFilter{}
|
||||
|
||||
pf.includePrefixes = parsePrefixes(includePrefixes, warn)
|
||||
pf.excludePrefixes = parsePrefixes(excludePrefixes, warn)
|
||||
|
||||
return pf
|
||||
}
|
||||
|
||||
// parsePrefixes parses a comma-separated list of prefixes and normalizes them.
|
||||
func parsePrefixes(prefixList string, warn func(format string, args ...interface{})) []string {
|
||||
if prefixList == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
var result []string
|
||||
for _, p := range strings.Split(prefixList, ",") {
|
||||
p = strings.TrimSpace(p)
|
||||
if p == "" {
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(p, "/") {
|
||||
if warn != nil {
|
||||
warn("prefix %q does not start with '/', skipping", p)
|
||||
}
|
||||
continue
|
||||
}
|
||||
// Normalize: ensure trailing slash for directory boundary matching
|
||||
if !strings.HasSuffix(p, "/") {
|
||||
p = p + "/"
|
||||
}
|
||||
result = append(result, p)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// HasFilters returns true if any include or exclude prefixes are configured.
|
||||
func (pf *PathPrefixFilter) HasFilters() bool {
|
||||
return len(pf.includePrefixes) > 0 || len(pf.excludePrefixes) > 0
|
||||
}
|
||||
|
||||
// ShouldInclude returns true if the path should be included based on the configured prefixes.
|
||||
//
|
||||
// Logic:
|
||||
// - If no filters are configured, include everything.
|
||||
// - Find the deepest matching prefix from either include or exclude list.
|
||||
// - If the deepest match is in includePrefixes, include the path.
|
||||
// - If the deepest match is in excludePrefixes, exclude the path.
|
||||
// - If no match is found and includePrefixes is non-empty, exclude (explicit include required).
|
||||
// - If no match is found and includePrefixes is empty, include (default allow with excludes).
|
||||
func (pf *PathPrefixFilter) ShouldInclude(fullpath string) bool {
|
||||
if !pf.HasFilters() {
|
||||
return true
|
||||
}
|
||||
|
||||
// Normalize path for matching
|
||||
checkPath := fullpath
|
||||
if !strings.HasSuffix(checkPath, "/") {
|
||||
checkPath = checkPath + "/"
|
||||
}
|
||||
|
||||
// Find deepest matching prefix from each list
|
||||
includeMatch := findDeepestMatch(checkPath, pf.includePrefixes)
|
||||
excludeMatch := findDeepestMatch(checkPath, pf.excludePrefixes)
|
||||
|
||||
// Determine result based on which match is deeper
|
||||
if includeMatch != "" && excludeMatch != "" {
|
||||
// Both matched - deeper prefix wins
|
||||
return len(includeMatch) >= len(excludeMatch)
|
||||
}
|
||||
|
||||
if includeMatch != "" {
|
||||
return true
|
||||
}
|
||||
|
||||
if excludeMatch != "" {
|
||||
return false
|
||||
}
|
||||
|
||||
// No match found
|
||||
if len(pf.includePrefixes) > 0 {
|
||||
// If includes are specified, require explicit include
|
||||
return false
|
||||
}
|
||||
|
||||
// Default: include if only excludes are specified
|
||||
return true
|
||||
}
|
||||
|
||||
// findDeepestMatch finds the longest prefix that matches the path.
|
||||
func findDeepestMatch(path string, prefixes []string) string {
|
||||
var deepest string
|
||||
for _, prefix := range prefixes {
|
||||
if strings.HasPrefix(path, prefix) {
|
||||
if len(prefix) > len(deepest) {
|
||||
deepest = prefix
|
||||
}
|
||||
}
|
||||
}
|
||||
return deepest
|
||||
}
|
||||
|
||||
// GetIncludePrefixes returns the configured include prefixes.
|
||||
func (pf *PathPrefixFilter) GetIncludePrefixes() []string {
|
||||
return pf.includePrefixes
|
||||
}
|
||||
|
||||
// GetExcludePrefixes returns the configured exclude prefixes.
|
||||
func (pf *PathPrefixFilter) GetExcludePrefixes() []string {
|
||||
return pf.excludePrefixes
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPathPrefixFilter_Empty(t *testing.T) {
|
||||
pf := NewPathPrefixFilter("", "", nil)
|
||||
|
||||
if pf.HasFilters() {
|
||||
t.Error("empty filter should have no filters")
|
||||
}
|
||||
|
||||
// Should include everything when no filters
|
||||
tests := []string{"/", "/foo", "/foo/bar", "/buckets/test"}
|
||||
for _, path := range tests {
|
||||
if !pf.ShouldInclude(path) {
|
||||
t.Errorf("empty filter should include %q", path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_ExcludeOnly(t *testing.T) {
|
||||
pf := NewPathPrefixFilter("", "/buckets/legacy,/buckets/old", nil)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/buckets/active", true},
|
||||
{"/buckets/active/file.txt", true},
|
||||
{"/buckets/legacy", false},
|
||||
{"/buckets/legacy/file.txt", false},
|
||||
{"/buckets/legacy_new", true}, // boundary check: not a prefix match
|
||||
{"/buckets/old", false},
|
||||
{"/buckets/old/data", false},
|
||||
{"/other", true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_IncludeOnly(t *testing.T) {
|
||||
pf := NewPathPrefixFilter("/buckets/important,/data", "", nil)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/buckets/important", true},
|
||||
{"/buckets/important/file.txt", true},
|
||||
{"/data", true},
|
||||
{"/data/file.txt", true},
|
||||
{"/buckets/other", false}, // not in include list
|
||||
{"/other", false},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_DeeperPrefixWins(t *testing.T) {
|
||||
// Exclude /buckets/keep but include /buckets/keep/important
|
||||
pf := NewPathPrefixFilter("/buckets/keep/important", "/buckets/keep", nil)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/buckets/keep", false},
|
||||
{"/buckets/keep/other", false},
|
||||
{"/buckets/keep/important", true}, // deeper include wins
|
||||
{"/buckets/keep/important/file.txt", true}, // deeper include wins
|
||||
{"/buckets/other", false}, // not matched, include required
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_DeeperExcludeWins(t *testing.T) {
|
||||
// Include /buckets but exclude /buckets/legacy
|
||||
pf := NewPathPrefixFilter("/buckets", "/buckets/legacy", nil)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/buckets", true},
|
||||
{"/buckets/active", true},
|
||||
{"/buckets/legacy", false}, // deeper exclude wins
|
||||
{"/buckets/legacy/file.txt", false}, // deeper exclude wins
|
||||
{"/other", false}, // not in include list
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_MultipleOverlappingPrefixes(t *testing.T) {
|
||||
// Complex scenario with multiple overlapping prefixes
|
||||
pf := NewPathPrefixFilter(
|
||||
"/a,/a/b/c/d", // includes
|
||||
"/a/b,/a/b/c/d/e", // excludes
|
||||
nil,
|
||||
)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/a", true}, // direct include match
|
||||
{"/a/x", true}, // under include /a
|
||||
{"/a/b", false}, // deeper exclude /a/b beats /a
|
||||
{"/a/b/x", false}, // under exclude /a/b
|
||||
{"/a/b/c", false}, // under exclude /a/b
|
||||
{"/a/b/c/d", true}, // deeper include /a/b/c/d beats /a/b
|
||||
{"/a/b/c/d/x", true}, // under include /a/b/c/d
|
||||
{"/a/b/c/d/e", false}, // deeper exclude /a/b/c/d/e beats /a/b/c/d
|
||||
{"/a/b/c/d/e/f", false}, // under exclude /a/b/c/d/e
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_InvalidPrefixes(t *testing.T) {
|
||||
var warnings []string
|
||||
warn := func(format string, args ...interface{}) {
|
||||
warnings = append(warnings, format)
|
||||
}
|
||||
|
||||
pf := NewPathPrefixFilter("invalid,/valid", "also_invalid", warn)
|
||||
|
||||
if len(warnings) != 2 {
|
||||
t.Errorf("expected 2 warnings, got %d", len(warnings))
|
||||
}
|
||||
|
||||
// Only valid prefix should be stored
|
||||
if len(pf.includePrefixes) != 1 {
|
||||
t.Errorf("expected 1 include prefix, got %d", len(pf.includePrefixes))
|
||||
}
|
||||
if len(pf.excludePrefixes) != 0 {
|
||||
t.Errorf("expected 0 exclude prefixes, got %d", len(pf.excludePrefixes))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_TrailingSlashNormalization(t *testing.T) {
|
||||
pf := NewPathPrefixFilter("/path/to/dir", "/exclude/this/", nil)
|
||||
|
||||
// Both should be normalized with trailing slash
|
||||
if pf.includePrefixes[0] != "/path/to/dir/" {
|
||||
t.Errorf("include prefix not normalized: %q", pf.includePrefixes[0])
|
||||
}
|
||||
if pf.excludePrefixes[0] != "/exclude/this/" {
|
||||
t.Errorf("exclude prefix not normalized: %q", pf.excludePrefixes[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathPrefixFilter_BoundaryMatching(t *testing.T) {
|
||||
pf := NewPathPrefixFilter("", "/buckets/legacy1", nil)
|
||||
|
||||
tests := []struct {
|
||||
path string
|
||||
include bool
|
||||
}{
|
||||
{"/buckets/legacy1", false},
|
||||
{"/buckets/legacy1/file", false},
|
||||
{"/buckets/legacy1_backup", true}, // not a prefix match due to boundary
|
||||
{"/buckets/legacy10", true}, // not a prefix match due to boundary
|
||||
{"/buckets/legacy", true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
got := pf.ShouldInclude(tc.path)
|
||||
if got != tc.include {
|
||||
t.Errorf("ShouldInclude(%q) = %v, want %v", tc.path, got, tc.include)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user