mirror of
https://github.com/pgsty/minio.git
synced 2026-11-22 15:26:43 +03:00
Compare commits
239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 584b5a3a8f | |||
| 39f49d548f | |||
| a168576adb | |||
| e85c4c8dfb | |||
| 0e3c43778e | |||
| 9101fe78db | |||
| 82948d6306 | |||
| dfb4b2a1d2 | |||
| 143f6970d8 | |||
| ea5dac5a99 | |||
| 3c26a8b0b5 | |||
| 2fabd436c0 | |||
| 07c68d6054 | |||
| 15090dc4fd | |||
| e791640dac | |||
| 9b4ae82a29 | |||
| 4620be394b | |||
| 5e7d603083 | |||
| fb7c406ddc | |||
| 416826f61f | |||
| a2e2f3ee82 | |||
| 70c7ec4a9f | |||
| 2b722b7e92 | |||
| 4cbb074ccd | |||
| 40220bd836 | |||
| df0dfa0a34 | |||
| 80684fed59 | |||
| 055030ea53 | |||
| aea3882c95 | |||
| 0c61128d23 | |||
| 680eac66e4 | |||
| 9f3037e941 | |||
| 5f00f6762f | |||
| af2b1794d3 | |||
| d371f77dcc | |||
| 022722a7a7 | |||
| 03027727d1 | |||
| 4fcdf37ce6 | |||
| 9ebe81c1b3 | |||
| e5f5c9e7f6 | |||
| 7b4cacc392 | |||
| a0dd7dae9b | |||
| 709d50a916 | |||
| dff81f293b | |||
| f653a6ea03 | |||
| 47d239f84f | |||
| e069fe9d92 | |||
| d848fb52b5 | |||
| 3ce8319251 | |||
| 9df0f4abaf | |||
| 4d0693cb8c | |||
| bf59e3f222 | |||
| 41aa846097 | |||
| 4093fa0d78 | |||
| 13bf126ebd | |||
| 1cf529ce8a | |||
| 9b76a21675 | |||
| 89637554d6 | |||
| 2dd1e00da4 | |||
| 5d955b5b74 | |||
| f7808a172c | |||
| acc9b514f5 | |||
| 31ba01c5d5 | |||
| 48ec10312f | |||
| 114dc10529 | |||
| 461e9a7210 | |||
| fcbb93e895 | |||
| 62cf066ff5 | |||
| 1ee64a8d89 | |||
| 01aaef2b50 | |||
| bcc62afe3d | |||
| 5c57658163 | |||
| f175e98c34 | |||
| 12f631b502 | |||
| ccb676e60c | |||
| 51d41345f7 | |||
| e59a3d938e | |||
| b32f2d9dd0 | |||
| d63c92e393 | |||
| 68127c5a63 | |||
| c4b5e1cb45 | |||
| 9a303f5096 | |||
| 87d8b5967f | |||
| f760046c44 | |||
| 93e7ef4bcc | |||
| a4229b366f | |||
| 420340bc14 | |||
| e7e87402ed | |||
| a164e1dda1 | |||
| 2f61325d4a | |||
| a6145e1d2e | |||
| 5232546690 | |||
| 0c46cb641b | |||
| 1233254309 | |||
| 8a2fe9b7a0 | |||
| f26ee6bf0a | |||
| d69c4ccfe4 | |||
| 086e619505 | |||
| 48e1846525 | |||
| bcc8871b1d | |||
| 25cb3511c9 | |||
| cfefc049c1 | |||
| af56d17630 | |||
| d1105bbb3d | |||
| 66fe61ff65 | |||
| a1141a43f2 | |||
| 702f113f51 | |||
| 63aace4099 | |||
| 9d7094b770 | |||
| 450dcb8484 | |||
| 4074d00b96 | |||
| 75ba0ce402 | |||
| da142327f2 | |||
| a3df317ae0 | |||
| 2c50d11f72 | |||
| 5ac33e1583 | |||
| d57c4e8407 | |||
| 374de0fa32 | |||
| 80e23dc9f2 | |||
| 2cc0e3c6ed | |||
| f9da3b919d | |||
| 1309853f57 | |||
| 39b8e6c30a | |||
| 9a6e1477f4 | |||
| 49375ed2d3 | |||
| f817b5261c | |||
| 885bd2c20a | |||
| 89b75e7913 | |||
| 079ebb1926 | |||
| 04c29aac11 | |||
| 95e7a190b3 | |||
| 8e2392e48f | |||
| 3abe0d95a5 | |||
| 9c6c9805de | |||
| 5cb900bfad | |||
| 0af5d22286 | |||
| f1687f402b | |||
| ce606df2c4 | |||
| fd44dc4e9b | |||
| 479745e764 | |||
| cc1c54475f | |||
| e7654d470c | |||
| 4b25f7e819 | |||
| 711b092f86 | |||
| 2bc103b80c | |||
| ad873c7357 | |||
| 0af0907eff | |||
| e27ba2bc14 | |||
| 236e163c0b | |||
| 7220210e8d | |||
| 34cbca97ea | |||
| 109d824e5f | |||
| 87746913fc | |||
| 7935c84f9a | |||
| c185635b43 | |||
| c201148738 | |||
| 53adb21c52 | |||
| 58b0ee36ca | |||
| 8a1f594add | |||
| 5b9959617e | |||
| da19d91b64 | |||
| 40bee4b7ba | |||
| 6a9b5d6763 | |||
| 0720ed477e | |||
| 46e82eb54d | |||
| f8ca4a8656 | |||
| e7d0e62f16 | |||
| aee290fc34 | |||
| 62cce2b152 | |||
| 65d4806a7b | |||
| 765757473a | |||
| 425bd7fff1 | |||
| e12e739a53 | |||
| 8b736dee34 | |||
| 32e75c27bf | |||
| 885ca604a1 | |||
| d10382d0dc | |||
| 0db4bf3b00 | |||
| 87c621965d | |||
| b2dca43fda | |||
| 33a91d972f | |||
| 2cbd48a3c3 | |||
| b5409ca112 | |||
| 35bd75948a | |||
| 0c8d74205b | |||
| fcc4d77895 | |||
| c52acc1a5d | |||
| 5703426b3c | |||
| f0bd164b92 | |||
| 9936a69d89 | |||
| ce2326c946 | |||
| 4c164907f5 | |||
| 9b11dc9469 | |||
| 1eccc6908b | |||
| 202371afbd | |||
| 41ef4411d9 | |||
| 035aa6c201 | |||
| edf36bcbfa | |||
| 3598c4305d | |||
| 94fbb6df6d | |||
| f4c1286c9d | |||
| 6e112d1856 | |||
| e62dc6e023 | |||
| 84e1580a47 | |||
| ebac0ca73b | |||
| 3f9c79e919 | |||
| ec2979ca48 | |||
| 21646eebd2 | |||
| 5711996231 | |||
| 0079723d35 | |||
| bc3b35f975 | |||
| 00d864ed0e | |||
| 8f2a30d9af | |||
| d9766d7378 | |||
| 5594d284fc | |||
| 632eb4729a | |||
| 3b5de82f5a | |||
| 76195f1c68 | |||
| 6586fbfd0d | |||
| 53b09f4e25 | |||
| 59812446ad | |||
| 1c2f59604d | |||
| b3a6d5dbf8 | |||
| 11de51ec26 | |||
| 10f3a8590b | |||
| 55c22abec1 | |||
| 32a1b81e4c | |||
| 62d8c649fe | |||
| 312397739e | |||
| 7ade0c045b | |||
| f9f9fa6c90 | |||
| 0a9c777795 | |||
| d2d47a41fb | |||
| dee2c3a02b | |||
| c4140609b7 | |||
| 75a6734e49 | |||
| f8b598f1d3 | |||
| fe9dd90b22 | |||
| 7a060cab1e |
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: community, triage
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## NOTE
|
|
||||||
|
|
||||||
Silo issues are handled by community maintainers on a best-effort basis. There
|
|
||||||
is no SLA, SLO, or emergency production-support channel. Follow the local
|
|
||||||
[Code of Conduct](../code_of_conduct.md) when participating. Report suspected
|
|
||||||
vulnerabilities through the private process in [SECURITY.md](../SECURITY.md),
|
|
||||||
not in a public issue.
|
|
||||||
|
|
||||||
<!--- Provide a general summary of the issue in the Title above -->
|
|
||||||
|
|
||||||
## Expected Behavior
|
|
||||||
<!--- If you're describing a bug, tell us what should happen -->
|
|
||||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
|
||||||
|
|
||||||
## Current Behavior
|
|
||||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
|
||||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
|
||||||
|
|
||||||
## Possible Solution
|
|
||||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
|
||||||
<!--- or ideas how to implement the addition or change -->
|
|
||||||
|
|
||||||
## Steps to Reproduce (for bugs)
|
|
||||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
|
||||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
|
||||||
<!--- and include relevant Silo logs with secrets and credentials removed -->
|
|
||||||
|
|
||||||
1.
|
|
||||||
2.
|
|
||||||
3.
|
|
||||||
4.
|
|
||||||
|
|
||||||
## Context
|
|
||||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
|
||||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
|
||||||
|
|
||||||
## Regression
|
|
||||||
<!-- Is this issue a regression? (Yes / No) -->
|
|
||||||
<!-- If Yes, optionally include the Silo version, commit id, or PR that caused this regression. -->
|
|
||||||
|
|
||||||
## Your Environment
|
|
||||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
|
||||||
* Version used (`silo --version`):
|
|
||||||
* Server setup and configuration:
|
|
||||||
* Operating System and version (`uname -a`):
|
|
||||||
@@ -7,6 +7,14 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Report bugs in the PGSTY SILO server (`pgsty/silo`) here. Community maintainers
|
||||||
|
handle reports on a best-effort basis. There is no SLA, SLO, or emergency
|
||||||
|
production-support channel. Follow the
|
||||||
|
[Code of Conduct](https://github.com/pgsty/silo/blob/main/code_of_conduct.md).
|
||||||
|
Report suspected vulnerabilities privately through
|
||||||
|
[SECURITY.md](https://github.com/pgsty/silo/blob/main/SECURITY.md).
|
||||||
|
For patches, see the [contribution guide](https://github.com/pgsty/silo/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
<!--- Provide a general summary of the issue in the Title above -->
|
<!--- Provide a general summary of the issue in the Title above -->
|
||||||
|
|
||||||
## Expected Behavior
|
## Expected Behavior
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Suggest improvements to the PGSTY SILO server (`pgsty/silo`) here.
|
||||||
|
For patches, see the [contribution guide](https://github.com/pgsty/silo/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**Is your feature request related to a problem? Please describe.**
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
## Contribution Licensing (no CLA, inbound=outbound, DCO required)
|
## Contribution Licensing (no CLA, inbound=outbound, DCO required)
|
||||||
|
|
||||||
This project does not use a CLA; contributions are accepted inbound=outbound.
|
This pull request contributes to PGSTY SILO (`pgsty/silo`). Code contributions
|
||||||
|
are accepted under AGPL-3.0-or-later, the same license as the server.
|
||||||
|
This project does not use a CLA or require a separate Apache-2.0 license grant.
|
||||||
By submitting this pull request I represent that I have the right to contribute
|
By submitting this pull request I represent that I have the right to contribute
|
||||||
the changes, which are licensed under this repository's
|
the code changes under this repository's
|
||||||
[GNU Affero General Public License v3.0 or later](https://www.gnu.org/licenses/agpl-3.0.html)
|
[GNU Affero General Public License v3.0 or later](https://www.gnu.org/licenses/agpl-3.0.html)
|
||||||
and remain my copyright. Every commit must carry a DCO `Signed-off-by` trailer
|
and retain copyright in my original work. Existing copyright and license
|
||||||
|
notices remain intact; separately licensed material keeps its applicable terms.
|
||||||
|
Every commit must carry a DCO `Signed-off-by` trailer
|
||||||
(`git commit -s`) certifying the
|
(`git commit -s`) certifying the
|
||||||
[Developer Certificate of Origin](https://developercertificate.org/) — see
|
[Developer Certificate of Origin](https://developercertificate.org/) — see
|
||||||
[CONTRIBUTING.md](https://github.com/pgsty/silo/blob/main/CONTRIBUTING.md).
|
[CONTRIBUTING.md](https://github.com/pgsty/silo/blob/main/CONTRIBUTING.md).
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ on:
|
|||||||
description: "Published RELEASE.* tag to package as pgsty/silo"
|
description: "Published RELEASE.* tag to package as pgsty/silo"
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
recovery:
|
||||||
|
description: "Run the current main workflow against an already-published tag"
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -75,13 +80,19 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Verify workflow identity matches release source
|
- name: Verify workflow identity matches release source
|
||||||
|
env:
|
||||||
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
|
RECOVERY: ${{ inputs.recovery }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
CHECKED_OUT_REVISION="$(git rev-parse HEAD)"
|
CHECKED_OUT_REVISION="$(git rev-parse HEAD)"
|
||||||
if [ "${CHECKED_OUT_REVISION}" != "${GITHUB_SHA}" ]; then
|
if [ "${CHECKED_OUT_REVISION}" != "${GITHUB_SHA}" ]; then
|
||||||
echo "Checked out ${CHECKED_OUT_REVISION}, but workflow identity is ${GITHUB_SHA}. Dispatch this workflow from ${RELEASE_TAG}." >&2
|
if [ "${RECOVERY}" != "true" ] || [ "${GITHUB_REF}" != "refs/heads/${DEFAULT_BRANCH}" ]; then
|
||||||
|
echo "Checked out ${CHECKED_OUT_REVISION}, but workflow identity is ${GITHUB_SHA}. Dispatch from ${RELEASE_TAG}, or use recovery from ${DEFAULT_BRANCH}." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "Recovery workflow ${GITHUB_SHA} is packaging published source ${CHECKED_OUT_REVISION}."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Prepare verified Docker contexts
|
- name: Prepare verified Docker contexts
|
||||||
env:
|
env:
|
||||||
@@ -129,10 +140,50 @@ jobs:
|
|||||||
mkdir -p "${context}/dockerscripts"
|
mkdir -p "${context}/dockerscripts"
|
||||||
tar -xzf "${archive}" -C "${context}" silo
|
tar -xzf "${archive}" -C "${context}" silo
|
||||||
cp Dockerfile.goreleaser Dockerfile.distroless LICENSE NOTICE CREDITS "${context}/"
|
cp Dockerfile.goreleaser Dockerfile.distroless LICENSE NOTICE CREDITS "${context}/"
|
||||||
cp dockerscripts/docker-entrypoint.sh dockerscripts/download-static-curl.sh \
|
cp dockerscripts/docker-entrypoint.sh dockerscripts/build-static-curl.sh \
|
||||||
"${context}/dockerscripts/"
|
"${context}/dockerscripts/"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# The classic image bundles mcli. Resolve its two archive digests
|
||||||
|
# from the immutable published release instead of trusting defaults
|
||||||
|
# copied into an older Server tag. This also gives a recovery run a
|
||||||
|
# narrow override when a tag selected the right mcli release but
|
||||||
|
# accidentally retained stale archive pins.
|
||||||
|
MC_REPO="$(awk -F= '/^ARG MC_REPO=/{print $2; exit}' Dockerfile.goreleaser)"
|
||||||
|
MC_VERSION="$(awk -F= '/^ARG MC_VERSION=/{print $2; exit}' Dockerfile.goreleaser)"
|
||||||
|
test -n "${MC_REPO}"
|
||||||
|
test -n "${MC_VERSION}"
|
||||||
|
MC_VERSION_HYPHEN="${MC_VERSION#RELEASE.}"
|
||||||
|
MC_PKG_VERSION="$(echo "${MC_VERSION_HYPHEN}" | sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})-([0-9]{2})-([0-9]{2})Z$/\1\2\3\4\5\6.0.0/')"
|
||||||
|
if [ "${MC_PKG_VERSION}" = "${MC_VERSION_HYPHEN}" ]; then
|
||||||
|
echo "Invalid bundled mcli tag: ${MC_VERSION}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$(gh release view "${MC_VERSION}" --repo "${MC_REPO}" --json isDraft --jq .isDraft)" != false ] || \
|
||||||
|
[ "$(gh release view "${MC_VERSION}" --repo "${MC_REPO}" --json isPrerelease --jq .isPrerelease)" != false ] || \
|
||||||
|
[ "$(gh release view "${MC_VERSION}" --repo "${MC_REPO}" --json isImmutable --jq .isImmutable)" != true ]; then
|
||||||
|
echo "Bundled mcli ${MC_REPO}@${MC_VERSION} must be a published immutable release" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mc_checksums="mcli_${MC_PKG_VERSION}_checksums.txt"
|
||||||
|
gh release download "${MC_VERSION}" --repo "${MC_REPO}" \
|
||||||
|
--dir "${assets_dir}" --pattern "${mc_checksums}"
|
||||||
|
gh attestation verify "${assets_dir}/${mc_checksums}" \
|
||||||
|
--repo "${MC_REPO}" \
|
||||||
|
--signer-workflow "${MC_REPO}/.github/workflows/release.yml" \
|
||||||
|
--source-ref "refs/tags/${MC_VERSION}" >/dev/null
|
||||||
|
|
||||||
|
MC_AMD64_SHA256="$(awk -v name="mcli_${MC_PKG_VERSION}_linux_amd64.tar.gz" '$2 == name {print $1}' "${assets_dir}/${mc_checksums}")"
|
||||||
|
MC_ARM64_SHA256="$(awk -v name="mcli_${MC_PKG_VERSION}_linux_arm64.tar.gz" '$2 == name {print $1}' "${assets_dir}/${mc_checksums}")"
|
||||||
|
[[ "${MC_AMD64_SHA256}" =~ ^[0-9a-f]{64}$ ]]
|
||||||
|
[[ "${MC_ARM64_SHA256}" =~ ^[0-9a-f]{64}$ ]]
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "MC_AMD64_SHA256=${MC_AMD64_SHA256}"
|
||||||
|
echo "MC_ARM64_SHA256=${MC_ARM64_SHA256}"
|
||||||
|
} >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
echo "RELEASE_REVISION=$(git rev-parse HEAD)" >> "${GITHUB_ENV}"
|
echo "RELEASE_REVISION=$(git rev-parse HEAD)" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
@@ -162,6 +213,9 @@ jobs:
|
|||||||
file: docker-release/amd64/Dockerfile.goreleaser
|
file: docker-release/amd64/Dockerfile.goreleaser
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
|
build-args: |
|
||||||
|
MC_AMD64_SHA256=${{ env.MC_AMD64_SHA256 }}
|
||||||
|
MC_ARM64_SHA256=${{ env.MC_ARM64_SHA256 }}
|
||||||
tags: |
|
tags: |
|
||||||
pgsty/silo:${{ env.RELEASE_TAG }}-amd64
|
pgsty/silo:${{ env.RELEASE_TAG }}-amd64
|
||||||
pgsty/silo:latest-amd64
|
pgsty/silo:latest-amd64
|
||||||
@@ -178,6 +232,9 @@ jobs:
|
|||||||
file: docker-release/arm64/Dockerfile.goreleaser
|
file: docker-release/arm64/Dockerfile.goreleaser
|
||||||
platforms: linux/arm64
|
platforms: linux/arm64
|
||||||
push: true
|
push: true
|
||||||
|
build-args: |
|
||||||
|
MC_AMD64_SHA256=${{ env.MC_AMD64_SHA256 }}
|
||||||
|
MC_ARM64_SHA256=${{ env.MC_ARM64_SHA256 }}
|
||||||
tags: |
|
tags: |
|
||||||
pgsty/silo:${{ env.RELEASE_TAG }}-arm64
|
pgsty/silo:${{ env.RELEASE_TAG }}-arm64
|
||||||
pgsty/silo:latest-arm64
|
pgsty/silo:latest-arm64
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ jobs:
|
|||||||
- name: Run S3 Select tests under race detector
|
- name: Run S3 Select tests under race detector
|
||||||
run: go test -race ./internal/s3select/... -count=1
|
run: go test -race ./internal/s3select/... -count=1
|
||||||
|
|
||||||
|
- name: Run conditional PUT tests under race detector
|
||||||
|
run: go test -race ./cmd -run '^Test(PoolsConditionalPut|SinglePoolConditionalPutHTTP)' -count=1 -timeout=5m
|
||||||
|
|
||||||
|
- name: Run multipart listing and cancellation tests under race detector
|
||||||
|
run: go test -race ./cmd -run '^Test(MultipartListing|MultipartAbort|PaginateMultipartUploads|ListMultipartUploads)' -count=1 -timeout=5m
|
||||||
|
|
||||||
crosscompile:
|
crosscompile:
|
||||||
name: Cross Compile
|
name: Cross Compile
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
name: Repository Cards
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# 00:00 UTC = 08:00 Asia/Shanghai. GitHub may queue scheduled runs.
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- .github/workflows/repository-cards.yml
|
||||||
|
- .github/silo.svg
|
||||||
|
- buildscripts/repository-cards/**
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- .github/workflows/repository-cards.yml
|
||||||
|
- .github/silo.svg
|
||||||
|
- buildscripts/repository-cards/**
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: repository-cards-${{ github.event.pull_request.number || 'publish' }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: Validate repository cards
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
||||||
|
with:
|
||||||
|
python-version: "3.13"
|
||||||
|
- run: python -m pip install -r buildscripts/repository-cards/requirements.txt
|
||||||
|
- run: python -m unittest discover -s buildscripts/repository-cards -p 'test_*.py' -v
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Update README images
|
||||||
|
needs: check
|
||||||
|
if: github.repository == 'pgsty/silo' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
env:
|
||||||
|
OUTPUT_BRANCH: codex/repository-cards
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||||
|
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
||||||
|
with:
|
||||||
|
python-version: "3.13"
|
||||||
|
- run: python -m pip install -r buildscripts/repository-cards/requirements.txt
|
||||||
|
|
||||||
|
- name: Load the generated-assets branch
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
artifacts="$RUNNER_TEMP/repository-cards"
|
||||||
|
if git ls-remote --exit-code --heads origin "$OUTPUT_BRANCH"; then
|
||||||
|
git fetch --depth=1 origin "$OUTPUT_BRANCH"
|
||||||
|
git worktree add --detach "$artifacts" FETCH_HEAD
|
||||||
|
else
|
||||||
|
status=$?
|
||||||
|
# Exit 2 means no matching ref; transport/auth failures must stop.
|
||||||
|
if [ "$status" -ne 2 ]; then exit "$status"; fi
|
||||||
|
git worktree add --detach "$artifacts" HEAD
|
||||||
|
git -C "$artifacts" checkout --orphan "$OUTPUT_BRANCH"
|
||||||
|
git -C "$artifacts" rm -rf .
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Refresh contributor and star cards
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: python buildscripts/repository-cards/update.py --output "$RUNNER_TEMP/repository-cards"
|
||||||
|
|
||||||
|
- name: Publish changed assets
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$RUNNER_TEMP/repository-cards"
|
||||||
|
git add README.md history.json curated.json contributors.json \
|
||||||
|
contributors-light.svg contributors-dark.svg \
|
||||||
|
star-history-light.svg star-history-dark.svg
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "Repository cards are already current."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git config user.name 'github-actions[bot]'
|
||||||
|
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||||
|
git commit -s -m "chore: update repository cards $(date -u +%F)"
|
||||||
|
# A normal push preserves history and refuses concurrent overwrites.
|
||||||
|
git push origin "HEAD:refs/heads/$OUTPUT_BRANCH"
|
||||||
@@ -10,7 +10,7 @@ on:
|
|||||||
- "Dockerfile.distroless"
|
- "Dockerfile.distroless"
|
||||||
- "cmd/healthcheck-main.go"
|
- "cmd/healthcheck-main.go"
|
||||||
- "cmd/main.go"
|
- "cmd/main.go"
|
||||||
- "dockerscripts/download-static-curl.sh"
|
- "dockerscripts/build-static-curl.sh"
|
||||||
- "dockerscripts/docker-entrypoint.sh"
|
- "dockerscripts/docker-entrypoint.sh"
|
||||||
- "dockerscripts/docker-entrypoint_test.sh"
|
- "dockerscripts/docker-entrypoint_test.sh"
|
||||||
- "silo.service"
|
- "silo.service"
|
||||||
@@ -41,6 +41,28 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
curl:
|
||||||
|
name: Static curl (${{ matrix.arch }})
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: amd64
|
||||||
|
runner: ubuntu-latest
|
||||||
|
- arch: arm64
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- name: Build and exercise curl in an empty runtime
|
||||||
|
run: |
|
||||||
|
docker build --build-arg TARGETARCH=${{ matrix.arch }} \
|
||||||
|
--target curl-runtime -f Dockerfile.goreleaser -t silo-curl-test .
|
||||||
|
docker run --rm silo-curl-test --version | tee curl-version.txt
|
||||||
|
grep -F 'curl 8.22.0 ' curl-version.txt
|
||||||
|
grep -F 'HTTP2' curl-version.txt
|
||||||
|
docker run --rm silo-curl-test --fail --silent --show-error \
|
||||||
|
--connect-timeout 15 --max-time 60 https://curl.se/robots.txt
|
||||||
|
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -490,7 +512,7 @@ jobs:
|
|||||||
bash -n buildscripts/package/lifecycle_test.sh
|
bash -n buildscripts/package/lifecycle_test.sh
|
||||||
buildscripts/package/lifecycle_test.sh
|
buildscripts/package/lifecycle_test.sh
|
||||||
bash -n dockerscripts/docker-entrypoint_test.sh
|
bash -n dockerscripts/docker-entrypoint_test.sh
|
||||||
bash -n dockerscripts/download-static-curl.sh
|
bash -n dockerscripts/build-static-curl.sh
|
||||||
dockerscripts/docker-entrypoint_test.sh
|
dockerscripts/docker-entrypoint_test.sh
|
||||||
go run ./buildscripts/rebrand-guard
|
go run ./buildscripts/rebrand-guard
|
||||||
buildscripts/verify-rebrand.sh
|
buildscripts/verify-rebrand.sh
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install govulncheck
|
- name: Install govulncheck
|
||||||
run: |
|
run: |
|
||||||
go install golang.org/x/vuln/cmd/govulncheck@v1.7.0
|
go install golang.org/x/vuln/cmd/govulncheck@v1.8.0
|
||||||
echo "$(go env GOPATH)/bin" >> "${GITHUB_PATH}"
|
echo "$(go env GOPATH)/bin" >> "${GITHUB_PATH}"
|
||||||
|
|
||||||
- name: Run govulncheck
|
- name: Run govulncheck
|
||||||
|
|||||||
+2
-2
@@ -62,10 +62,10 @@ dist/
|
|||||||
|
|
||||||
.claude/
|
.claude/
|
||||||
.codex/
|
.codex/
|
||||||
AGENTS.md
|
|
||||||
CLAUDE.md
|
|
||||||
_bmad/
|
_bmad/
|
||||||
_bmad-output/
|
_bmad-output/
|
||||||
|
# Investigation and editorial working files belong outside this repository.
|
||||||
|
docs/investigations/
|
||||||
docs/security/
|
docs/security/
|
||||||
docs/rebranding.md
|
docs/rebranding.md
|
||||||
.release-sign/
|
.release-sign/
|
||||||
|
|||||||
+1
-4
@@ -5,7 +5,7 @@ linters:
|
|||||||
- durationcheck
|
- durationcheck
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- gocritic
|
- gocritic
|
||||||
- gomodguard
|
- gomodguard_v2
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- misspell
|
- misspell
|
||||||
@@ -59,9 +59,6 @@ formatters:
|
|||||||
exclusions:
|
exclusions:
|
||||||
generated: lax
|
generated: lax
|
||||||
paths:
|
paths:
|
||||||
# gofumpt v0.11.0 and Go 1.27's gofmt disagree on the indentation of
|
|
||||||
# multiple composite literals returned from a single statement.
|
|
||||||
- internal/ioutil/wait_pipe\.go$
|
|
||||||
- third_party$
|
- third_party$
|
||||||
- builtin$
|
- builtin$
|
||||||
- examples$
|
- examples$
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
# SILO Repository Guide
|
||||||
|
|
||||||
|
## Project map
|
||||||
|
|
||||||
|
- Server: `pgsty/silo` (this checkout, default branch `main`)
|
||||||
|
- Console: `pgsty/silo-console` (usual sibling checkout `../silo-console`)
|
||||||
|
- Client: `pgsty/mc`, shipped as `mcli` (usual sibling checkout `../mc`)
|
||||||
|
- Shared packages: `pgsty/silo-pkg` (usual sibling checkout `../silo-pkg`)
|
||||||
|
- Documentation: `pgsty/silo.pgsty.com` (usual sibling checkout `../silo.pgsty.com`),
|
||||||
|
published at <https://silo.pgsty.com/>
|
||||||
|
|
||||||
|
The server executable, package, systemd service, and container image use `silo`;
|
||||||
|
the public Docker image is `docker.io/pgsty/silo`. The server module remains
|
||||||
|
`github.com/minio/minio`. Consult the current `go.mod` and release configuration
|
||||||
|
for selected component versions and compatibility replacements.
|
||||||
|
|
||||||
|
## Supported stack and compatibility policy
|
||||||
|
|
||||||
|
The maintained, release-gating product graph is the coordinated PGSTY stack:
|
||||||
|
`silo` + `silo-console` + `mc` + `silo-pkg`.
|
||||||
|
|
||||||
|
Keep compatibility with upstream MinIO/MC on a best-effort basis. Preserve
|
||||||
|
inexpensive wire, configuration, CLI, migration, and import compatibility when
|
||||||
|
it helps users, and document known differences. Do not infer from source
|
||||||
|
lineage, MinIO-compatible protocols, retained `MINIO_*`/`MC_*` names, or an
|
||||||
|
inherited upstream test that unmodified upstream MinIO is a supported release
|
||||||
|
target.
|
||||||
|
|
||||||
|
Upstream-only compatibility checks may remain as advisory evidence, but they
|
||||||
|
must not force a downgrade of a maintained SILO component, a fork-only API
|
||||||
|
workaround, or a release block. Make upstream compatibility a hard gate only
|
||||||
|
when the user explicitly requests that scope.
|
||||||
|
|
||||||
|
## Dependency selection
|
||||||
|
|
||||||
|
- When PGSTY maintains a component, import and require it directly under its own
|
||||||
|
module path. In particular, prefer `github.com/pgsty/silo-pkg/v3` over
|
||||||
|
`github.com/minio/pkg/v3` in maintained SILO source.
|
||||||
|
- Do not use an upstream package merely to make unmodified upstream MinIO or MC
|
||||||
|
compile. Unavoidable transitive upstream modules should be documented and
|
||||||
|
kept separate from the maintained product dependency.
|
||||||
|
- `github.com/minio/minio-go/v7` is the explicit exception: use the verified
|
||||||
|
upstream module/commit while it contains the required fixes; do not recreate
|
||||||
|
a SILO fork without a concrete functional divergence.
|
||||||
|
- Check the current `go.mod` before changing versions. Coordinate breaking
|
||||||
|
import-path changes across package, client, Console, and server releases.
|
||||||
|
|
||||||
|
## Documentation and delivery
|
||||||
|
|
||||||
|
The companion site owns product, operations, migration, security-advisory,
|
||||||
|
design, and release documentation. Maintain English and Chinese content in
|
||||||
|
that repository and link to its canonical URLs from this one. The site's
|
||||||
|
`content/docs/` is the documentation entry point; detailed pages live under
|
||||||
|
`content/operations/`, `administration/`, `reference/`, `compatibility/`,
|
||||||
|
`about/`, and `blog/`, following the existing structure.
|
||||||
|
|
||||||
|
Keep repository entry points and contributor instructions here. Retained
|
||||||
|
upstream documents, examples, and test fixtures under `docs/` may be updated
|
||||||
|
when a code or tooling change requires it; do not build a second documentation
|
||||||
|
site in this tree.
|
||||||
|
|
||||||
|
Investigation plans, prompts, AI session transcripts, execution logs, temporary
|
||||||
|
reports, and private security material belong outside the checkout, for example
|
||||||
|
in a task-specific directory under `~/tmp/`. Do not recreate
|
||||||
|
`docs/investigations/`, `docs/security/`, or `docs/rebranding.md`, or move their
|
||||||
|
working material to another repository directory. Extract reusable, verified
|
||||||
|
knowledge into the companion site; keep private evidence outside public Git.
|
||||||
|
|
||||||
|
Compatibility pages may continue to describe similarities with upstream, but
|
||||||
|
must label that compatibility as best effort. The supported and tested server
|
||||||
|
for Console and mcli administration is `pgsty/silo`.
|
||||||
|
|
||||||
|
Before removing or moving documentation, check repository links and scripts,
|
||||||
|
the companion site's links and anchors, and references from this guide. Use
|
||||||
|
fixed commit URLs for historical evidence that should survive deletion from
|
||||||
|
the current tree. Run the site's `make check` for site changes and this
|
||||||
|
repository's `make rebrand-guard` for documentation cleanup that changes the
|
||||||
|
identifier inventory. When new public URLs are involved, publish the site
|
||||||
|
before publishing source changes that depend on those URLs.
|
||||||
|
|
||||||
|
Keep changes in the repository that owns the affected surface. Treat every
|
||||||
|
repository commit, tag, release, image, documentation update, and deployment as
|
||||||
|
a separate deliverable. Follow `CONTRIBUTING.md`, including DCO sign-off
|
||||||
|
(`git commit -s`). `CLAUDE.md` imports this guide so both agents use one policy.
|
||||||
+190
@@ -0,0 +1,190 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
The entries below describe source changes on main since the latest published Server.
|
||||||
|
**The latest published Server remains 20260903.** These changes are not in its
|
||||||
|
binaries, packages or images. See the [component matrix](https://silo.pgsty.com/compatibility/versions/)
|
||||||
|
and [complete commit range](https://github.com/pgsty/silo/compare/RELEASE.2026-09-03T13-18-01Z...main).
|
||||||
|
|
||||||
|
### Authorization and security
|
||||||
|
|
||||||
|
- Restrict embedded Console's anonymous sharing proxy to object-content GETs
|
||||||
|
at the configured S3 origin, and reject every redirect. Internal metrics,
|
||||||
|
system paths and non-download S3 operations cannot be reached through it.
|
||||||
|
Normal public, presigned and versioned downloads remain available without a
|
||||||
|
new setting; a full sharing-disable switch is not introduced. See
|
||||||
|
[Console #56](https://github.com/pgsty/silo-console/pull/56) and the
|
||||||
|
[design record](https://github.com/pgsty/silo-console/issues/52).
|
||||||
|
Thanks to Jiri Pejchal (@jiri-pejchal) for the report.
|
||||||
|
- Persist IAM deletion revisions and parent revocation boundaries so stale site
|
||||||
|
events cannot restore deleted identities, policies or their older grants
|
||||||
|
(#191, #192). Peer deletion notifications reload committed storage; deliberate
|
||||||
|
recreation requires a newer revision, and credentials issued before the
|
||||||
|
parent's revocation remain invalid.
|
||||||
|
**Coordinated upgrade required:** upgrade every participating node and site.
|
||||||
|
Mixed old/new nodes sharing an IAM backend and rolling downgrade are
|
||||||
|
unsupported. Back up complete IAM storage and encryption material; an admin
|
||||||
|
export of live records omits deletion history. Reissue credentials for
|
||||||
|
recreated parents and explicitly reconcile pre-upgrade revocations whose
|
||||||
|
history is already lost. Restoring an older backup can lose later revocations;
|
||||||
|
keep affected sites isolated until reconciliation/rekeying is complete. See
|
||||||
|
[the operator runbook](https://silo.pgsty.com/operations/replication/iam-upgrade/).
|
||||||
|
- Enforce an absolute HTTP/1 request-header deadline through the connection
|
||||||
|
wrapper (#196). Repeated small reads no longer extend that deadline, and
|
||||||
|
`--read-header-timeout` / `MINIO_READ_HEADER_TIMEOUT` now reaches the HTTP
|
||||||
|
server. HTTP/1 request bodies retain the rolling idle timeout; this does not
|
||||||
|
impose a total upload/download duration. A shorter setting also constrains
|
||||||
|
TLS handshake reads. The wrapper's strict header mode is not applied to HTTP/2.
|
||||||
|
- Reject unsigned `x-amz-*` request headers that could turn a signed PUT into a
|
||||||
|
copy of another object accessible to the signer (SN-2026-011). The latest
|
||||||
|
public Server is affected; the fix is on main. See [the advisory ledger](https://silo.pgsty.com/about/security-advisories/).
|
||||||
|
- Align signed request fields with policy conditions and enforce header-only
|
||||||
|
presigned payload checksums. See [the signed-header review](https://silo.pgsty.com/blog/design/signed-header-coverage/).
|
||||||
|
- **Breaking policy semantics:** separate self-service `admin:ChangeMyPassword`
|
||||||
|
from `admin:CreateUser`. Built-in read-only policies follow the split. Preserve
|
||||||
|
both denies if the previous combined restriction must survive upgrades or
|
||||||
|
rollback. Saved policies are not rewritten. Deploy with the matching Console
|
||||||
|
and pkg; see [the migration guide](docs/iam/password-permissions.md).
|
||||||
|
|
||||||
|
### Object storage and replication
|
||||||
|
|
||||||
|
- Make `ListMultipartUploads` discover quorum-valid uploads from durable state
|
||||||
|
across pools, erasure sets and drives, then apply S3 prefix, delimiter,
|
||||||
|
marker, ordering and 1,000-entry pagination semantics globally (#198). New uploads
|
||||||
|
store their canonical bucket and key as reserved fields in the existing
|
||||||
|
quorum-written `xl.meta`; completion removes those upload-only fields. Native
|
||||||
|
markers remain usable after their upload is completed or canceled. Strict
|
||||||
|
listing returns a diagnostic 503 for legacy uploads or uncertain coverage;
|
||||||
|
`api multipart_listing=legacy` is an explicit temporary migration mode.
|
||||||
|
Upgrade every writer, drain old uploads and check the read-only admin
|
||||||
|
`multipart-preflight` report before relying on strict listing. Per-process
|
||||||
|
admission, directory-entry, worker and time budgets bound scan scheduling;
|
||||||
|
each page still scans durable state. See [issue #79](https://github.com/pgsty/silo/issues/79)
|
||||||
|
and its [design record](https://silo.pgsty.com/blog/design/list-multipart-uploads/).
|
||||||
|
Thanks to mr javad seydi (@mrjavadseydi) for the original implementation.
|
||||||
|
- Confirm multipart cancellation on a strict majority of each relevant set,
|
||||||
|
and allow retries after partial deletion. Uncertain pools or insufficient
|
||||||
|
confirmations return 503 rather than acknowledging a cancellation whose
|
||||||
|
static remnants can later become readable. **Known boundary:** creation
|
||||||
|
writes that finish after a storage timeout can still restore an upload after
|
||||||
|
successful cancellation; this change does not add a durable creation fence.
|
||||||
|
- Preserve object tags during multi-pool metadata reconciliation by reading the
|
||||||
|
resolved tag field together with its revision (#189). Previously, reconciliation
|
||||||
|
could replace existing tags with an empty value.
|
||||||
|
- Preserve the tag revision on SSE-KMS metadata replication (#193), and advance
|
||||||
|
tag revisions monotonically on local PUT/DELETE tagging (#196). Empty tags
|
||||||
|
participate in reconciliation as an ordered deletion, preventing older
|
||||||
|
events from restoring removed tags. SSE-C key rotation also retains the tag
|
||||||
|
revision. Malformed historical revisions can fail and retry; their missing
|
||||||
|
history is not reconstructed by the upgrade.
|
||||||
|
- Complete delete-marker version purges and preserve their identity and retry
|
||||||
|
state through MRF recovery (#196). Recovery accepts a 405 marker response only
|
||||||
|
when its version, bucket, object name and modification time match the task.
|
||||||
|
Purge audit status is normalized from `COMPLETE` to `COMPLETED`.
|
||||||
|
Thanks to Julien Laurenceau (@julienlau) for the investigation and proposed
|
||||||
|
fix in #184 that helped shape this follow-up.
|
||||||
|
- Restore only the six replication-specific metadata fields after ordinary
|
||||||
|
request metadata extraction (#194). This prevents transport-only `aws-chunked`
|
||||||
|
from being stored as Content-Encoding while preserving the signed-header
|
||||||
|
protections. Trusted Snowball entries no longer inherit the outer archive's
|
||||||
|
ordinary metadata. Thanks to Mikhail Khadarenka (@chodorenko) for the fix in #187.
|
||||||
|
**Existing data:** these repairs prevent new errors; they do not scan or rewrite
|
||||||
|
historical object metadata, recover lost tags or prove that old purge work has
|
||||||
|
converged. Follow the [read-only audit procedure](https://silo.pgsty.com/operations/replication/replica-metadata-audit/)
|
||||||
|
before planning any repair of stored state.
|
||||||
|
|
||||||
|
- Evaluate conditional multipart completion against the logical current object
|
||||||
|
across all pools while holding the existing object lock. A stale `If-Match`
|
||||||
|
can no longer replace newer data in another pool, and the current ETag is no
|
||||||
|
longer rejected because the upload resides next to an older copy. Conditions
|
||||||
|
are evaluated once; a current delete marker counts as an absent object.
|
||||||
|
**Availability change:** if any pool's metadata cannot be read, conditional
|
||||||
|
completion fails even when another pool can still serve GET/HEAD. This also
|
||||||
|
applies when the unreadable pool may not hold the object: absence cannot be
|
||||||
|
verified. Retry after the pool recovers. Unconditional completion and the
|
||||||
|
single-pool path retain their existing behavior.
|
||||||
|
|
||||||
|
- Evaluate ordinary multi-pool conditional PUT against the logical current
|
||||||
|
object across all pools, including draining pools, under the existing object
|
||||||
|
lock (#207). A stale destination copy no longer accepts a stale ETag or rejects
|
||||||
|
the current one; a current delete marker is treated as absence.
|
||||||
|
**Availability change:** if any pool's object metadata cannot be verified,
|
||||||
|
the condition fails even when GET can use another pool; read-quorum failures
|
||||||
|
return 503. Restore readability or heal before retrying. Unconditional PUT,
|
||||||
|
single-pool conditions and internal replication retain their existing behavior.
|
||||||
|
A public condition with a destination `versionId` compares the current object
|
||||||
|
while preserving the requested write version. This change does not retire
|
||||||
|
stale copies in other pools, undo historical accepted overwrites or provide
|
||||||
|
a new global clock-ordering guarantee. The multipart-completion repair in #190
|
||||||
|
neither introduced nor repaired this separate PUT defect.
|
||||||
|
|
||||||
|
- Reconcile ordinary single-object version DELETE across all pools, including
|
||||||
|
null versions, delete markers and unqualified directory-marker DELETE. This
|
||||||
|
applies the deletion to every resolved pool copy under existing quorum
|
||||||
|
rules. Pending outbound delete replication retains versions until the
|
||||||
|
existing replication worker completes their purge; a successful response
|
||||||
|
does not imply immediate physical removal from every drive. Unreadable
|
||||||
|
pools now consistently return 503 instead of depending on pool traversal
|
||||||
|
order; insufficient read quorum returns `SlowDownRead`. This extends the
|
||||||
|
existing failure surface. Retry after recovery.
|
||||||
|
Cleanup failures also return an error. Batch deletion already fans out across
|
||||||
|
pools; replication and scanner cleanup keep their existing contracts. See
|
||||||
|
[scope and limitations](docs/bucket/lifecycle/access-tiering-removal.md#version-deletion-scope).
|
||||||
|
|
||||||
|
- Remove the opt-in GET-frequency pool-tiering feature from PR #60, including
|
||||||
|
its tracker, mover, scanner hooks, configuration, XML actions and metrics.
|
||||||
|
Accept and ignore retired configuration/XML and preserve ordinary statistics
|
||||||
|
when reading v9 caches. See [migration notes](docs/bucket/lifecycle/access-tiering-removal.md).
|
||||||
|
The [decision record](https://silo.pgsty.com/compatibility/access-tiering-removal/) preserves
|
||||||
|
the feature's introduction, subsequent fixes, rollback scope and review history.
|
||||||
|
- Preserve the independent multi-pool write, metadata, healing and conditional
|
||||||
|
deletion fixes from PR #178, including shared remote-tier reference protection.
|
||||||
|
- Enforce `If-Match` on DELETE, preserve retention and independently ordered
|
||||||
|
Object Lock/tag updates, and correctly retransmit encrypted replicas.
|
||||||
|
- Preserve plaintext part sizes and raw SSE-C replicas; prevent SSE-C
|
||||||
|
compression, honor key-rotation checksums, and complete attributes pagination.
|
||||||
|
- Repair federated CopyObject checksums, destination timestamps, reserved
|
||||||
|
metadata, encrypted-object forwarding, legal hold and KMS context.
|
||||||
|
- Make resync counters, target selection, cancellation and worker lifetimes
|
||||||
|
reflect actual work, and report bounded MRF drops.
|
||||||
|
- Converge bucket metadata with deterministic source state, deletion tombstones,
|
||||||
|
creation time recovery and diagnostics. The mixed-version export gate requires
|
||||||
|
coordinated upgrades before tombstones are exported. See [the #77 record](https://silo.pgsty.com/blog/design/bucket-metadata-convergence/).
|
||||||
|
- Include per-bucket CORS in metadata export/import, close metadata publication
|
||||||
|
and logger races, and report effective bucket quotas in metrics.
|
||||||
|
|
||||||
|
### Console, dependencies and delivery
|
||||||
|
|
||||||
|
- Restore embedded Console login over loopback TLS, trusted-proxy handling and
|
||||||
|
all four WebSocket connection limits. Preserve Go TLS defaults across transports.
|
||||||
|
- Directly require `github.com/pgsty/silo-pkg/v3` v3.14.0; select Console
|
||||||
|
`v0.0.0-20260916034812-56dfe455ac2f` and MC
|
||||||
|
`v0.0.0-20260913012246-4f609a4da3bb` with explicit PGSTY replacements.
|
||||||
|
- Pin upstream minio-go `v7.3.1-0.20260910142817-60bd07042d49`; refresh Go x/*
|
||||||
|
modules and security fixes including bounded AMQP frame handling. Keep Go
|
||||||
|
1.27.1 and go-systemd v22.6.0's NetBSD compatibility replacement.
|
||||||
|
- Refresh container base digests and build static curl 8.22.0 from verified
|
||||||
|
source for both Linux architectures. Pin the actual mcli 20260913 archives and
|
||||||
|
hashes. Helm's client image follows that release; its Server image still names
|
||||||
|
the latest published Server 20260903.
|
||||||
|
|
||||||
|
The dependency update passed the final candidate's Go, vulnerability and Test
|
||||||
|
Release workflows; native curl builds passed on both architectures. A local
|
||||||
|
ARM64 image passed startup, health, S3 transfer and embedded Console checks.
|
||||||
|
These checks do not publish a Server tag or production image and do not replace
|
||||||
|
cluster upgrade/rollback acceptance for the next release. Dated investigations
|
||||||
|
retain the exact source and runtime boundaries they tested.
|
||||||
|
|
||||||
|
## RELEASE.2026-09-03T13-18-01Z
|
||||||
|
|
||||||
|
Published source: `9b11dc9469e650815b775cb47b039610644f5da4`.
|
||||||
|
[Complete release notes](https://silo.pgsty.com/blog/release/silo-20260903/) ·
|
||||||
|
[GitHub release](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-09-03T13-18-01Z)
|
||||||
|
|
||||||
|
This release ships Go 1.27.1, silo-pkg v3.13.2, upstream minio-go `0e78d3f18efe`,
|
||||||
|
mcli 20260903 and embedded Console source `464a59d73ada` (v2.3.0 version identity).
|
||||||
|
Installing the newer standalone mcli or Console does not replace components
|
||||||
|
inside this existing Server binary or image.
|
||||||
|
|
||||||
|
Earlier releases: [release archive](https://github.com/pgsty/silo/releases).
|
||||||
+28
-8
@@ -44,6 +44,10 @@ Before opening a pull request:
|
|||||||
|
|
||||||
- Add or update tests for changed behavior.
|
- Add or update tests for changed behavior.
|
||||||
- Run `make verifiers`.
|
- Run `make verifiers`.
|
||||||
|
- If `make rebrand-guard` reports a changed compatibility set, review the
|
||||||
|
listed identifiers; when the change is intended, refresh the baseline with
|
||||||
|
`go run ./buildscripts/rebrand-guard --write` and commit
|
||||||
|
`buildscripts/rebrand-guard/compat-baseline.json`.
|
||||||
- Run the smallest relevant package tests, then `make test` when practical.
|
- Run the smallest relevant package tests, then `make test` when practical.
|
||||||
- Run `make build` and confirm the generated executable is `silo`.
|
- Run `make build` and confirm the generated executable is `silo`.
|
||||||
- Explain any preserved `MINIO_*`, `minio_*`, `x-minio-*`, `/minio/*`,
|
- Explain any preserved `MINIO_*`, `minio_*`, `x-minio-*`, `/minio/*`,
|
||||||
@@ -73,11 +77,22 @@ test evidence, compatibility notes, and documentation impact. Public product
|
|||||||
documentation is owned by the separate
|
documentation is owned by the separate
|
||||||
[`pgsty/silo.pgsty.com`](https://github.com/pgsty/silo.pgsty.com) repository.
|
[`pgsty/silo.pgsty.com`](https://github.com/pgsty/silo.pgsty.com) repository.
|
||||||
|
|
||||||
|
## Contributor recognition
|
||||||
|
|
||||||
|
Every human issue or pull-request author is recognized in [CONTRIBUTORS.md](CONTRIBUTORS.md),
|
||||||
|
including open issues, draft PRs, and PRs closed without merging. Merged fixes,
|
||||||
|
adopted proposals, and reports that lead to fixes receive greater prominence;
|
||||||
|
first participation guides the remaining order. Work incorporated through a
|
||||||
|
later PR retains credit without changing the original PR's recorded status.
|
||||||
|
Security disclosures are credited with the reporter's agreement. DCO sign-off
|
||||||
|
applies to code commits, not to opening an issue.
|
||||||
|
|
||||||
## Licensing of Contributions
|
## Licensing of Contributions
|
||||||
|
|
||||||
Silo is licensed under the [GNU AGPL v3.0 or later](LICENSE). Its core is
|
Code contributions to PGSTY SILO (`pgsty/silo`) are accepted under the
|
||||||
Copyright (c) MinIO, Inc.; the combined work can never be relicensed, and this
|
[GNU AGPL v3.0 or later](LICENSE), the same license as the server. Submit issues
|
||||||
fork does not try to.
|
and pull requests to this repository's maintainers. No separate Apache-2.0
|
||||||
|
license grant to SILO or upstream MinIO maintainers is required.
|
||||||
|
|
||||||
* **No CLA.** We do not ask you to sign a Contributor License Agreement and we
|
* **No CLA.** We do not ask you to sign a Contributor License Agreement and we
|
||||||
do not take your copyright. Contributions are accepted inbound=outbound: you
|
do not take your copyright. Contributions are accepted inbound=outbound: you
|
||||||
@@ -108,15 +123,20 @@ fork does not try to.
|
|||||||
`Signed-off-by` trailers) and add your own sign-off as the person passing it
|
`Signed-off-by` trailers) and add your own sign-off as the person passing it
|
||||||
along. Never import code from a proprietary distribution.
|
along. Never import code from a proprietary distribution.
|
||||||
|
|
||||||
* **File headers.** Files derived from upstream keep the original MinIO
|
* **File headers.** Preserve existing copyright and license notices in inherited
|
||||||
copyright header unchanged. New files added by this fork use the dual
|
and third-party files. New original files name their actual copyright holders
|
||||||
header, followed by the standard AGPL boilerplate:
|
and use AGPL-3.0-or-later. Use a header such as the following, then append the
|
||||||
|
standard AGPL boilerplate:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Copyright (c) 2015-2025 MinIO, Inc.
|
// Copyright (c) 2026 Your Name
|
||||||
// Copyright (c) 2025-2026 PGSTY
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **Separately licensed material.** Documentation contributions in `docs/`
|
||||||
|
follow its existing [CC BY 4.0 license](docs/LICENSE). Third-party components
|
||||||
|
and earlier Apache-2.0 contributions retain their original licenses and
|
||||||
|
attribution; this policy does not relicense earlier work.
|
||||||
|
|
||||||
* **Squash merges** must keep the `Signed-off-by:` trailers in the resulting
|
* **Squash merges** must keep the `Signed-off-by:` trailers in the resulting
|
||||||
commit message.
|
commit message.
|
||||||
|
|
||||||
|
|||||||
+165
-62
@@ -1,77 +1,180 @@
|
|||||||
# Contributors
|
# Contributors
|
||||||
|
|
||||||
Silo is maintained by the Pigsty community. This file records the people who have contributed to
|
<!-- Generated by silo.pgsty.com/bin/contributors.py. -->
|
||||||
this fork since it was established in 2026 — merged code, proposed changes, and the bug reports and
|
|
||||||
compatibility findings that shaped the releases.
|
|
||||||
|
|
||||||
It is maintained by hand and updated at each release. GitHub's own contributor graph is unavailable
|
As of **2026-09-16**, **50 community contributors** are credited in SILO and related projects. The roll includes maintainers and every human issue / PR author, plus the previously acknowledged security disclosure.
|
||||||
here because `pgsty/silo` is a fork, so this file — not that page — is the project's attribution
|
|
||||||
record. Contributors are listed by GitHub handle. Authorship of every merged commit is preserved in
|
|
||||||
the Git history and can be verified with `git log --format='%an <%ae>'`.
|
|
||||||
|
|
||||||
Upstream MinIO authorship is recorded separately: this fork derives from
|
Opening an issue or PR counts, whether open, closed, draft, or unmerged. Each account appears once. Merged PR authors come first, followed by other PR authors and reporters. Within each group, significant fixes, adopted proposals, and reports that led to fixes take priority, followed by first participation. Gold rings highlight significant contributions.
|
||||||
[`minio/minio`](https://github.com/minio/minio), [`NOTICE`](NOTICE) retains the upstream product
|
|
||||||
notice, and the Git history carries the full upstream commit record.
|
|
||||||
|
|
||||||
## Code
|
When a proposal was incorporated through a later repair, its adoption is credited separately from the original PR status. A closed issue does not necessarily mean a fix, and merged source does not imply a published release. Automated accounts are excluded. Upstream authorship remains in Git history and copyright notices.
|
||||||
|
|
||||||
Contributors whose changes are merged into `main`.
|
<p align="center">
|
||||||
|
<a href="https://github.com/Vonng"><img src="https://silo.pgsty.com/images/contributors/Vonng.svg" width="60" height="60" alt="@Vonng" title="@Vonng — Maintains SILO, Console, mcli, shared packages, releases, and documentation"></a>
|
||||||
|
<a href="https://github.com/ZouhairCharef"><img src="https://silo.pgsty.com/images/contributors/ZouhairCharef.svg" width="60" height="60" alt="@ZouhairCharef" title="@ZouhairCharef — Patched CVE-2026-34986 in go-jose"></a>
|
||||||
|
<a href="https://github.com/mfredenhagen"><img src="https://silo.pgsty.com/images/contributors/mfredenhagen.svg" width="60" height="60" alt="@mfredenhagen" title="@mfredenhagen — Patched CVE-2026-39883 in OpenTelemetry"></a>
|
||||||
|
<a href="https://github.com/pinginfo"><img src="https://silo.pgsty.com/images/contributors/pinginfo.svg" width="60" height="60" alt="@pinginfo" title="@pinginfo — Repaired bucket notification streaming"></a>
|
||||||
|
<a href="https://github.com/ycjlin"><img src="https://silo.pgsty.com/images/contributors/ycjlin.svg" width="60" height="60" alt="@ycjlin" title="@ycjlin — Fixed missing-bucket ListObjects semantics"></a>
|
||||||
|
<a href="https://github.com/waterkip"><img src="https://silo.pgsty.com/images/contributors/waterkip.svg" width="60" height="60" alt="@waterkip" title="@waterkip — Repointed documentation links to the SILO portal"></a>
|
||||||
|
<a href="https://github.com/Dansyuqri"><img src="https://silo.pgsty.com/images/contributors/Dansyuqri.svg" width="60" height="60" alt="@Dansyuqri" title="@Dansyuqri — Added ChecksumType to multipart completion responses"></a>
|
||||||
|
<a href="https://github.com/mrjavadseydi"><img src="https://silo.pgsty.com/images/contributors/mrjavadseydi.svg" width="60" height="60" alt="@mrjavadseydi" title="@mrjavadseydi — Fixed bucket quota metrics; contributed access-frequency ILM and S3-compatible multipart listing proposals"></a>
|
||||||
|
<a href="https://github.com/h5vx"><img src="https://silo.pgsty.com/images/contributors/h5vx.svg" width="60" height="60" alt="@h5vx" title="@h5vx — Implemented per-bucket CORS configuration and enforcement"></a>
|
||||||
|
<a href="https://github.com/nikitapogromsky"><img src="https://silo.pgsty.com/images/contributors/nikitapogromsky.svg" width="60" height="60" alt="@nikitapogromsky" title="@nikitapogromsky — Fixed duplicate logger targets that broke Metrics V3 collection"></a>
|
||||||
|
<a href="https://github.com/Aeirx"><img src="https://silo.pgsty.com/images/contributors/Aeirx.svg" width="60" height="60" alt="@Aeirx" title="@Aeirx — Preserved Object Lock legal-hold headers in federated CopyObject"></a>
|
||||||
|
<a href="https://github.com/magicxor"><img src="https://silo.pgsty.com/images/contributors/magicxor.svg" width="60" height="60" alt="@magicxor" title="@magicxor — Reported and proposed conditional DELETE support for If-Match"></a>
|
||||||
|
<a href="https://github.com/davinkevin"><img src="https://silo.pgsty.com/images/contributors/davinkevin.svg" width="60" height="60" alt="@davinkevin" title="@davinkevin — Proposed the distroless container image and dependency automation"></a>
|
||||||
|
<a href="https://github.com/metaneutrons"><img src="https://silo.pgsty.com/images/contributors/metaneutrons.svg" width="60" height="60" alt="@metaneutrons" title="@metaneutrons — Reported and proposed explicit-version delete authorization"></a>
|
||||||
|
<a href="https://github.com/mikemikimike"><img src="https://silo.pgsty.com/images/contributors/mikemikimike.svg" width="60" height="60" alt="@mikemikimike" title="@mikemikimike — Contributed the replicated SSE-C plaintext part-size fix"></a>
|
||||||
|
<a href="https://github.com/julienlau"><img src="https://silo.pgsty.com/images/contributors/julienlau.svg" width="60" height="60" alt="@julienlau" title="@julienlau — Reported MRF queue and delete-marker retry defects; contributed repair proposals, tests, and documentation"></a>
|
||||||
|
<a href="https://github.com/chodorenko"><img src="https://silo.pgsty.com/images/contributors/chodorenko.svg" width="60" height="60" alt="@chodorenko" title="@chodorenko — Reported and contributed the fix for aws-chunked leaking into replica metadata"></a>
|
||||||
|
<a href="https://github.com/sulin37392"><img src="https://silo.pgsty.com/images/contributors/sulin37392.svg" width="48" height="48" alt="@sulin37392" title="@sulin37392 — Proposed dependency updates"></a>
|
||||||
|
<a href="https://github.com/lem21h"><img src="https://silo.pgsty.com/images/contributors/lem21h.svg" width="48" height="48" alt="@lem21h" title="@lem21h — Proposed robustness and goroutine improvements"></a>
|
||||||
|
<a href="https://github.com/vampywiz17"><img src="https://silo.pgsty.com/images/contributors/vampywiz17.svg" width="60" height="60" alt="@vampywiz17" title="@vampywiz17 — Reported LDAP TLS and Console login regressions"></a>
|
||||||
|
<a href="https://github.com/cbornet"><img src="https://silo.pgsty.com/images/contributors/cbornet.svg" width="60" height="60" alt="@cbornet" title="@cbornet — Reported multipart and streaming checksum defects and missing-bucket semantics"></a>
|
||||||
|
<a href="https://github.com/orenyomtov"><img src="https://silo.pgsty.com/images/contributors/orenyomtov.svg" width="60" height="60" alt="@orenyomtov" title="@orenyomtov — Reported the unsigned-header CopyObject cross-object read (SN-2026-011)"></a>
|
||||||
|
<a href="https://github.com/jiri-pejchal"><img src="https://silo.pgsty.com/images/contributors/jiri-pejchal.svg" width="60" height="60" alt="@jiri-pejchal" title="@jiri-pejchal — Reported the RabbitMQ client vulnerability and the Console share proxy's exposure of internal metrics"></a>
|
||||||
|
<a href="https://github.com/AEGEGE"><img src="https://silo.pgsty.com/images/contributors/AEGEGE.svg" width="60" height="60" alt="@AEGEGE" title="@AEGEGE — Reported the slow-HTTP denial-of-service vulnerability"></a>
|
||||||
|
<a href="https://github.com/mosesdd"><img src="https://silo.pgsty.com/images/contributors/mosesdd.svg" width="48" height="48" alt="@mosesdd" title="@mosesdd — Requested a maintained Helm chart"></a>
|
||||||
|
<a href="https://github.com/Xavier-777"><img src="https://silo.pgsty.com/images/contributors/Xavier-777.svg" width="48" height="48" alt="@Xavier-777" title="@Xavier-777 — Reported Console lifecycle management and file preview gaps"></a>
|
||||||
|
<a href="https://github.com/jiadzh"><img src="https://silo.pgsty.com/images/contributors/jiadzh.svg" width="48" height="48" alt="@jiadzh" title="@jiadzh — Requested Windows build guidance"></a>
|
||||||
|
<a href="https://github.com/AntonOfTheWoods"><img src="https://silo.pgsty.com/images/contributors/AntonOfTheWoods.svg" width="48" height="48" alt="@AntonOfTheWoods" title="@AntonOfTheWoods — Asked for clarity on Helm chart and operator options"></a>
|
||||||
|
<a href="https://github.com/TLINDEN"><img src="https://silo.pgsty.com/images/contributors/TLINDEN.svg" width="48" height="48" alt="@TLINDEN" title="@TLINDEN — Reported the missing client in release tarballs"></a>
|
||||||
|
<a href="https://github.com/zylpsrs"><img src="https://silo.pgsty.com/images/contributors/zylpsrs.svg" width="48" height="48" alt="@zylpsrs" title="@zylpsrs — Reported missing Console tiering and site replication"></a>
|
||||||
|
<a href="https://github.com/nsanitate"><img src="https://silo.pgsty.com/images/contributors/nsanitate.svg" width="48" height="48" alt="@nsanitate" title="@nsanitate — Proposed CNCF Sandbox governance"></a>
|
||||||
|
<a href="https://github.com/makinikm"><img src="https://silo.pgsty.com/images/contributors/makinikm.svg" width="48" height="48" alt="@makinikm" title="@makinikm — Reported the missing client in the container image"></a>
|
||||||
|
<a href="https://github.com/spaceg00se-r"><img src="https://silo.pgsty.com/images/contributors/spaceg00se-r.svg" width="48" height="48" alt="@spaceg00se-r" title="@spaceg00se-r — Requested cpuv1 support and reported a workflow token failure"></a>
|
||||||
|
<a href="https://github.com/heroes1412"><img src="https://silo.pgsty.com/images/contributors/heroes1412.svg" width="48" height="48" alt="@heroes1412" title="@heroes1412 — Reported the unusable profiling option"></a>
|
||||||
|
<a href="https://github.com/chalukyaj"><img src="https://silo.pgsty.com/images/contributors/chalukyaj.svg" width="48" height="48" alt="@chalukyaj" title="@chalukyaj — Proposed making the SILO Operator easier to discover"></a>
|
||||||
|
<a href="https://github.com/jvasile"><img src="https://silo.pgsty.com/images/contributors/jvasile.svg" width="48" height="48" alt="@jvasile" title="@jvasile — Reported missing user, group, and defaults in Debian packages"></a>
|
||||||
|
<a href="https://github.com/Kesavaambati"><img src="https://silo.pgsty.com/images/contributors/Kesavaambati.svg" width="48" height="48" alt="@Kesavaambati" title="@Kesavaambati — Asked about community support and image maintenance"></a>
|
||||||
|
<a href="https://github.com/redfoxfox"><img src="https://silo.pgsty.com/images/contributors/redfoxfox.svg" width="48" height="48" alt="@redfoxfox" title="@redfoxfox — Reported Chinese documentation availability"></a>
|
||||||
|
<a href="https://github.com/kuldeep-link11"><img src="https://silo.pgsty.com/images/contributors/kuldeep-link11.svg" width="48" height="48" alt="@kuldeep-link11" title="@kuldeep-link11 — Reported NATS JWT credentials and target reload issues"></a>
|
||||||
|
<a href="https://github.com/meesudzu"><img src="https://silo.pgsty.com/images/contributors/meesudzu.svg" width="48" height="48" alt="@meesudzu" title="@meesudzu — Requested the migration guide from upstream MinIO"></a>
|
||||||
|
<a href="https://github.com/pmezhuev"><img src="https://silo.pgsty.com/images/contributors/pmezhuev.svg" width="48" height="48" alt="@pmezhuev" title="@pmezhuev — Reported missing RPM package signatures"></a>
|
||||||
|
<a href="https://github.com/kh0mka"><img src="https://silo.pgsty.com/images/contributors/kh0mka.svg" width="48" height="48" alt="@kh0mka" title="@kh0mka — Reported inter-node I/O timeouts and OIDC configuration-fetch failures"></a>
|
||||||
|
<a href="https://github.com/bagutzu"><img src="https://silo.pgsty.com/images/contributors/bagutzu.svg" width="48" height="48" alt="@bagutzu" title="@bagutzu — Requested KES-compatible external KMS and OpenBao support"></a>
|
||||||
|
<a href="https://github.com/liuhaodongliu990-cmyk"><img src="https://silo.pgsty.com/images/contributors/liuhaodongliu990-cmyk.svg" width="48" height="48" alt="@liuhaodongliu990-cmyk" title="@liuhaodongliu990-cmyk — Reported indeterminate progress for prefix downloads"></a>
|
||||||
|
<a href="https://github.com/DestroyLee"><img src="https://silo.pgsty.com/images/contributors/DestroyLee.svg" width="48" height="48" alt="@DestroyLee" title="@DestroyLee — Reported the missing documentation navigation"></a>
|
||||||
|
<a href="https://github.com/sargarass"><img src="https://silo.pgsty.com/images/contributors/sargarass.svg" width="48" height="48" alt="@sargarass" title="@sargarass — Reported ListMultipartUploads prefix and pagination semantics"></a>
|
||||||
|
<a href="https://github.com/mumu-lab"><img src="https://silo.pgsty.com/images/contributors/mumu-lab.svg" width="48" height="48" alt="@mumu-lab" title="@mumu-lab — Reported bucket quota metrics reading a deprecated field"></a>
|
||||||
|
<a href="https://github.com/haiming236"><img src="https://silo.pgsty.com/images/contributors/haiming236.svg" width="48" height="48" alt="@haiming236" title="@haiming236 — Proposed a built-in image processing pipeline"></a>
|
||||||
|
<a href="https://github.com/tiredenzo"><img src="https://silo.pgsty.com/images/contributors/tiredenzo.svg" width="48" height="48" alt="@tiredenzo" title="@tiredenzo — Reported inconsistent documentation for two-drive EC:1 support"></a>
|
||||||
|
<a href="https://github.com/aschyolkin"><img src="https://silo.pgsty.com/images/contributors/aschyolkin.svg" width="48" height="48" alt="@aschyolkin" title="@aschyolkin — Reported a data race in CPU metrics collection"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
| Contributor | Change | Pull request | Commit |
|
## Merged pull requests
|
||||||
| :-- | :-- | :-- | :-- |
|
|
||||||
| [@ZouhairCharef](https://github.com/ZouhairCharef) | Upgraded `go-jose` to v4.1.4 to patch CVE-2026-34986 | [#18](https://github.com/pgsty/silo/pull/18) | [`68e0ba9`](https://github.com/pgsty/silo/commit/68e0ba997) |
|
|
||||||
| [@mfredenhagen](https://github.com/mfredenhagen) | Bumped `go.opentelemetry.io` to address CVE-2026-39883 | [#19](https://github.com/pgsty/silo/pull/19) | [`1869bd3`](https://github.com/pgsty/silo/commit/1869bd30b) |
|
|
||||||
| [@pinginfo](https://github.com/pinginfo) | Implemented `Flush` on `trackingResponseWriter`, repairing bucket notification streaming | [#34](https://github.com/pgsty/silo/pull/34) | [`65795ee`](https://github.com/pgsty/silo/commit/65795ee1f) |
|
|
||||||
| [@waterkip](https://github.com/waterkip) | Repointed documentation links from the upstream domain to the Silo portal | [#41](https://github.com/pgsty/silo/pull/41) | [`d495d30`](https://github.com/pgsty/silo/commit/d495d30d5) |
|
|
||||||
|
|
||||||
## Proposed changes
|
| Contributor | Contribution | Record |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| [@Vonng](https://github.com/Vonng) | Maintains SILO, Console, mcli, shared packages, releases, and documentation | [pgsty/silo: Merged PRs (77)](https://github.com/pgsty/silo/issues?q=author%3AVonng+is%3Apr+is%3Amerged)<br>PRs closed without merging: [pgsty/silo#155](https://github.com/pgsty/silo/pull/155), [pgsty/silo#195](https://github.com/pgsty/silo/pull/195)<br>[pgsty/silo: Closed issues (60)](https://github.com/pgsty/silo/issues?q=author%3AVonng+is%3Aissue+is%3Aclosed)<br>Open issues: [pgsty/silo#199](https://github.com/pgsty/silo/issues/199), [pgsty/silo#200](https://github.com/pgsty/silo/issues/200), [pgsty/silo#201](https://github.com/pgsty/silo/issues/201), [pgsty/silo#202](https://github.com/pgsty/silo/issues/202), [pgsty/silo#203](https://github.com/pgsty/silo/issues/203)<br>[pgsty/silo-console: Merged PRs (22)](https://github.com/pgsty/silo-console/issues?q=author%3AVonng+is%3Apr+is%3Amerged)<br>[pgsty/silo-console: Closed issues (32)](https://github.com/pgsty/silo-console/issues?q=author%3AVonng+is%3Aissue+is%3Aclosed)<br>Open issues: [pgsty/silo-console#32](https://github.com/pgsty/silo-console/issues/32), [pgsty/silo-console#34](https://github.com/pgsty/silo-console/issues/34)<br>[pgsty/mc: Merged PRs (24)](https://github.com/pgsty/mc/issues?q=author%3AVonng+is%3Apr+is%3Amerged)<br>[pgsty/mc: Closed issues (18)](https://github.com/pgsty/mc/issues?q=author%3AVonng+is%3Aissue+is%3Aclosed)<br>Merged PRs: [pgsty/silo-pkg#1](https://github.com/pgsty/silo-pkg/pull/1), [pgsty/silo-pkg#2](https://github.com/pgsty/silo-pkg/pull/2), [pgsty/silo-pkg#3](https://github.com/pgsty/silo-pkg/pull/3), [pgsty/silo-pkg#4](https://github.com/pgsty/silo-pkg/pull/4), [pgsty/silo-pkg#5](https://github.com/pgsty/silo-pkg/pull/5), [pgsty/silo-pkg#6](https://github.com/pgsty/silo-pkg/pull/6), [pgsty/silo-pkg#7](https://github.com/pgsty/silo-pkg/pull/7), [pgsty/silo-pkg#8](https://github.com/pgsty/silo-pkg/pull/8), [pgsty/silo-pkg#9](https://github.com/pgsty/silo-pkg/pull/9)<br>[pgsty/silo.pgsty.com: Merged PRs (24)](https://github.com/pgsty/silo.pgsty.com/issues?q=author%3AVonng+is%3Apr+is%3Amerged)<br>Open PRs: [pgsty/silo.pgsty.com#25](https://github.com/pgsty/silo.pgsty.com/pull/25) |
|
||||||
|
| [@ZouhairCharef](https://github.com/ZouhairCharef) | Patched CVE-2026-34986 in go-jose | Merged PRs: [pgsty/silo#18](https://github.com/pgsty/silo/pull/18) |
|
||||||
|
| [@mfredenhagen](https://github.com/mfredenhagen) | Patched CVE-2026-39883 in OpenTelemetry | Merged PRs: [pgsty/silo#19](https://github.com/pgsty/silo/pull/19) |
|
||||||
|
| [@pinginfo](https://github.com/pinginfo) | Repaired bucket notification streaming | Merged PRs: [pgsty/silo#34](https://github.com/pgsty/silo/pull/34) |
|
||||||
|
| [@ycjlin](https://github.com/ycjlin) | Fixed missing-bucket ListObjects semantics | Merged PRs: [pgsty/silo#37](https://github.com/pgsty/silo/pull/37) |
|
||||||
|
| [@waterkip](https://github.com/waterkip) | Repointed documentation links to the SILO portal | Merged PRs: [pgsty/silo#41](https://github.com/pgsty/silo/pull/41) |
|
||||||
|
| [@Dansyuqri](https://github.com/Dansyuqri) | Added ChecksumType to multipart completion responses | Merged PRs: [pgsty/silo#57](https://github.com/pgsty/silo/pull/57) |
|
||||||
|
| [@mrjavadseydi](https://github.com/mrjavadseydi) | Fixed bucket quota metrics; contributed access-frequency ILM and S3-compatible multipart listing proposals | Merged PRs: [pgsty/silo#60](https://github.com/pgsty/silo/pull/60), [pgsty/silo#132](https://github.com/pgsty/silo/pull/132), [pgsty/silo#198](https://github.com/pgsty/silo/pull/198)<br>The access-frequency feature in [#60](https://github.com/pgsty/silo/pull/60) was merged and later removed. The multipart-listing contribution in [#198](https://github.com/pgsty/silo/pull/198) was merged after follow-up durability and cancellation repairs; it remains unreleased. |
|
||||||
|
| [@h5vx](https://github.com/h5vx) | Implemented per-bucket CORS configuration and enforcement | Merged PRs: [pgsty/silo#71](https://github.com/pgsty/silo/pull/71) |
|
||||||
|
| [@nikitapogromsky](https://github.com/nikitapogromsky) | Fixed duplicate logger targets that broke Metrics V3 collection | Merged PRs: [pgsty/silo#151](https://github.com/pgsty/silo/pull/151)<br>Closed issues: [pgsty/silo#150](https://github.com/pgsty/silo/issues/150) |
|
||||||
|
| [@Aeirx](https://github.com/Aeirx) | Preserved Object Lock legal-hold headers in federated CopyObject | Merged PRs: [pgsty/silo#172](https://github.com/pgsty/silo/pull/172) |
|
||||||
|
|
||||||
Pull requests that are open for review, or that were closed after informing work that shipped
|
## Other pull-request authors
|
||||||
differently.
|
|
||||||
|
|
||||||
| Contributor | Change | Pull request | Status |
|
| Contributor | Contribution | Record |
|
||||||
| :-- | :-- | :-- | :-- |
|
| :-- | :-- | :-- |
|
||||||
| [@magicxor](https://github.com/magicxor) | `DELETE` precondition checks for the `If-Match` header | [#12](https://github.com/pgsty/silo/pull/12) | Open, queued for review |
|
| [@magicxor](https://github.com/magicxor) | Reported and proposed conditional DELETE support for If-Match | PRs closed without merging: [pgsty/silo#12](https://github.com/pgsty/silo/pull/12)<br>Closed issues: [pgsty/silo#10](https://github.com/pgsty/silo/issues/10)<br>The original PR closed after conditional DELETE support landed in [#145](https://github.com/pgsty/silo/pull/145). |
|
||||||
| [@ycjlin](https://github.com/ycjlin) | `ListObjects` should return `NoSuchBucket` for a prefix on a missing bucket | [#37](https://github.com/pgsty/silo/pull/37) | Open, queued for review |
|
| [@davinkevin](https://github.com/davinkevin) | Proposed the distroless container image and dependency automation | PRs closed without merging: [pgsty/silo#21](https://github.com/pgsty/silo/pull/21)<br>Open issues: [pgsty/silo#20](https://github.com/pgsty/silo/issues/20)<br>The distroless proposal was superseded by the image shipped in [RELEASE.2026-08-06](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-08-06T00-00-00Z). |
|
||||||
| [@davinkevin](https://github.com/davinkevin) | Distroless-based Docker image variant | [#21](https://github.com/pgsty/silo/pull/21) | Superseded by the distroless variant shipped in RELEASE.2026-08-06, which the PR anticipated by four months |
|
| [@metaneutrons](https://github.com/metaneutrons) | Reported and proposed explicit-version delete authorization | PRs closed without merging: [pgsty/silo#59](https://github.com/pgsty/silo/pull/59)<br>Closed issues: [pgsty/silo#58](https://github.com/pgsty/silo/issues/58)<br>The original PR was superseded; its authorization action split informed [#104](https://github.com/pgsty/silo/pull/104). |
|
||||||
| [@lem21h](https://github.com/lem21h) | Assorted fixes and improvements | [#36](https://github.com/pgsty/silo/pull/36) | Closed |
|
| [@mikemikimike](https://github.com/mikemikimike) | Contributed the replicated SSE-C plaintext part-size fix | PRs closed without merging: [pgsty/silo#125](https://github.com/pgsty/silo/pull/125)<br>The original PR was superseded; its plaintext-size fix was incorporated through [#124](https://github.com/pgsty/silo/pull/124), with attribute handling in [#128](https://github.com/pgsty/silo/pull/128). |
|
||||||
| [@sulin37392](https://github.com/sulin37392) | Dependency updates against the fork | [#8](https://github.com/pgsty/silo/pull/8) | Closed |
|
| [@julienlau](https://github.com/julienlau) | Reported MRF queue and delete-marker retry defects; contributed repair proposals, tests, and documentation | PRs closed without merging: [pgsty/silo#184](https://github.com/pgsty/silo/pull/184)<br>Closed issues: [pgsty/silo#152](https://github.com/pgsty/silo/issues/152), [pgsty/silo#153](https://github.com/pgsty/silo/issues/153)<br>The original PR was not merged directly. Its purge-state and recovery analysis, proposed fix, tests, and documentation helped shape [#196](https://github.com/pgsty/silo/pull/196); see the [maintainer acknowledgement](https://github.com/pgsty/silo/pull/184#issuecomment-5689295222). |
|
||||||
|
| [@chodorenko](https://github.com/chodorenko) | Reported and contributed the fix for aws-chunked leaking into replica metadata | PRs closed without merging: [pgsty/silo#187](https://github.com/pgsty/silo/pull/187)<br>Closed issues: [pgsty/silo#185](https://github.com/pgsty/silo/issues/185)<br>The implementation was incorporated in [#194](https://github.com/pgsty/silo/pull/194), with [co-author credit](https://github.com/pgsty/silo/commit/4fcdf37ce656152b32ad0f615d47f5e3f9748c3a); the original PR was closed as superseded. |
|
||||||
|
| [@sulin37392](https://github.com/sulin37392) | Proposed dependency updates | PRs closed without merging: [pgsty/silo#8](https://github.com/pgsty/silo/pull/8) |
|
||||||
|
| [@lem21h](https://github.com/lem21h) | Proposed robustness and goroutine improvements | PRs closed without merging: [pgsty/silo#36](https://github.com/pgsty/silo/pull/36) |
|
||||||
|
|
||||||
## Reports
|
## Issue reports
|
||||||
|
|
||||||
Bug reports, compatibility findings, and proposals filed against this fork. Several shipped fixes
|
| Contributor | Contribution | Record |
|
||||||
trace directly back to these: the bundled-client guarantee (#4, #9), the LDAP-over-TLS repair (#15),
|
| :-- | :-- | :-- |
|
||||||
the completed native package payload (#33), GPG-signed RPMs (#43), and the upstream migration guide
|
| [@vampywiz17](https://github.com/vampywiz17) | Reported LDAP TLS and Console login regressions | Closed issues: [pgsty/silo#15](https://github.com/pgsty/silo/issues/15), [pgsty/silo#108](https://github.com/pgsty/silo/issues/108) |
|
||||||
(#42).
|
| [@cbornet](https://github.com/cbornet) | Reported multipart and streaming checksum defects and missing-bucket semantics | Closed issues: [pgsty/silo#31](https://github.com/pgsty/silo/issues/31), [pgsty/silo#32](https://github.com/pgsty/silo/issues/32), [pgsty/silo#107](https://github.com/pgsty/silo/issues/107) |
|
||||||
|
| [@orenyomtov](https://github.com/orenyomtov) | Reported the unsigned-header CopyObject cross-object read (SN-2026-011) | Security disclosure credited in [SN-2026-011](https://silo.pgsty.com/about/security-advisories/#sn-2026-011), with the source fix in [#173](https://github.com/pgsty/silo/pull/173). This credit is retained separately from public issue/PR authorship. |
|
||||||
|
| [@jiri-pejchal](https://github.com/jiri-pejchal) | Reported the RabbitMQ client vulnerability and the Console share proxy's exposure of internal metrics | Closed issues: [pgsty/silo#176](https://github.com/pgsty/silo/issues/176)<br>Closed issues: [pgsty/silo-console#52](https://github.com/pgsty/silo-console/issues/52) |
|
||||||
|
| [@AEGEGE](https://github.com/AEGEGE) | Reported the slow-HTTP denial-of-service vulnerability | Closed issues: [pgsty/silo#183](https://github.com/pgsty/silo/issues/183)<br>The reproduced slow-header defect was fixed on main through [#196](https://github.com/pgsty/silo/pull/196). |
|
||||||
|
| [@mosesdd](https://github.com/mosesdd) | Requested a maintained Helm chart | Closed issues: [pgsty/silo#1](https://github.com/pgsty/silo/issues/1) |
|
||||||
|
| [@Xavier-777](https://github.com/Xavier-777) | Reported Console lifecycle management and file preview gaps | Closed issues: [pgsty/silo#2](https://github.com/pgsty/silo/issues/2), [pgsty/silo#17](https://github.com/pgsty/silo/issues/17) |
|
||||||
|
| [@jiadzh](https://github.com/jiadzh) | Requested Windows build guidance | Closed issues: [pgsty/silo#3](https://github.com/pgsty/silo/issues/3) |
|
||||||
|
| [@AntonOfTheWoods](https://github.com/AntonOfTheWoods) | Asked for clarity on Helm chart and operator options | Closed issues: [pgsty/silo#5](https://github.com/pgsty/silo/issues/5) |
|
||||||
|
| [@TLINDEN](https://github.com/TLINDEN) | Reported the missing client in release tarballs | Closed issues: [pgsty/silo#4](https://github.com/pgsty/silo/issues/4) |
|
||||||
|
| [@zylpsrs](https://github.com/zylpsrs) | Reported missing Console tiering and site replication | Closed issues: [pgsty/silo#6](https://github.com/pgsty/silo/issues/6) |
|
||||||
|
| [@nsanitate](https://github.com/nsanitate) | Proposed CNCF Sandbox governance | Closed issues: [pgsty/silo#7](https://github.com/pgsty/silo/issues/7) |
|
||||||
|
| [@makinikm](https://github.com/makinikm) | Reported the missing client in the container image | Closed issues: [pgsty/silo#9](https://github.com/pgsty/silo/issues/9) |
|
||||||
|
| [@spaceg00se-r](https://github.com/spaceg00se-r) | Requested cpuv1 support and reported a workflow token failure | Closed issues: [pgsty/silo#11](https://github.com/pgsty/silo/issues/11), [pgsty/silo#14](https://github.com/pgsty/silo/issues/14) |
|
||||||
|
| [@heroes1412](https://github.com/heroes1412) | Reported the unusable profiling option | Closed issues: [pgsty/silo#13](https://github.com/pgsty/silo/issues/13) |
|
||||||
|
| [@chalukyaj](https://github.com/chalukyaj) | Proposed making the SILO Operator easier to discover | Open issues: [pgsty/silo#30](https://github.com/pgsty/silo/issues/30) |
|
||||||
|
| [@jvasile](https://github.com/jvasile) | Reported missing user, group, and defaults in Debian packages | Closed issues: [pgsty/silo#33](https://github.com/pgsty/silo/issues/33) |
|
||||||
|
| [@Kesavaambati](https://github.com/Kesavaambati) | Asked about community support and image maintenance | Closed issues: [pgsty/silo#35](https://github.com/pgsty/silo/issues/35) |
|
||||||
|
| [@redfoxfox](https://github.com/redfoxfox) | Reported Chinese documentation availability | Closed issues: [pgsty/silo#38](https://github.com/pgsty/silo/issues/38) |
|
||||||
|
| [@kuldeep-link11](https://github.com/kuldeep-link11) | Reported NATS JWT credentials and target reload issues | Closed issues: [pgsty/silo#39](https://github.com/pgsty/silo/issues/39)<br>Open issues: [pgsty/silo#40](https://github.com/pgsty/silo/issues/40) |
|
||||||
|
| [@meesudzu](https://github.com/meesudzu) | Requested the migration guide from upstream MinIO | Closed issues: [pgsty/silo#42](https://github.com/pgsty/silo/issues/42) |
|
||||||
|
| [@pmezhuev](https://github.com/pmezhuev) | Reported missing RPM package signatures | Closed issues: [pgsty/silo#43](https://github.com/pgsty/silo/issues/43) |
|
||||||
|
| [@kh0mka](https://github.com/kh0mka) | Reported inter-node I/O timeouts and OIDC configuration-fetch failures | Closed issues: [pgsty/silo#51](https://github.com/pgsty/silo/issues/51), [pgsty/silo#154](https://github.com/pgsty/silo/issues/154) |
|
||||||
|
| [@bagutzu](https://github.com/bagutzu) | Requested KES-compatible external KMS and OpenBao support | Open issues: [pgsty/silo#61](https://github.com/pgsty/silo/issues/61) |
|
||||||
|
| [@liuhaodongliu990-cmyk](https://github.com/liuhaodongliu990-cmyk) | Reported indeterminate progress for prefix downloads | Closed issues: [pgsty/silo#62](https://github.com/pgsty/silo/issues/62) |
|
||||||
|
| [@DestroyLee](https://github.com/DestroyLee) | Reported the missing documentation navigation | Closed issues: [pgsty/silo.pgsty.com#4](https://github.com/pgsty/silo.pgsty.com/issues/4) |
|
||||||
|
| [@sargarass](https://github.com/sargarass) | Reported ListMultipartUploads prefix and pagination semantics | Open issues: [pgsty/silo#79](https://github.com/pgsty/silo/issues/79) |
|
||||||
|
| [@mumu-lab](https://github.com/mumu-lab) | Reported bucket quota metrics reading a deprecated field | Closed issues: [pgsty/silo#106](https://github.com/pgsty/silo/issues/106) |
|
||||||
|
| [@haiming236](https://github.com/haiming236) | Proposed a built-in image processing pipeline | Open issues: [pgsty/silo#160](https://github.com/pgsty/silo/issues/160) |
|
||||||
|
| [@tiredenzo](https://github.com/tiredenzo) | Reported inconsistent documentation for two-drive EC:1 support | Open issues: [pgsty/silo#197](https://github.com/pgsty/silo/issues/197) |
|
||||||
|
| [@aschyolkin](https://github.com/aschyolkin) | Reported a data race in CPU metrics collection | Open issues: [pgsty/silo#210](https://github.com/pgsty/silo/issues/210) |
|
||||||
|
|
||||||
| Contributor | Reported |
|
## Audit scope
|
||||||
| :-- | :-- |
|
|
||||||
| [@mosesdd](https://github.com/mosesdd) | [#1](https://github.com/pgsty/silo/issues/1) Helm chart availability |
|
|
||||||
| [@Xavier-777](https://github.com/Xavier-777) | [#2](https://github.com/pgsty/silo/issues/2) Console bucket lifecycle management · [#17](https://github.com/pgsty/silo/issues/17) Log and XML file preview |
|
|
||||||
| [@jiadzh](https://github.com/jiadzh) | [#3](https://github.com/pgsty/silo/issues/3) Windows build guidance |
|
|
||||||
| [@TLINDEN](https://github.com/TLINDEN) | [#4](https://github.com/pgsty/silo/issues/4) `mc` missing from released tarballs |
|
|
||||||
| [@AntonOfTheWoods](https://github.com/AntonOfTheWoods) | [#5](https://github.com/pgsty/silo/issues/5) Upstream Helm chart and operator options |
|
|
||||||
| [@zylpsrs](https://github.com/zylpsrs) | [#6](https://github.com/pgsty/silo/issues/6) Console missing Tiering and Site Replication |
|
|
||||||
| [@nsanitate](https://github.com/nsanitate) | [#7](https://github.com/pgsty/silo/issues/7) CNCF Sandbox governance proposal |
|
|
||||||
| [@makinikm](https://github.com/makinikm) | [#9](https://github.com/pgsty/silo/issues/9) `mc` missing from the Docker image |
|
|
||||||
| [@magicxor](https://github.com/magicxor) | [#10](https://github.com/pgsty/silo/issues/10) `DeleteObject` ignores the `If-Match` header |
|
|
||||||
| [@spaceg00se-r](https://github.com/spaceg00se-r) | [#11](https://github.com/pgsty/silo/issues/11) `cpuv1` support · [#14](https://github.com/pgsty/silo/issues/14) Project workflow token failure |
|
|
||||||
| [@heroes1412](https://github.com/heroes1412) | [#13](https://github.com/pgsty/silo/issues/13) Profile option unusable |
|
|
||||||
| [@vampywiz17](https://github.com/vampywiz17) | [#15](https://github.com/pgsty/silo/issues/15) LDAP TLS regression breaking Console login on Kubernetes |
|
|
||||||
| [@davinkevin](https://github.com/davinkevin) | [#20](https://github.com/pgsty/silo/issues/20) Renovate for automated dependency updates |
|
|
||||||
| [@chalukyaj](https://github.com/chalukyaj) | [#30](https://github.com/pgsty/silo/issues/30) Silo Operator discoverability |
|
|
||||||
| [@cbornet](https://github.com/cbornet) | [#31](https://github.com/pgsty/silo/issues/31) Multipart uploads with `FULL_OBJECT` CRC32 · [#32](https://github.com/pgsty/silo/issues/32) `ListObjects` bucket-existence semantics |
|
|
||||||
| [@jvasile](https://github.com/jvasile) | [#33](https://github.com/pgsty/silo/issues/33) `.deb` missing user, group, and default files |
|
|
||||||
| [@Kesavaambati](https://github.com/Kesavaambati) | [#35](https://github.com/pgsty/silo/issues/35) Community support for the Docker images |
|
|
||||||
| [@redfoxfox](https://github.com/redfoxfox) | [#38](https://github.com/pgsty/silo/issues/38) Chinese documentation site unreachable |
|
|
||||||
| [@kuldeep-link11](https://github.com/kuldeep-link11) | [#39](https://github.com/pgsty/silo/issues/39) `notify_nats` rejects JWT credentials files · [#40](https://github.com/pgsty/silo/issues/40) `notify_nats` target changes require a restart |
|
|
||||||
| [@meesudzu](https://github.com/meesudzu) | [#42](https://github.com/pgsty/silo/issues/42) Migration guide from upstream MinIO |
|
|
||||||
| [@pmezhuev](https://github.com/pmezhuev) | [#43](https://github.com/pgsty/silo/issues/43) RPM package missing its GPG signature |
|
|
||||||
| [@kh0mka](https://github.com/kh0mka) | [#51](https://github.com/pgsty/silo/issues/51) Inter-node I/O timeout in `ReadFileStreamHandler` |
|
|
||||||
|
|
||||||
## Adding yourself
|
Counts below come from every page of the GitHub issue / PR records, across all states, including automated accounts. There are 49 distinct human public issue / PR authors, plus 1 credited security reporter. Excluded automated accounts: `Copilot`, `dependabot[bot]`.
|
||||||
|
|
||||||
Contributions are accepted inbound=outbound under AGPL-3.0-or-later with no CLA; see
|
| Repository | Issues | Pull requests |
|
||||||
[`CONTRIBUTING.md`](CONTRIBUTING.md). Merged pull requests are added here at the next release. If a
|
| :-- | --: | --: |
|
||||||
contribution is missing or recorded incorrectly, open an issue or say so on the pull request and it
|
| [pgsty/silo](https://github.com/pgsty/silo) | 108 | 99 |
|
||||||
will be fixed.
|
| [pgsty/silo-console](https://github.com/pgsty/silo-console) | 35 | 22 |
|
||||||
|
| [pgsty/mc](https://github.com/pgsty/mc) | 18 | 25 |
|
||||||
|
| [pgsty/silo-pkg](https://github.com/pgsty/silo-pkg) | 0 | 9 |
|
||||||
|
| [pgsty/silo-go](https://github.com/pgsty/silo-go) | 0 | 0 |
|
||||||
|
| [pgsty/kes](https://github.com/pgsty/kes) | 0 | 0 |
|
||||||
|
| [pgsty/silo.pgsty.com](https://github.com/pgsty/silo.pgsty.com) | 1 | 26 |
|
||||||
|
| [pgsty/minio-docs](https://github.com/pgsty/minio-docs) | 0 | 0 |
|
||||||
|
| **Total** | **162** | **181** |
|
||||||
|
|
||||||
|
## Maintainer record
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>@Vonng — complete issue / PR record</summary>
|
||||||
|
|
||||||
|
Merged PRs: [pgsty/silo#44](https://github.com/pgsty/silo/pull/44), [pgsty/silo#45](https://github.com/pgsty/silo/pull/45), [pgsty/silo#56](https://github.com/pgsty/silo/pull/56), [pgsty/silo#66](https://github.com/pgsty/silo/pull/66), [pgsty/silo#69](https://github.com/pgsty/silo/pull/69), [pgsty/silo#70](https://github.com/pgsty/silo/pull/70), [pgsty/silo#72](https://github.com/pgsty/silo/pull/72), [pgsty/silo#73](https://github.com/pgsty/silo/pull/73), [pgsty/silo#74](https://github.com/pgsty/silo/pull/74), [pgsty/silo#80](https://github.com/pgsty/silo/pull/80), [pgsty/silo#81](https://github.com/pgsty/silo/pull/81), [pgsty/silo#85](https://github.com/pgsty/silo/pull/85), [pgsty/silo#86](https://github.com/pgsty/silo/pull/86), [pgsty/silo#87](https://github.com/pgsty/silo/pull/87), [pgsty/silo#88](https://github.com/pgsty/silo/pull/88), [pgsty/silo#89](https://github.com/pgsty/silo/pull/89), [pgsty/silo#90](https://github.com/pgsty/silo/pull/90), [pgsty/silo#91](https://github.com/pgsty/silo/pull/91), [pgsty/silo#92](https://github.com/pgsty/silo/pull/92), [pgsty/silo#93](https://github.com/pgsty/silo/pull/93), [pgsty/silo#94](https://github.com/pgsty/silo/pull/94), [pgsty/silo#95](https://github.com/pgsty/silo/pull/95), [pgsty/silo#96](https://github.com/pgsty/silo/pull/96), [pgsty/silo#97](https://github.com/pgsty/silo/pull/97), [pgsty/silo#98](https://github.com/pgsty/silo/pull/98), [pgsty/silo#101](https://github.com/pgsty/silo/pull/101), [pgsty/silo#103](https://github.com/pgsty/silo/pull/103), [pgsty/silo#104](https://github.com/pgsty/silo/pull/104), [pgsty/silo#121](https://github.com/pgsty/silo/pull/121), [pgsty/silo#122](https://github.com/pgsty/silo/pull/122), [pgsty/silo#123](https://github.com/pgsty/silo/pull/123), [pgsty/silo#124](https://github.com/pgsty/silo/pull/124), [pgsty/silo#126](https://github.com/pgsty/silo/pull/126), [pgsty/silo#127](https://github.com/pgsty/silo/pull/127), [pgsty/silo#128](https://github.com/pgsty/silo/pull/128), [pgsty/silo#129](https://github.com/pgsty/silo/pull/129), [pgsty/silo#130](https://github.com/pgsty/silo/pull/130), [pgsty/silo#131](https://github.com/pgsty/silo/pull/131), [pgsty/silo#134](https://github.com/pgsty/silo/pull/134), [pgsty/silo#135](https://github.com/pgsty/silo/pull/135), [pgsty/silo#138](https://github.com/pgsty/silo/pull/138), [pgsty/silo#140](https://github.com/pgsty/silo/pull/140), [pgsty/silo#142](https://github.com/pgsty/silo/pull/142), [pgsty/silo#143](https://github.com/pgsty/silo/pull/143), [pgsty/silo#145](https://github.com/pgsty/silo/pull/145), [pgsty/silo#146](https://github.com/pgsty/silo/pull/146), [pgsty/silo#149](https://github.com/pgsty/silo/pull/149), [pgsty/silo#156](https://github.com/pgsty/silo/pull/156), [pgsty/silo#157](https://github.com/pgsty/silo/pull/157), [pgsty/silo#159](https://github.com/pgsty/silo/pull/159), [pgsty/silo#161](https://github.com/pgsty/silo/pull/161), [pgsty/silo#162](https://github.com/pgsty/silo/pull/162), [pgsty/silo#163](https://github.com/pgsty/silo/pull/163), [pgsty/silo#164](https://github.com/pgsty/silo/pull/164), [pgsty/silo#173](https://github.com/pgsty/silo/pull/173), [pgsty/silo#174](https://github.com/pgsty/silo/pull/174), [pgsty/silo#175](https://github.com/pgsty/silo/pull/175), [pgsty/silo#177](https://github.com/pgsty/silo/pull/177), [pgsty/silo#178](https://github.com/pgsty/silo/pull/178), [pgsty/silo#179](https://github.com/pgsty/silo/pull/179), [pgsty/silo#180](https://github.com/pgsty/silo/pull/180), [pgsty/silo#181](https://github.com/pgsty/silo/pull/181), [pgsty/silo#182](https://github.com/pgsty/silo/pull/182), [pgsty/silo#188](https://github.com/pgsty/silo/pull/188), [pgsty/silo#189](https://github.com/pgsty/silo/pull/189), [pgsty/silo#190](https://github.com/pgsty/silo/pull/190), [pgsty/silo#191](https://github.com/pgsty/silo/pull/191), [pgsty/silo#192](https://github.com/pgsty/silo/pull/192), [pgsty/silo#193](https://github.com/pgsty/silo/pull/193), [pgsty/silo#194](https://github.com/pgsty/silo/pull/194), [pgsty/silo#196](https://github.com/pgsty/silo/pull/196), [pgsty/silo#205](https://github.com/pgsty/silo/pull/205), [pgsty/silo#206](https://github.com/pgsty/silo/pull/206), [pgsty/silo#207](https://github.com/pgsty/silo/pull/207), [pgsty/silo#208](https://github.com/pgsty/silo/pull/208), [pgsty/silo#209](https://github.com/pgsty/silo/pull/209), [pgsty/silo#211](https://github.com/pgsty/silo/pull/211)
|
||||||
|
|
||||||
|
PRs closed without merging: [pgsty/silo#155](https://github.com/pgsty/silo/pull/155), [pgsty/silo#195](https://github.com/pgsty/silo/pull/195)
|
||||||
|
|
||||||
|
Closed issues: [pgsty/silo#22](https://github.com/pgsty/silo/issues/22), [pgsty/silo#23](https://github.com/pgsty/silo/issues/23), [pgsty/silo#24](https://github.com/pgsty/silo/issues/24), [pgsty/silo#25](https://github.com/pgsty/silo/issues/25), [pgsty/silo#26](https://github.com/pgsty/silo/issues/26), [pgsty/silo#27](https://github.com/pgsty/silo/issues/27), [pgsty/silo#28](https://github.com/pgsty/silo/issues/28), [pgsty/silo#46](https://github.com/pgsty/silo/issues/46), [pgsty/silo#47](https://github.com/pgsty/silo/issues/47), [pgsty/silo#48](https://github.com/pgsty/silo/issues/48), [pgsty/silo#49](https://github.com/pgsty/silo/issues/49), [pgsty/silo#50](https://github.com/pgsty/silo/issues/50), [pgsty/silo#52](https://github.com/pgsty/silo/issues/52), [pgsty/silo#53](https://github.com/pgsty/silo/issues/53), [pgsty/silo#55](https://github.com/pgsty/silo/issues/55), [pgsty/silo#63](https://github.com/pgsty/silo/issues/63), [pgsty/silo#64](https://github.com/pgsty/silo/issues/64), [pgsty/silo#65](https://github.com/pgsty/silo/issues/65), [pgsty/silo#67](https://github.com/pgsty/silo/issues/67), [pgsty/silo#68](https://github.com/pgsty/silo/issues/68), [pgsty/silo#75](https://github.com/pgsty/silo/issues/75), [pgsty/silo#76](https://github.com/pgsty/silo/issues/76), [pgsty/silo#77](https://github.com/pgsty/silo/issues/77), [pgsty/silo#78](https://github.com/pgsty/silo/issues/78), [pgsty/silo#82](https://github.com/pgsty/silo/issues/82), [pgsty/silo#83](https://github.com/pgsty/silo/issues/83), [pgsty/silo#84](https://github.com/pgsty/silo/issues/84), [pgsty/silo#99](https://github.com/pgsty/silo/issues/99), [pgsty/silo#100](https://github.com/pgsty/silo/issues/100), [pgsty/silo#102](https://github.com/pgsty/silo/issues/102), [pgsty/silo#105](https://github.com/pgsty/silo/issues/105), [pgsty/silo#109](https://github.com/pgsty/silo/issues/109), [pgsty/silo#110](https://github.com/pgsty/silo/issues/110), [pgsty/silo#111](https://github.com/pgsty/silo/issues/111), [pgsty/silo#112](https://github.com/pgsty/silo/issues/112), [pgsty/silo#113](https://github.com/pgsty/silo/issues/113), [pgsty/silo#114](https://github.com/pgsty/silo/issues/114), [pgsty/silo#115](https://github.com/pgsty/silo/issues/115), [pgsty/silo#116](https://github.com/pgsty/silo/issues/116), [pgsty/silo#117](https://github.com/pgsty/silo/issues/117), [pgsty/silo#118](https://github.com/pgsty/silo/issues/118), [pgsty/silo#119](https://github.com/pgsty/silo/issues/119), [pgsty/silo#120](https://github.com/pgsty/silo/issues/120), [pgsty/silo#133](https://github.com/pgsty/silo/issues/133), [pgsty/silo#136](https://github.com/pgsty/silo/issues/136), [pgsty/silo#137](https://github.com/pgsty/silo/issues/137), [pgsty/silo#139](https://github.com/pgsty/silo/issues/139), [pgsty/silo#141](https://github.com/pgsty/silo/issues/141), [pgsty/silo#144](https://github.com/pgsty/silo/issues/144), [pgsty/silo#147](https://github.com/pgsty/silo/issues/147), [pgsty/silo#148](https://github.com/pgsty/silo/issues/148), [pgsty/silo#158](https://github.com/pgsty/silo/issues/158), [pgsty/silo#165](https://github.com/pgsty/silo/issues/165), [pgsty/silo#166](https://github.com/pgsty/silo/issues/166), [pgsty/silo#167](https://github.com/pgsty/silo/issues/167), [pgsty/silo#168](https://github.com/pgsty/silo/issues/168), [pgsty/silo#169](https://github.com/pgsty/silo/issues/169), [pgsty/silo#170](https://github.com/pgsty/silo/issues/170), [pgsty/silo#171](https://github.com/pgsty/silo/issues/171), [pgsty/silo#204](https://github.com/pgsty/silo/issues/204)
|
||||||
|
|
||||||
|
Open issues: [pgsty/silo#199](https://github.com/pgsty/silo/issues/199), [pgsty/silo#200](https://github.com/pgsty/silo/issues/200), [pgsty/silo#201](https://github.com/pgsty/silo/issues/201), [pgsty/silo#202](https://github.com/pgsty/silo/issues/202), [pgsty/silo#203](https://github.com/pgsty/silo/issues/203)
|
||||||
|
|
||||||
|
Merged PRs: [pgsty/silo-console#9](https://github.com/pgsty/silo-console/pull/9), [pgsty/silo-console#10](https://github.com/pgsty/silo-console/pull/10), [pgsty/silo-console#11](https://github.com/pgsty/silo-console/pull/11), [pgsty/silo-console#38](https://github.com/pgsty/silo-console/pull/38), [pgsty/silo-console#39](https://github.com/pgsty/silo-console/pull/39), [pgsty/silo-console#40](https://github.com/pgsty/silo-console/pull/40), [pgsty/silo-console#41](https://github.com/pgsty/silo-console/pull/41), [pgsty/silo-console#42](https://github.com/pgsty/silo-console/pull/42), [pgsty/silo-console#43](https://github.com/pgsty/silo-console/pull/43), [pgsty/silo-console#44](https://github.com/pgsty/silo-console/pull/44), [pgsty/silo-console#45](https://github.com/pgsty/silo-console/pull/45), [pgsty/silo-console#46](https://github.com/pgsty/silo-console/pull/46), [pgsty/silo-console#47](https://github.com/pgsty/silo-console/pull/47), [pgsty/silo-console#48](https://github.com/pgsty/silo-console/pull/48), [pgsty/silo-console#49](https://github.com/pgsty/silo-console/pull/49), [pgsty/silo-console#50](https://github.com/pgsty/silo-console/pull/50), [pgsty/silo-console#51](https://github.com/pgsty/silo-console/pull/51), [pgsty/silo-console#53](https://github.com/pgsty/silo-console/pull/53), [pgsty/silo-console#54](https://github.com/pgsty/silo-console/pull/54), [pgsty/silo-console#55](https://github.com/pgsty/silo-console/pull/55), [pgsty/silo-console#56](https://github.com/pgsty/silo-console/pull/56), [pgsty/silo-console#57](https://github.com/pgsty/silo-console/pull/57)
|
||||||
|
|
||||||
|
Closed issues: [pgsty/silo-console#1](https://github.com/pgsty/silo-console/issues/1), [pgsty/silo-console#2](https://github.com/pgsty/silo-console/issues/2), [pgsty/silo-console#3](https://github.com/pgsty/silo-console/issues/3), [pgsty/silo-console#4](https://github.com/pgsty/silo-console/issues/4), [pgsty/silo-console#5](https://github.com/pgsty/silo-console/issues/5), [pgsty/silo-console#6](https://github.com/pgsty/silo-console/issues/6), [pgsty/silo-console#7](https://github.com/pgsty/silo-console/issues/7), [pgsty/silo-console#8](https://github.com/pgsty/silo-console/issues/8), [pgsty/silo-console#12](https://github.com/pgsty/silo-console/issues/12), [pgsty/silo-console#13](https://github.com/pgsty/silo-console/issues/13), [pgsty/silo-console#14](https://github.com/pgsty/silo-console/issues/14), [pgsty/silo-console#15](https://github.com/pgsty/silo-console/issues/15), [pgsty/silo-console#16](https://github.com/pgsty/silo-console/issues/16), [pgsty/silo-console#17](https://github.com/pgsty/silo-console/issues/17), [pgsty/silo-console#18](https://github.com/pgsty/silo-console/issues/18), [pgsty/silo-console#19](https://github.com/pgsty/silo-console/issues/19), [pgsty/silo-console#20](https://github.com/pgsty/silo-console/issues/20), [pgsty/silo-console#21](https://github.com/pgsty/silo-console/issues/21), [pgsty/silo-console#22](https://github.com/pgsty/silo-console/issues/22), [pgsty/silo-console#23](https://github.com/pgsty/silo-console/issues/23), [pgsty/silo-console#24](https://github.com/pgsty/silo-console/issues/24), [pgsty/silo-console#25](https://github.com/pgsty/silo-console/issues/25), [pgsty/silo-console#26](https://github.com/pgsty/silo-console/issues/26), [pgsty/silo-console#27](https://github.com/pgsty/silo-console/issues/27), [pgsty/silo-console#28](https://github.com/pgsty/silo-console/issues/28), [pgsty/silo-console#29](https://github.com/pgsty/silo-console/issues/29), [pgsty/silo-console#30](https://github.com/pgsty/silo-console/issues/30), [pgsty/silo-console#31](https://github.com/pgsty/silo-console/issues/31), [pgsty/silo-console#33](https://github.com/pgsty/silo-console/issues/33), [pgsty/silo-console#35](https://github.com/pgsty/silo-console/issues/35), [pgsty/silo-console#36](https://github.com/pgsty/silo-console/issues/36), [pgsty/silo-console#37](https://github.com/pgsty/silo-console/issues/37)
|
||||||
|
|
||||||
|
Open issues: [pgsty/silo-console#32](https://github.com/pgsty/silo-console/issues/32), [pgsty/silo-console#34](https://github.com/pgsty/silo-console/issues/34)
|
||||||
|
|
||||||
|
Merged PRs: [pgsty/mc#1](https://github.com/pgsty/mc/pull/1), [pgsty/mc#2](https://github.com/pgsty/mc/pull/2), [pgsty/mc#3](https://github.com/pgsty/mc/pull/3), [pgsty/mc#4](https://github.com/pgsty/mc/pull/4), [pgsty/mc#8](https://github.com/pgsty/mc/pull/8), [pgsty/mc#9](https://github.com/pgsty/mc/pull/9), [pgsty/mc#10](https://github.com/pgsty/mc/pull/10), [pgsty/mc#11](https://github.com/pgsty/mc/pull/11), [pgsty/mc#13](https://github.com/pgsty/mc/pull/13), [pgsty/mc#22](https://github.com/pgsty/mc/pull/22), [pgsty/mc#24](https://github.com/pgsty/mc/pull/24), [pgsty/mc#27](https://github.com/pgsty/mc/pull/27), [pgsty/mc#32](https://github.com/pgsty/mc/pull/32), [pgsty/mc#33](https://github.com/pgsty/mc/pull/33), [pgsty/mc#34](https://github.com/pgsty/mc/pull/34), [pgsty/mc#35](https://github.com/pgsty/mc/pull/35), [pgsty/mc#36](https://github.com/pgsty/mc/pull/36), [pgsty/mc#37](https://github.com/pgsty/mc/pull/37), [pgsty/mc#38](https://github.com/pgsty/mc/pull/38), [pgsty/mc#39](https://github.com/pgsty/mc/pull/39), [pgsty/mc#40](https://github.com/pgsty/mc/pull/40), [pgsty/mc#41](https://github.com/pgsty/mc/pull/41), [pgsty/mc#42](https://github.com/pgsty/mc/pull/42), [pgsty/mc#43](https://github.com/pgsty/mc/pull/43)
|
||||||
|
|
||||||
|
Closed issues: [pgsty/mc#5](https://github.com/pgsty/mc/issues/5), [pgsty/mc#6](https://github.com/pgsty/mc/issues/6), [pgsty/mc#7](https://github.com/pgsty/mc/issues/7), [pgsty/mc#12](https://github.com/pgsty/mc/issues/12), [pgsty/mc#14](https://github.com/pgsty/mc/issues/14), [pgsty/mc#15](https://github.com/pgsty/mc/issues/15), [pgsty/mc#16](https://github.com/pgsty/mc/issues/16), [pgsty/mc#17](https://github.com/pgsty/mc/issues/17), [pgsty/mc#18](https://github.com/pgsty/mc/issues/18), [pgsty/mc#19](https://github.com/pgsty/mc/issues/19), [pgsty/mc#20](https://github.com/pgsty/mc/issues/20), [pgsty/mc#21](https://github.com/pgsty/mc/issues/21), [pgsty/mc#23](https://github.com/pgsty/mc/issues/23), [pgsty/mc#25](https://github.com/pgsty/mc/issues/25), [pgsty/mc#28](https://github.com/pgsty/mc/issues/28), [pgsty/mc#29](https://github.com/pgsty/mc/issues/29), [pgsty/mc#30](https://github.com/pgsty/mc/issues/30), [pgsty/mc#31](https://github.com/pgsty/mc/issues/31)
|
||||||
|
|
||||||
|
Merged PRs: [pgsty/silo-pkg#1](https://github.com/pgsty/silo-pkg/pull/1), [pgsty/silo-pkg#2](https://github.com/pgsty/silo-pkg/pull/2), [pgsty/silo-pkg#3](https://github.com/pgsty/silo-pkg/pull/3), [pgsty/silo-pkg#4](https://github.com/pgsty/silo-pkg/pull/4), [pgsty/silo-pkg#5](https://github.com/pgsty/silo-pkg/pull/5), [pgsty/silo-pkg#6](https://github.com/pgsty/silo-pkg/pull/6), [pgsty/silo-pkg#7](https://github.com/pgsty/silo-pkg/pull/7), [pgsty/silo-pkg#8](https://github.com/pgsty/silo-pkg/pull/8), [pgsty/silo-pkg#9](https://github.com/pgsty/silo-pkg/pull/9)
|
||||||
|
|
||||||
|
Merged PRs: [pgsty/silo.pgsty.com#2](https://github.com/pgsty/silo.pgsty.com/pull/2), [pgsty/silo.pgsty.com#3](https://github.com/pgsty/silo.pgsty.com/pull/3), [pgsty/silo.pgsty.com#5](https://github.com/pgsty/silo.pgsty.com/pull/5), [pgsty/silo.pgsty.com#6](https://github.com/pgsty/silo.pgsty.com/pull/6), [pgsty/silo.pgsty.com#7](https://github.com/pgsty/silo.pgsty.com/pull/7), [pgsty/silo.pgsty.com#8](https://github.com/pgsty/silo.pgsty.com/pull/8), [pgsty/silo.pgsty.com#9](https://github.com/pgsty/silo.pgsty.com/pull/9), [pgsty/silo.pgsty.com#10](https://github.com/pgsty/silo.pgsty.com/pull/10), [pgsty/silo.pgsty.com#11](https://github.com/pgsty/silo.pgsty.com/pull/11), [pgsty/silo.pgsty.com#13](https://github.com/pgsty/silo.pgsty.com/pull/13), [pgsty/silo.pgsty.com#14](https://github.com/pgsty/silo.pgsty.com/pull/14), [pgsty/silo.pgsty.com#15](https://github.com/pgsty/silo.pgsty.com/pull/15), [pgsty/silo.pgsty.com#16](https://github.com/pgsty/silo.pgsty.com/pull/16), [pgsty/silo.pgsty.com#17](https://github.com/pgsty/silo.pgsty.com/pull/17), [pgsty/silo.pgsty.com#19](https://github.com/pgsty/silo.pgsty.com/pull/19), [pgsty/silo.pgsty.com#20](https://github.com/pgsty/silo.pgsty.com/pull/20), [pgsty/silo.pgsty.com#21](https://github.com/pgsty/silo.pgsty.com/pull/21), [pgsty/silo.pgsty.com#22](https://github.com/pgsty/silo.pgsty.com/pull/22), [pgsty/silo.pgsty.com#23](https://github.com/pgsty/silo.pgsty.com/pull/23), [pgsty/silo.pgsty.com#24](https://github.com/pgsty/silo.pgsty.com/pull/24), [pgsty/silo.pgsty.com#26](https://github.com/pgsty/silo.pgsty.com/pull/26), [pgsty/silo.pgsty.com#27](https://github.com/pgsty/silo.pgsty.com/pull/27), [pgsty/silo.pgsty.com#28](https://github.com/pgsty/silo.pgsty.com/pull/28), [pgsty/silo.pgsty.com#29](https://github.com/pgsty/silo.pgsty.com/pull/29)
|
||||||
|
|
||||||
|
Open PRs: [pgsty/silo.pgsty.com#25](https://github.com/pgsty/silo.pgsty.com/pull/25)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Keeping this record current
|
||||||
|
|
||||||
|
The reviewed [website contributor data](https://github.com/pgsty/silo.pgsty.com/blob/main/data/home/contributors.yaml) is shared by this record, the component records, README avatar walls, and both website languages. After auditing all issue / PR pages and reviewing adoption evidence, update that data and run `python3 bin/contributors.py` and `python3 bin/contributor_avatars.py` in the site checkout. Validate the generated records with `python3 bin/contributors.py --check`.
|
||||||
|
|
||||||
|
Code contributions follow the no-CLA, DCO policy in [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||||
|
|||||||
+19
-11
@@ -1,4 +1,15 @@
|
|||||||
FROM golang:1.27.0-alpine AS build
|
FROM golang:1.27.1-alpine@sha256:cf6fca6641884b8433441b2b0652976f975e1d0fdd26d177eaaf8596087f3125 AS curl-build
|
||||||
|
ARG TARGETARCH
|
||||||
|
COPY dockerscripts/build-static-curl.sh /build/build-static-curl
|
||||||
|
RUN /bin/sh /build/build-static-curl
|
||||||
|
|
||||||
|
# Exercise the exact shipped curl without a dynamic loader or shared libraries.
|
||||||
|
FROM scratch AS curl-runtime
|
||||||
|
COPY --from=curl-build /go/bin/curl /curl
|
||||||
|
COPY --from=curl-build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
ENTRYPOINT ["/curl"]
|
||||||
|
|
||||||
|
FROM golang:1.27.1-alpine@sha256:cf6fca6641884b8433441b2b0652976f975e1d0fdd26d177eaaf8596087f3125 AS build
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
@@ -6,9 +17,9 @@ ENV GOPATH=/go
|
|||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
|
|
||||||
ARG MC_REPO=pgsty/mc
|
ARG MC_REPO=pgsty/mc
|
||||||
ARG MC_VERSION=RELEASE.2026-08-06T00-00-00Z
|
ARG MC_VERSION=RELEASE.2026-09-13T00-00-00Z
|
||||||
ARG MC_AMD64_SHA256=4b488bd30af54ad4214e5b654746677c79cd93dc6cad4be3aa2d09dbb48370ff
|
ARG MC_AMD64_SHA256=9d2a92de9c7b887d9b944fe9ddce68d23f1b6df3415092e737594e56593f5e2b
|
||||||
ARG MC_ARM64_SHA256=83f6fedb16ed9c1e8efa8aea6776203dff132bc474214543d5c0767ed2066c2f
|
ARG MC_ARM64_SHA256=3d82e9ea6c601c4cb44fe5dd5f2ad1b7d7d64369378110f9ada9c524688a452a
|
||||||
|
|
||||||
RUN apk add -U --no-cache \
|
RUN apk add -U --no-cache \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
@@ -56,18 +67,14 @@ RUN apk add -U --no-cache \
|
|||||||
chmod +x /go/bin/mcli && \
|
chmod +x /go/bin/mcli && \
|
||||||
ln -sf mcli /go/bin/mc
|
ln -sf mcli /go/bin/mc
|
||||||
|
|
||||||
COPY dockerscripts/download-static-curl.sh /build/download-static-curl
|
FROM registry.access.redhat.com/ubi9/ubi:latest@sha256:206b65b8ee0f04b992818c9a51b29081b14974630d4850bc358097d0c44ea156 AS certs
|
||||||
RUN chmod +x /build/download-static-curl && \
|
|
||||||
/build/download-static-curl
|
|
||||||
|
|
||||||
FROM registry.access.redhat.com/ubi9/ubi:latest AS certs
|
|
||||||
RUN dnf -y install ca-certificates && \
|
RUN dnf -y install ca-certificates && \
|
||||||
update-ca-trust && \
|
update-ca-trust && \
|
||||||
cp /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /tmp/ca-certificates.crt && \
|
cp /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /tmp/ca-certificates.crt && \
|
||||||
dnf clean all && \
|
dnf clean all && \
|
||||||
rm -rf /var/cache/dnf
|
rm -rf /var/cache/dnf
|
||||||
|
|
||||||
FROM registry.access.redhat.com/ubi9/ubi-micro:latest
|
FROM registry.access.redhat.com/ubi9/ubi-micro:latest@sha256:f332c99eb8f798a8486821c91937f10ad64ee83d7e739303be2df051040918f6
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="Silo" \
|
LABEL org.opencontainers.image.title="Silo" \
|
||||||
org.opencontainers.image.description="S3-Interface Libre Object Storage" \
|
org.opencontainers.image.description="S3-Interface Libre Object Storage" \
|
||||||
@@ -88,7 +95,8 @@ ENV MINIO_ACCESS_KEY_FILE=access_key \
|
|||||||
COPY --from=certs /tmp/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /tmp/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY silo /usr/bin/silo
|
COPY silo /usr/bin/silo
|
||||||
COPY --from=build /go/bin/mcli /usr/bin/mcli
|
COPY --from=build /go/bin/mcli /usr/bin/mcli
|
||||||
COPY --from=build /go/bin/curl* /usr/bin/
|
COPY --from=curl-build /go/bin/curl /usr/bin/curl
|
||||||
|
COPY --from=curl-build /go/share/curl /licenses/curl
|
||||||
COPY dockerscripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
COPY dockerscripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
||||||
COPY LICENSE /licenses/LICENSE
|
COPY LICENSE /licenses/LICENSE
|
||||||
COPY NOTICE /licenses/NOTICE
|
COPY NOTICE /licenses/NOTICE
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ docker: checks build-debugging ## builds the local Linux Silo container image
|
|||||||
--ldflags "$(LDFLAGS)" -o "$$context/silo"; \
|
--ldflags "$(LDFLAGS)" -o "$$context/silo"; \
|
||||||
mkdir -p "$$context/dockerscripts"; \
|
mkdir -p "$$context/dockerscripts"; \
|
||||||
cp Dockerfile.goreleaser LICENSE NOTICE CREDITS "$$context/"; \
|
cp Dockerfile.goreleaser LICENSE NOTICE CREDITS "$$context/"; \
|
||||||
cp dockerscripts/docker-entrypoint.sh dockerscripts/download-static-curl.sh \
|
cp dockerscripts/docker-entrypoint.sh dockerscripts/build-static-curl.sh \
|
||||||
"$$context/dockerscripts/"; \
|
"$$context/dockerscripts/"; \
|
||||||
docker build -q --no-cache --platform linux/$(GOARCH) -t $(TAG) --build-arg TARGETARCH=$(GOARCH) \
|
docker build -q --no-cache --platform linux/$(GOARCH) -t $(TAG) --build-arg TARGETARCH=$(GOARCH) \
|
||||||
-f "$$context/Dockerfile.goreleaser" "$$context"
|
-f "$$context/Dockerfile.goreleaser" "$$context"
|
||||||
|
|||||||
@@ -35,6 +35,14 @@
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Renamed from `pgsty/minio` to `pgsty/silo`, default branch `master` → `main`, on 2026-08-06. Artifacts under the original MinIO identity stay published on the archived [`minio`](https://github.com/pgsty/silo/tree/minio) branch and in releases up to [`RELEASE.2026-08-04T00-00-00Z`](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-08-04T00-00-00Z).
|
> Renamed from `pgsty/minio` to `pgsty/silo`, default branch `master` → `main`, on 2026-08-06. Artifacts under the original MinIO identity stay published on the archived [`minio`](https://github.com/pgsty/silo/tree/minio) branch and in releases up to [`RELEASE.2026-08-04T00-00-00Z`](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-08-04T00-00-00Z).
|
||||||
|
|
||||||
|
## Current release and main branch
|
||||||
|
|
||||||
|
The latest published Server is [20260903](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-09-03T13-18-01Z).
|
||||||
|
As of 2026-09-16, the main branch has newer security, storage, Console and
|
||||||
|
shared-package changes that have not shipped in a Server release. See
|
||||||
|
[CHANGELOG.md](CHANGELOG.md) and the [component version matrix](https://silo.pgsty.com/compatibility/versions/)
|
||||||
|
for the exact release/source boundary, including SN-2026-011 and password-policy migration.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
PGSTY SILO keeps one maintained release line of the open-source MinIO server alive after upstream ended community distribution: builds, packages, multi-arch images, security fixes, and the full web console. Pigsty runs it in production as its PostgreSQL backup repository.
|
PGSTY SILO keeps one maintained release line of the open-source MinIO server alive after upstream ended community distribution: builds, packages, multi-arch images, security fixes, and the full web console. Pigsty runs it in production as its PostgreSQL backup repository.
|
||||||
@@ -85,61 +93,67 @@ Every release ships checksums, SPDX SBOMs, Sigstore-signed manifests, and GitHub
|
|||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
The S3 API, `MINIO_*` variables, `minio_*` metrics, `x-minio-*` headers, `/minio/*` routes, the `github.com/minio/*` import paths, and the on-disk format (including `.minio.sys`) are preserved and held in place by a CI compatibility check. Only Silo-owned delivery surfaces change: the `silo` executable, package, service, Helm chart, and container image — no `minio` binary alias is installed.
|
Silo preserves S3 and storage-format compatibility, including existing `MINIO_*` variables, `minio_*` metrics, `x-minio-*` headers, `/minio/*` routes, and `.minio.sys` data. CI guards selected compatibility identifiers; release notes document intentional security and behavior changes. Silo-owned delivery surfaces use the `silo` executable, package, service, Helm chart, and container image; no `minio` server binary alias is installed.
|
||||||
|
|
||||||
|
The supported release stack is `pgsty/silo` + `pgsty/silo-console` + `pgsty/mc` + `pgsty/silo-pkg`; compatibility with unmodified upstream MinIO/MC is best effort. The Server, Console, and client retain their historical module paths where needed, while maintained code imports `github.com/pgsty/silo-pkg/v3` directly. The SDK `github.com/minio/minio-go/v7` is an explicit upstream dependency. See the current [go.mod](go.mod) for versions and replacements.
|
||||||
|
|
||||||
Every divergence from upstream is listed in the code-verified [compatibility audit](https://silo.pgsty.com/compatibility/server/). Treat each release as a downstream upgrade: pin versions, read the [release notes](https://silo.pgsty.com/tags/silo/), and keep a rollback path.
|
Every divergence from upstream is listed in the code-verified [compatibility audit](https://silo.pgsty.com/compatibility/server/). Treat each release as a downstream upgrade: pin versions, read the [release notes](https://silo.pgsty.com/tags/silo/), and keep a rollback path.
|
||||||
|
|
||||||
|
### TLS and Go upgrades
|
||||||
|
|
||||||
|
The following TLS repair is on main and is not included in Server 20260903.
|
||||||
|
With that repair, TLS key exchange follows Go's defaults across the S3 listener, node links,
|
||||||
|
replication, identity providers, etcd, and external HTTP services. If an endpoint
|
||||||
|
cannot accept ML-KEM, `GODEBUG=tlsmlkem=0` disables the default hybrid exchanges
|
||||||
|
for the process; certificate verification remains enabled. This option does not
|
||||||
|
disable ML-DSA signatures or resolve every TLS reset. Prefer updating the
|
||||||
|
incompatible endpoint before removing the temporary setting.
|
||||||
|
If only the new SecP hybrids cause problems, `GODEBUG=tlssecpmlkem=0` disables
|
||||||
|
those groups while retaining X25519MLKEM768.
|
||||||
|
|
||||||
|
For builds targeting Go 1.27, setting either `SSL_CERT_FILE` or `SSL_CERT_DIR`
|
||||||
|
on macOS replaces Keychain trust with on-disk roots and Go's verifier. Stale or
|
||||||
|
incomplete CA paths can break previously trusted connections; unset inherited
|
||||||
|
values to restore Keychain trust. Explicit certificates in the configured `CAs`
|
||||||
|
directory remain additive to the selected root pool.
|
||||||
|
Go 1.27 binaries require macOS 13 or later. See the
|
||||||
|
[Go release notes](https://go.dev/doc/go1.27) and the
|
||||||
|
[Go 1.27 TLS and OIDC discovery guide](https://silo.pgsty.com/blog/design/go127-tls-oidc-discovery/).
|
||||||
|
|
||||||
|
## Documentation ownership
|
||||||
|
|
||||||
|
User documentation is maintained at [silo.pgsty.com](https://silo.pgsty.com/docs/),
|
||||||
|
with source in [pgsty/silo.pgsty.com](https://github.com/pgsty/silo.pgsty.com).
|
||||||
|
The remaining `docs/` tree contains inherited references, examples, and tooling
|
||||||
|
fixtures. Investigation logs, AI work records, and temporary reports are kept
|
||||||
|
outside this repository; reusable findings belong in the companion site.
|
||||||
|
See [AGENTS.md](AGENTS.md) for repository ownership and maintenance rules.
|
||||||
|
|
||||||
## Security & Contributing
|
## Security & Contributing
|
||||||
|
|
||||||
Report vulnerabilities privately as described in [`SECURITY.md`](SECURITY.md); every fix ships with a public [advisory](https://silo.pgsty.com/blog/security/). Contributions are accepted inbound=outbound under AGPL-3.0-or-later with no CLA — only DCO sign-off (`git commit -s`) is required; see [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
Report vulnerabilities privately as described in [`SECURITY.md`](SECURITY.md); every fix ships with a public [advisory](https://silo.pgsty.com/blog/security/). Contributions are accepted inbound=outbound under AGPL-3.0-or-later with no CLA — only DCO sign-off (`git commit -s`) is required; see [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
<table>
|
<!-- Generated by silo.pgsty.com/bin/contributors.py. -->
|
||||||
<tr>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/ZouhairCharef"><img src="https://github.com/ZouhairCharef.png?size=100" width="72" alt="ZouhairCharef"><br><sub><b>@ZouhairCharef</b></sub></a><br><sub>CVE-2026-34986</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/mfredenhagen"><img src="https://github.com/mfredenhagen.png?size=100" width="72" alt="mfredenhagen"><br><sub><b>@mfredenhagen</b></sub></a><br><sub>CVE-2026-39883</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/pinginfo"><img src="https://github.com/pinginfo.png?size=100" width="72" alt="pinginfo"><br><sub><b>@pinginfo</b></sub></a><br><sub>Notification streaming</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/waterkip"><img src="https://github.com/waterkip.png?size=100" width="72" alt="waterkip"><br><sub><b>@waterkip</b></sub></a><br><sub>Documentation links</sub>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/magicxor"><img src="https://github.com/magicxor.png?size=64" width="44" alt="magicxor" title="@magicxor"></a>
|
|
||||||
<a href="https://github.com/ycjlin"><img src="https://github.com/ycjlin.png?size=64" width="44" alt="ycjlin" title="@ycjlin"></a>
|
|
||||||
<a href="https://github.com/davinkevin"><img src="https://github.com/davinkevin.png?size=64" width="44" alt="davinkevin" title="@davinkevin"></a>
|
|
||||||
<a href="https://github.com/lem21h"><img src="https://github.com/lem21h.png?size=64" width="44" alt="lem21h" title="@lem21h"></a>
|
|
||||||
<a href="https://github.com/sulin37392"><img src="https://github.com/sulin37392.png?size=64" width="44" alt="sulin37392" title="@sulin37392"></a>
|
|
||||||
<a href="https://github.com/mosesdd"><img src="https://github.com/mosesdd.png?size=64" width="44" alt="mosesdd" title="@mosesdd"></a>
|
|
||||||
<a href="https://github.com/Xavier-777"><img src="https://github.com/Xavier-777.png?size=64" width="44" alt="Xavier-777" title="@Xavier-777"></a>
|
|
||||||
<a href="https://github.com/jiadzh"><img src="https://github.com/jiadzh.png?size=64" width="44" alt="jiadzh" title="@jiadzh"></a>
|
|
||||||
<a href="https://github.com/TLINDEN"><img src="https://github.com/TLINDEN.png?size=64" width="44" alt="TLINDEN" title="@TLINDEN"></a>
|
|
||||||
<a href="https://github.com/AntonOfTheWoods"><img src="https://github.com/AntonOfTheWoods.png?size=64" width="44" alt="AntonOfTheWoods" title="@AntonOfTheWoods"></a>
|
|
||||||
<a href="https://github.com/zylpsrs"><img src="https://github.com/zylpsrs.png?size=64" width="44" alt="zylpsrs" title="@zylpsrs"></a>
|
|
||||||
<a href="https://github.com/nsanitate"><img src="https://github.com/nsanitate.png?size=64" width="44" alt="nsanitate" title="@nsanitate"></a>
|
|
||||||
<a href="https://github.com/makinikm"><img src="https://github.com/makinikm.png?size=64" width="44" alt="makinikm" title="@makinikm"></a>
|
|
||||||
<a href="https://github.com/spaceg00se-r"><img src="https://github.com/spaceg00se-r.png?size=64" width="44" alt="spaceg00se-r" title="@spaceg00se-r"></a>
|
|
||||||
<a href="https://github.com/heroes1412"><img src="https://github.com/heroes1412.png?size=64" width="44" alt="heroes1412" title="@heroes1412"></a>
|
|
||||||
<a href="https://github.com/vampywiz17"><img src="https://github.com/vampywiz17.png?size=64" width="44" alt="vampywiz17" title="@vampywiz17"></a>
|
|
||||||
<a href="https://github.com/chalukyaj"><img src="https://github.com/chalukyaj.png?size=64" width="44" alt="chalukyaj" title="@chalukyaj"></a>
|
|
||||||
<a href="https://github.com/cbornet"><img src="https://github.com/cbornet.png?size=64" width="44" alt="cbornet" title="@cbornet"></a>
|
|
||||||
<a href="https://github.com/jvasile"><img src="https://github.com/jvasile.png?size=64" width="44" alt="jvasile" title="@jvasile"></a>
|
|
||||||
<a href="https://github.com/Kesavaambati"><img src="https://github.com/Kesavaambati.png?size=64" width="44" alt="Kesavaambati" title="@Kesavaambati"></a>
|
|
||||||
<a href="https://github.com/redfoxfox"><img src="https://github.com/redfoxfox.png?size=64" width="44" alt="redfoxfox" title="@redfoxfox"></a>
|
|
||||||
<a href="https://github.com/kuldeep-link11"><img src="https://github.com/kuldeep-link11.png?size=64" width="44" alt="kuldeep-link11" title="@kuldeep-link11"></a>
|
|
||||||
<a href="https://github.com/meesudzu"><img src="https://github.com/meesudzu.png?size=64" width="44" alt="meesudzu" title="@meesudzu"></a>
|
|
||||||
<a href="https://github.com/pmezhuev"><img src="https://github.com/pmezhuev.png?size=64" width="44" alt="pmezhuev" title="@pmezhuev"></a>
|
|
||||||
<a href="https://github.com/kh0mka"><img src="https://github.com/kh0mka.png?size=64" width="44" alt="kh0mka" title="@kh0mka"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
GitHub does not generate a contributor graph for forks, so [`CONTRIBUTORS.md`](CONTRIBUTORS.md) — not the Insights page — is this project's attribution record. It names everyone alongside the change or report they contributed.
|
Every human issue or pull-request author is part of the SILO community, including open and unmerged work. Merged fixes, adopted proposals, and actionable reports receive priority, with first participation guiding the remaining order. Gold rings highlight reviewed significant contributions.
|
||||||
|
|
||||||
|
<a href="CONTRIBUTORS.md">
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/contributors-dark.svg">
|
||||||
|
<img src="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/contributors-light.svg" alt="SILO community contributors">
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
[View contribution notes and actual PR status](CONTRIBUTORS.md).
|
||||||
|
|
||||||
|
## Star History
|
||||||
|
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/star-history-dark.svg">
|
||||||
|
<img src="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/star-history-light.svg" alt="SILO GitHub star history">
|
||||||
|
</picture>
|
||||||
|
|
||||||
## Background
|
## Background
|
||||||
|
|
||||||
|
|||||||
+41
-45
@@ -35,6 +35,13 @@
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> 2026-08-06,本仓库由 `pgsty/minio` 更名为 `pgsty/silo`,默认分支由 `master` 更名为 `main`。以原 MinIO 形态维持的归档构件仍位于归档的 [`minio`](https://github.com/pgsty/silo/tree/minio) 分支,以及截止 [`RELEASE.2026-08-04T00-00-00Z`](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-08-04T00-00-00Z) 的历次发布中。
|
> 2026-08-06,本仓库由 `pgsty/minio` 更名为 `pgsty/silo`,默认分支由 `master` 更名为 `main`。以原 MinIO 形态维持的归档构件仍位于归档的 [`minio`](https://github.com/pgsty/silo/tree/minio) 分支,以及截止 [`RELEASE.2026-08-04T00-00-00Z`](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-08-04T00-00-00Z) 的历次发布中。
|
||||||
|
|
||||||
|
## 当前发行版与主分支
|
||||||
|
|
||||||
|
最新已发布的 Server 仍为 [20260903](https://github.com/pgsty/silo/releases/tag/RELEASE.2026-09-03T13-18-01Z)。
|
||||||
|
截至 2026-09-16,主分支已合入更新的安全、存储、Console 与共享包改动,但尚未发布新 Server。
|
||||||
|
准确的已发布/源码边界见 [CHANGELOG.md](CHANGELOG.md) 与[组件版本矩阵](https://silo.pgsty.com/zh/compatibility/versions/),
|
||||||
|
其中包括 SN-2026-011 修复状态与密码权限迁移要求。
|
||||||
|
|
||||||
## 概述
|
## 概述
|
||||||
|
|
||||||
上游停止社区发行后,Silo 为开源 MinIO 服务端维护一条持续可用的版本线:构建、软件包、多架构镜像、安全修复与完整 Web 控制台。Pigsty 在生产环境中用它承载 PostgreSQL 备份存储。
|
上游停止社区发行后,Silo 为开源 MinIO 服务端维护一条持续可用的版本线:构建、软件包、多架构镜像、安全修复与完整 Web 控制台。Pigsty 在生产环境中用它承载 PostgreSQL 备份存储。
|
||||||
@@ -85,61 +92,50 @@ docker exec silo mcli mb local/demo && docker exec silo mcli ls local
|
|||||||
|
|
||||||
## 兼容性
|
## 兼容性
|
||||||
|
|
||||||
S3 API、`MINIO_*` 环境变量、`minio_*` 指标、`x-minio-*` 头、`/minio/*` 路由、`github.com/minio/*` 导入路径与磁盘格式(含 `.minio.sys`)原样保留,并由 CI 兼容性门禁冻结。只有 Silo 自有交付面改名:`silo` 可执行文件、软件包、服务、Helm Chart 与容器镜像 —— 原生交付物不会安装 `minio` 二进制别名。
|
Silo 保留 S3 与存储格式兼容性,包括既有 `MINIO_*` 环境变量、`minio_*` 指标、`x-minio-*` 头、`/minio/*` 路由与 `.minio.sys` 数据。CI 守卫检查选定的兼容性标识,有意的安全与行为变化在发布说明中记录。Silo 自有交付面使用 `silo` 可执行文件、软件包、服务、Helm Chart 与容器镜像;原生交付物不会安装 `minio` 服务端二进制别名。
|
||||||
|
|
||||||
|
正式支持和发布验收的组合为 `pgsty/silo` + `pgsty/silo-console` + `pgsty/mc` + `pgsty/silo-pkg`,对未修改的上游 MinIO/MC 尽最大努力保持兼容。Server、Console 与客户端按需保留历史模块路径,维护源码直接导入 `github.com/pgsty/silo-pkg/v3`;SDK `github.com/minio/minio-go/v7` 是明确保留的上游依赖。具体版本与 replace 以当前 [go.mod](go.mod) 为准。
|
||||||
|
|
||||||
与上游的全部分歧,以逐项核验代码的[兼容性审计](https://silo.pgsty.com/zh/compatibility/server/)形式维护。每个版本仍应视为下游升级:锁定版本,阅读[版本说明](https://silo.pgsty.com/zh/tags/silo/),并保留回滚路径。
|
与上游的全部分歧,以逐项核验代码的[兼容性审计](https://silo.pgsty.com/zh/compatibility/server/)形式维护。每个版本仍应视为下游升级:锁定版本,阅读[版本说明](https://silo.pgsty.com/zh/tags/silo/),并保留回滚路径。
|
||||||
|
|
||||||
|
### TLS 与 Go 升级
|
||||||
|
|
||||||
|
Server 恢复 Go 默认密钥交换策略的修复已在 main,尚未包含在 Server 20260903。
|
||||||
|
`GODEBUG=tlsmlkem=0`、`tlssecpmlkem=0` 的适用范围、macOS 根证书来源变化,
|
||||||
|
以及 OIDC discovery 的诊断方法见 [Go 1.27 TLS 与 OIDC 指南](https://silo.pgsty.com/zh/blog/design/go127-tls-oidc-discovery/)。
|
||||||
|
|
||||||
|
## 文档归属
|
||||||
|
|
||||||
|
用户文档统一维护在 [silo.pgsty.com](https://silo.pgsty.com/zh/docs/),源码位于
|
||||||
|
[pgsty/silo.pgsty.com](https://github.com/pgsty/silo.pgsty.com)。本仓库保留的 `docs/`
|
||||||
|
主要是继承的参考材料、示例和工具测试夹具。调查日志、AI 工作记录与临时报告放在仓库外;
|
||||||
|
可复用的结论应整理进伴生文档站。仓库职责与维护规则见 [AGENTS.md](AGENTS.md)。
|
||||||
|
|
||||||
## 安全与贡献
|
## 安全与贡献
|
||||||
|
|
||||||
请按照 [`SECURITY.md`](SECURITY.md) 私密报告漏洞;每项修复都会发布公开[安全公告](https://silo.pgsty.com/zh/blog/security/)。本项目不要求签署 CLA:贡献按 AGPL-3.0-or-later(inbound=outbound)接收,只需 DCO 签署(`git commit -s`),详见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。
|
请按照 [`SECURITY.md`](SECURITY.md) 私密报告漏洞;每项修复都会发布公开[安全公告](https://silo.pgsty.com/zh/blog/security/)。本项目不要求签署 CLA:贡献按 AGPL-3.0-or-later(inbound=outbound)接收,只需 DCO 签署(`git commit -s`),详见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。
|
||||||
|
|
||||||
## 贡献者
|
## 贡献者
|
||||||
|
|
||||||
<table>
|
<!-- Generated by silo.pgsty.com/bin/contributors.py. -->
|
||||||
<tr>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/ZouhairCharef"><img src="https://github.com/ZouhairCharef.png?size=100" width="72" alt="ZouhairCharef"><br><sub><b>@ZouhairCharef</b></sub></a><br><sub>CVE-2026-34986</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/mfredenhagen"><img src="https://github.com/mfredenhagen.png?size=100" width="72" alt="mfredenhagen"><br><sub><b>@mfredenhagen</b></sub></a><br><sub>CVE-2026-39883</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/pinginfo"><img src="https://github.com/pinginfo.png?size=100" width="72" alt="pinginfo"><br><sub><b>@pinginfo</b></sub></a><br><sub>桶通知流式输出</sub>
|
|
||||||
</td>
|
|
||||||
<td align="center" width="150">
|
|
||||||
<a href="https://github.com/waterkip"><img src="https://github.com/waterkip.png?size=100" width="72" alt="waterkip"><br><sub><b>@waterkip</b></sub></a><br><sub>文档链接修正</sub>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/magicxor"><img src="https://github.com/magicxor.png?size=64" width="44" alt="magicxor" title="@magicxor"></a>
|
|
||||||
<a href="https://github.com/ycjlin"><img src="https://github.com/ycjlin.png?size=64" width="44" alt="ycjlin" title="@ycjlin"></a>
|
|
||||||
<a href="https://github.com/davinkevin"><img src="https://github.com/davinkevin.png?size=64" width="44" alt="davinkevin" title="@davinkevin"></a>
|
|
||||||
<a href="https://github.com/lem21h"><img src="https://github.com/lem21h.png?size=64" width="44" alt="lem21h" title="@lem21h"></a>
|
|
||||||
<a href="https://github.com/sulin37392"><img src="https://github.com/sulin37392.png?size=64" width="44" alt="sulin37392" title="@sulin37392"></a>
|
|
||||||
<a href="https://github.com/mosesdd"><img src="https://github.com/mosesdd.png?size=64" width="44" alt="mosesdd" title="@mosesdd"></a>
|
|
||||||
<a href="https://github.com/Xavier-777"><img src="https://github.com/Xavier-777.png?size=64" width="44" alt="Xavier-777" title="@Xavier-777"></a>
|
|
||||||
<a href="https://github.com/jiadzh"><img src="https://github.com/jiadzh.png?size=64" width="44" alt="jiadzh" title="@jiadzh"></a>
|
|
||||||
<a href="https://github.com/TLINDEN"><img src="https://github.com/TLINDEN.png?size=64" width="44" alt="TLINDEN" title="@TLINDEN"></a>
|
|
||||||
<a href="https://github.com/AntonOfTheWoods"><img src="https://github.com/AntonOfTheWoods.png?size=64" width="44" alt="AntonOfTheWoods" title="@AntonOfTheWoods"></a>
|
|
||||||
<a href="https://github.com/zylpsrs"><img src="https://github.com/zylpsrs.png?size=64" width="44" alt="zylpsrs" title="@zylpsrs"></a>
|
|
||||||
<a href="https://github.com/nsanitate"><img src="https://github.com/nsanitate.png?size=64" width="44" alt="nsanitate" title="@nsanitate"></a>
|
|
||||||
<a href="https://github.com/makinikm"><img src="https://github.com/makinikm.png?size=64" width="44" alt="makinikm" title="@makinikm"></a>
|
|
||||||
<a href="https://github.com/spaceg00se-r"><img src="https://github.com/spaceg00se-r.png?size=64" width="44" alt="spaceg00se-r" title="@spaceg00se-r"></a>
|
|
||||||
<a href="https://github.com/heroes1412"><img src="https://github.com/heroes1412.png?size=64" width="44" alt="heroes1412" title="@heroes1412"></a>
|
|
||||||
<a href="https://github.com/vampywiz17"><img src="https://github.com/vampywiz17.png?size=64" width="44" alt="vampywiz17" title="@vampywiz17"></a>
|
|
||||||
<a href="https://github.com/chalukyaj"><img src="https://github.com/chalukyaj.png?size=64" width="44" alt="chalukyaj" title="@chalukyaj"></a>
|
|
||||||
<a href="https://github.com/cbornet"><img src="https://github.com/cbornet.png?size=64" width="44" alt="cbornet" title="@cbornet"></a>
|
|
||||||
<a href="https://github.com/jvasile"><img src="https://github.com/jvasile.png?size=64" width="44" alt="jvasile" title="@jvasile"></a>
|
|
||||||
<a href="https://github.com/Kesavaambati"><img src="https://github.com/Kesavaambati.png?size=64" width="44" alt="Kesavaambati" title="@Kesavaambati"></a>
|
|
||||||
<a href="https://github.com/redfoxfox"><img src="https://github.com/redfoxfox.png?size=64" width="44" alt="redfoxfox" title="@redfoxfox"></a>
|
|
||||||
<a href="https://github.com/kuldeep-link11"><img src="https://github.com/kuldeep-link11.png?size=64" width="44" alt="kuldeep-link11" title="@kuldeep-link11"></a>
|
|
||||||
<a href="https://github.com/meesudzu"><img src="https://github.com/meesudzu.png?size=64" width="44" alt="meesudzu" title="@meesudzu"></a>
|
|
||||||
<a href="https://github.com/pmezhuev"><img src="https://github.com/pmezhuev.png?size=64" width="44" alt="pmezhuev" title="@pmezhuev"></a>
|
|
||||||
<a href="https://github.com/kh0mka"><img src="https://github.com/kh0mka.png?size=64" width="44" alt="kh0mka" title="@kh0mka"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
GitHub 不为 fork 仓库生成贡献者图表,因此 [`CONTRIBUTORS.md`](CONTRIBUTORS.md)(而非 Insights 页面)才是本项目的署名记录,其中逐一记录了每个人对应的改动或报告。
|
每位 issue 或 PR 的作者都是 SILO 社区的一员,包括尚未合并的工作。已合并的修复、被采纳的方案和有效报告优先展示,其余参考首次参与时间;金色圆环突出经过审核的显著贡献。
|
||||||
|
|
||||||
|
<a href="CONTRIBUTORS.md">
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/contributors-dark.svg">
|
||||||
|
<img src="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/contributors-light.svg" alt="SILO 社区贡献者">
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
[查看贡献记录与实际 PR 状态](CONTRIBUTORS.md)。
|
||||||
|
|
||||||
|
## Star History
|
||||||
|
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/star-history-dark.svg">
|
||||||
|
<img src="https://raw.githubusercontent.com/pgsty/silo/codex/repository-cards/star-history-light.svg" alt="SILO GitHub 星标历史">
|
||||||
|
</picture>
|
||||||
|
|
||||||
## 背景
|
## 背景
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ Silo-specific fixes or release notes.
|
|||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
Security fixes are tracked on the active development branch and summarized in
|
Security fixes are tracked on the active development branch and summarized in
|
||||||
[docs/security/advisories.md](docs/security/advisories.md). Only the current
|
[the security advisory ledger](https://silo.pgsty.com/about/security-advisories/). Only the current
|
||||||
Silo release line is supported unless an advisory says otherwise.
|
Silo release line is supported unless an advisory says otherwise.
|
||||||
|
|
||||||
## Inherited Fix Evidence
|
## Inherited Fix Evidence
|
||||||
@@ -26,7 +26,7 @@ separately even when the fork preserves the original commit object and SHA.
|
|||||||
The inherited [service-account](https://github.com/pgsty/silo/blob/c1a49490c78e9c3ebcad86ba0662319138ace190/cmd/admin-handlers-users_test.go#L211-L212)
|
The inherited [service-account](https://github.com/pgsty/silo/blob/c1a49490c78e9c3ebcad86ba0662319138ace190/cmd/admin-handlers-users_test.go#L211-L212)
|
||||||
and [STS](https://github.com/pgsty/silo/blob/c1a49490c78e9c3ebcad86ba0662319138ace190/cmd/sts-handlers_test.go#L45-L46)
|
and [STS](https://github.com/pgsty/silo/blob/c1a49490c78e9c3ebcad86ba0662319138ace190/cmd/sts-handlers_test.go#L45-L46)
|
||||||
regression groups remain part of `go test ./cmd`; see the
|
regression groups remain part of `go test ./cmd`; see the
|
||||||
[canonical ledger](docs/security/advisories.md#inherited-upstream-advisory-baseline)
|
[canonical ledger](https://silo.pgsty.com/about/security-advisories/#inherited)
|
||||||
for the operator-facing record.
|
for the operator-facing record.
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
@@ -42,4 +42,4 @@ For vulnerabilities in this fork:
|
|||||||
|
|
||||||
## Disclosure Process
|
## Disclosure Process
|
||||||
|
|
||||||
Fork-specific fixes and user-visible upgrade notes are published in [docs/security/advisories.md](docs/security/advisories.md). The fork-specific triage and remediation process is described in [VULNERABILITY_REPORT.md](VULNERABILITY_REPORT.md).
|
Fork-specific fixes and user-visible upgrade notes are published in [the security advisory ledger](https://silo.pgsty.com/about/security-advisories/). The fork-specific triage and remediation process is described in [VULNERABILITY_REPORT.md](VULNERABILITY_REPORT.md).
|
||||||
|
|||||||
@@ -34,4 +34,4 @@ Based on the report, the Silo maintainers investigate:
|
|||||||
If the vulnerability exists in this fork itself, the maintainers will, when
|
If the vulnerability exists in this fork itself, the maintainers will, when
|
||||||
feasible, fix the issue or implement reasonable countermeasures such that the
|
feasible, fix the issue or implement reasonable countermeasures such that the
|
||||||
vulnerability can no longer be exploited. Fork-specific upgrade notes and
|
vulnerability can no longer be exploited. Fork-specific upgrade notes and
|
||||||
security advisories are published in `docs/security/advisories.md`.
|
security advisories are published in [the security advisory ledger](https://silo.pgsty.com/about/security-advisories/).
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ _init() {
|
|||||||
|
|
||||||
## Minimum required versions for build dependencies
|
## Minimum required versions for build dependencies
|
||||||
GIT_VERSION="1.0"
|
GIT_VERSION="1.0"
|
||||||
GO_VERSION="1.27.0"
|
GO_VERSION="1.27.1"
|
||||||
OSX_VERSION="10.8"
|
OSX_VERSION="10.8"
|
||||||
KNAME=$(uname -s)
|
KNAME=$(uname -s)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ function start_silo_4drive() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MC_HOST_silo="http://silo:silo123@127.0.0.1:${start_port}/"
|
export MC_HOST_silo="http://silo:silo1234@127.0.0.1:${start_port}/"
|
||||||
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ if [ -n "${MCLI_BIN:-}" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
release=${MCLI_RELEASE:-RELEASE.2026-08-06T00-00-00Z}
|
release=${MCLI_RELEASE:-RELEASE.2026-09-13T00-00-00Z}
|
||||||
version_hyphen=${release#RELEASE.}
|
version_hyphen=${release#RELEASE.}
|
||||||
package_version=$(printf '%s\n' "${version_hyphen}" | sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})-([0-9]{2})-([0-9]{2})Z$/\1\2\3\4\5\6.0.0/')
|
package_version=$(printf '%s\n' "${version_hyphen}" | sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})-([0-9]{2})-([0-9]{2})Z$/\1\2\3\4\5\6.0.0/')
|
||||||
if [ "${package_version}" = "${version_hyphen}" ]; then
|
if [ "${package_version}" = "${version_hyphen}" ]; then
|
||||||
@@ -74,7 +74,7 @@ expected=$(awk -v asset="${archive}" '
|
|||||||
{
|
{
|
||||||
name=$2
|
name=$2
|
||||||
sub(/^\*/, "", name)
|
sub(/^\*/, "", name)
|
||||||
if (name == asset && $1 ~ /^[0-9a-fA-F]{64}$/) print tolower($1)
|
if (name == asset && length($1) == 64 && $1 ~ /^[0-9a-fA-F]+$/) print tolower($1)
|
||||||
}
|
}
|
||||||
' "${tmp_dir}/${checksums}")
|
' "${tmp_dir}/${checksums}")
|
||||||
if ! printf '%s\n' "${expected}" | grep -Eq '^[0-9a-f]{64}$'; then
|
if ! printf '%s\n' "${expected}" | grep -Eq '^[0-9a-f]{64}$'; then
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ function start_silo_10drive() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MC_HOST_silo="http://silo:silo123@127.0.0.1:${start_port}/"
|
export MC_HOST_silo="http://silo:silo1234@127.0.0.1:${start_port}/"
|
||||||
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ function start_silo_10drive() {
|
|||||||
"${PWD}/mc" mb --with-versioning silo/bucket
|
"${PWD}/mc" mb --with-versioning silo/bucket
|
||||||
|
|
||||||
export AWS_ACCESS_KEY_ID=silo
|
export AWS_ACCESS_KEY_ID=silo
|
||||||
export AWS_SECRET_ACCESS_KEY=silo123
|
export AWS_SECRET_ACCESS_KEY=silo1234
|
||||||
aws --endpoint-url http://localhost:"$start_port" s3api create-multipart-upload --bucket bucket --key obj-1 >upload-id.json
|
aws --endpoint-url http://localhost:"$start_port" s3api create-multipart-upload --bucket bucket --key obj-1 >upload-id.json
|
||||||
uploadId=$(jq -r '.UploadId' upload-id.json)
|
uploadId=$(jq -r '.UploadId' upload-id.json)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const manifestVersion = 3
|
const manifestVersion = 4
|
||||||
|
|
||||||
var (
|
var (
|
||||||
minioImportRE = regexp.MustCompile(`github\.com/minio/[A-Za-z0-9_./-]+`)
|
minioImportRE = regexp.MustCompile(`github\.com/minio/[A-Za-z0-9_./-]+`)
|
||||||
@@ -55,7 +55,6 @@ type manifest struct {
|
|||||||
GridRoutes []string `json:"grid_routes"`
|
GridRoutes []string `json:"grid_routes"`
|
||||||
StorageMarkers []string `json:"storage_markers"`
|
StorageMarkers []string `json:"storage_markers"`
|
||||||
PolicyValues []string `json:"policy_values"`
|
PolicyValues []string `json:"policy_values"`
|
||||||
ExportedSymbols []string `json:"exported_symbols"`
|
|
||||||
BrandAllowlist []string `json:"brand_allowlist"`
|
BrandAllowlist []string `json:"brand_allowlist"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,13 +109,13 @@ func collect(repo string) (manifest, error) {
|
|||||||
"grid": {},
|
"grid": {},
|
||||||
"storage": {},
|
"storage": {},
|
||||||
"policy": {},
|
"policy": {},
|
||||||
"exported": {},
|
|
||||||
"brand": {},
|
"brand": {},
|
||||||
}
|
}
|
||||||
modulePath := ""
|
modulePath := ""
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
|
|
||||||
for _, rel := range files {
|
for _, rel := range files {
|
||||||
|
// Migration notes and guard fixtures contain archived identifiers.
|
||||||
if rel == "SILO_REBRANDING_MIGRATION.md" ||
|
if rel == "SILO_REBRANDING_MIGRATION.md" ||
|
||||||
strings.HasPrefix(rel, "buildscripts/rebrand-guard/") ||
|
strings.HasPrefix(rel, "buildscripts/rebrand-guard/") ||
|
||||||
strings.HasPrefix(rel, "buildscripts/helm-migration-guard/") {
|
strings.HasPrefix(rel, "buildscripts/helm-migration-guard/") {
|
||||||
@@ -163,17 +162,17 @@ func collect(repo string) (manifest, error) {
|
|||||||
sets["imports"][value] = struct{}{}
|
sets["imports"][value] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
collectStringMatches(sets["routes"], routeRE, file)
|
|
||||||
collectNamedStringValues(sets["roots"], rel, file, "minioReservedBucket")
|
|
||||||
if rel == "internal/grid/manager.go" {
|
|
||||||
collectStringMatches(sets["grid"], routeRE, file)
|
|
||||||
}
|
|
||||||
if !strings.HasSuffix(rel, "_test.go") {
|
if !strings.HasSuffix(rel, "_test.go") {
|
||||||
collectExported(sets["exported"], filepath.ToSlash(filepath.Dir(rel)), file)
|
// Test files hold request paths for fixtures, not served routes.
|
||||||
|
collectStringMatches(sets["routes"], routeRE, file)
|
||||||
if strings.HasPrefix(rel, "cmd/") || strings.HasPrefix(rel, "internal/") {
|
if strings.HasPrefix(rel, "cmd/") || strings.HasPrefix(rel, "internal/") {
|
||||||
collectBrandStrings(sets["brand"], rel, file)
|
collectBrandStrings(sets["brand"], rel, file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
collectNamedStringValues(sets["roots"], rel, file, "minioReservedBucket")
|
||||||
|
if rel == "internal/grid/manager.go" {
|
||||||
|
collectStringMatches(sets["grid"], routeRE, file)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This was a shell-local PID variable in the generated inspect script,
|
// This was a shell-local PID variable in the generated inspect script,
|
||||||
@@ -195,7 +194,6 @@ func collect(repo string) (manifest, error) {
|
|||||||
GridRoutes: sorted(sets["grid"]),
|
GridRoutes: sorted(sets["grid"]),
|
||||||
StorageMarkers: sorted(sets["storage"]),
|
StorageMarkers: sorted(sets["storage"]),
|
||||||
PolicyValues: sorted(sets["policy"]),
|
PolicyValues: sorted(sets["policy"]),
|
||||||
ExportedSymbols: sorted(sets["exported"]),
|
|
||||||
BrandAllowlist: sorted(sets["brand"]),
|
BrandAllowlist: sorted(sets["brand"]),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -262,7 +260,7 @@ func collectStringMatches(dst map[string]struct{}, re *regexp.Regexp, file *ast.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func trackedFiles(repo string) ([]string, error) {
|
func trackedFiles(repo string) ([]string, error) {
|
||||||
cmd := exec.Command("git", "-C", repo, "ls-files", "--cached", "--others", "--exclude-standard", "-z")
|
cmd := exec.Command("git", "-C", repo, "ls-files", "--cached", "-z")
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("git ls-files: %w", err)
|
return nil, fmt.Errorf("git ls-files: %w", err)
|
||||||
@@ -286,78 +284,6 @@ func addMatches(dst map[string]struct{}, re *regexp.Regexp, text string, lower b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func collectExported(dst map[string]struct{}, dir string, file *ast.File) {
|
|
||||||
prefix := dir + ":" + file.Name.Name + ":"
|
|
||||||
for _, decl := range file.Decls {
|
|
||||||
switch decl := decl.(type) {
|
|
||||||
case *ast.FuncDecl:
|
|
||||||
if !ast.IsExported(decl.Name.Name) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if decl.Recv == nil {
|
|
||||||
dst[prefix+"func:"+decl.Name.Name] = struct{}{}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
receiver := receiverName(decl.Recv.List[0].Type)
|
|
||||||
dst[prefix+"method:"+receiver+"."+decl.Name.Name] = struct{}{}
|
|
||||||
case *ast.GenDecl:
|
|
||||||
for _, spec := range decl.Specs {
|
|
||||||
switch spec := spec.(type) {
|
|
||||||
case *ast.TypeSpec:
|
|
||||||
if !ast.IsExported(spec.Name.Name) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
dst[prefix+"type:"+spec.Name.Name] = struct{}{}
|
|
||||||
collectExportedFields(dst, prefix, spec.Name.Name, spec.Type)
|
|
||||||
case *ast.ValueSpec:
|
|
||||||
kind := strings.ToLower(decl.Tok.String())
|
|
||||||
for _, name := range spec.Names {
|
|
||||||
if ast.IsExported(name.Name) {
|
|
||||||
dst[prefix+kind+":"+name.Name] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func collectExportedFields(dst map[string]struct{}, prefix, typeName string, expr ast.Expr) {
|
|
||||||
var fields *ast.FieldList
|
|
||||||
switch typed := expr.(type) {
|
|
||||||
case *ast.StructType:
|
|
||||||
fields = typed.Fields
|
|
||||||
case *ast.InterfaceType:
|
|
||||||
fields = typed.Methods
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for _, field := range fields.List {
|
|
||||||
for _, name := range field.Names {
|
|
||||||
if ast.IsExported(name.Name) {
|
|
||||||
dst[prefix+"field:"+typeName+"."+name.Name] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func receiverName(expr ast.Expr) string {
|
|
||||||
switch expr := expr.(type) {
|
|
||||||
case *ast.Ident:
|
|
||||||
return expr.Name
|
|
||||||
case *ast.StarExpr:
|
|
||||||
return receiverName(expr.X)
|
|
||||||
case *ast.IndexExpr:
|
|
||||||
return receiverName(expr.X)
|
|
||||||
case *ast.IndexListExpr:
|
|
||||||
return receiverName(expr.X)
|
|
||||||
case *ast.SelectorExpr:
|
|
||||||
return receiverName(expr.X) + "." + expr.Sel.Name
|
|
||||||
default:
|
|
||||||
return fmt.Sprintf("%T", expr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func sorted(set map[string]struct{}) []string {
|
func sorted(set map[string]struct{}) []string {
|
||||||
values := make([]string, 0, len(set))
|
values := make([]string, 0, len(set))
|
||||||
for value := range set {
|
for value := range set {
|
||||||
@@ -409,7 +335,6 @@ func compare(want, got manifest) error {
|
|||||||
{"grid_routes", want.GridRoutes, got.GridRoutes},
|
{"grid_routes", want.GridRoutes, got.GridRoutes},
|
||||||
{"storage_markers", want.StorageMarkers, got.StorageMarkers},
|
{"storage_markers", want.StorageMarkers, got.StorageMarkers},
|
||||||
{"policy_values", want.PolicyValues, got.PolicyValues},
|
{"policy_values", want.PolicyValues, got.PolicyValues},
|
||||||
{"exported_symbols", want.ExportedSymbols, got.ExportedSymbols},
|
|
||||||
{"brand_allowlist", want.BrandAllowlist, got.BrandAllowlist},
|
{"brand_allowlist", want.BrandAllowlist, got.BrandAllowlist},
|
||||||
}
|
}
|
||||||
for _, check := range checks {
|
for _, check := range checks {
|
||||||
@@ -454,10 +379,10 @@ func setDiff(want, got []string) (missing, added []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printSummary(value manifest) {
|
func printSummary(value manifest) {
|
||||||
fmt.Printf("compatibility manifest: imports=%d env=%d metrics=%d headers=%d routes=%d roots=%d grid=%d storage=%d policy=%d exported=%d brand=%d sha256=%s\n",
|
fmt.Printf("compatibility manifest: imports=%d env=%d metrics=%d headers=%d routes=%d roots=%d grid=%d storage=%d policy=%d brand=%d sha256=%s\n",
|
||||||
len(value.MinioImports), len(value.Environment), len(value.Metrics), len(value.Headers),
|
len(value.MinioImports), len(value.Environment), len(value.Metrics), len(value.Headers),
|
||||||
len(value.Routes), len(value.RouteRoots), len(value.GridRoutes), len(value.StorageMarkers), len(value.PolicyValues),
|
len(value.Routes), len(value.RouteRoots), len(value.GridRoutes), len(value.StorageMarkers), len(value.PolicyValues),
|
||||||
len(value.ExportedSymbols), len(value.BrandAllowlist), manifestDigest(value))
|
len(value.BrandAllowlist), manifestDigest(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
func manifestDigest(value manifest) string {
|
func manifestDigest(value manifest) string {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
# Copyright (c) 2026 Feng Ruohang
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Pure, self-contained SVG rendering for SILO's README cards."""
|
||||||
|
from datetime import date, timedelta
|
||||||
|
from html import escape
|
||||||
|
import math
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
themes = {
|
||||||
|
'light': dict(bg='#ffffff', wash='#f2f7fc', edge='#d9e3ee', ink='#16222e',
|
||||||
|
muted='#62758a', blue='#1d588c', copper='#b4762e', grid='#e5edf5',
|
||||||
|
line='#2b6ca3', ring='#dce5ef', field='#f7f9fc', label='#3d4e61'),
|
||||||
|
'dark': dict(bg='#101923', wash='#152738', edge='#2b3c50', ink='#e8eef6',
|
||||||
|
muted='#93a3b8', blue='#7fb8e8', copper='#e0a35c', grid='#263749',
|
||||||
|
line='#5da2dd', ring='#3a4e63', field='#0b1119', label='#b6c2d2'),
|
||||||
|
}
|
||||||
|
|
||||||
|
def read_emblem(path):
|
||||||
|
emblem = ET.parse(path).getroot()
|
||||||
|
body = ''.join(ET.tostring(child, encoding='unicode') for child in emblem
|
||||||
|
if child.tag.rsplit('}', 1)[-1] in ('defs', 'g'))
|
||||||
|
return '\n'.join(line.rstrip() for line in body.splitlines()).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def txt(x, y, value, size=14, color=None, weight=400, anchor='start', mono=False, spacing=None):
|
||||||
|
family = 'Menlo,Consolas,monospace' if mono else 'Arial,Helvetica,sans-serif'
|
||||||
|
extra = f' letter-spacing="{spacing}"' if spacing is not None else ''
|
||||||
|
return (f'<text x="{x}" y="{y}" font-family="{family}" font-size="{size}" '
|
||||||
|
f'font-weight="{weight}" fill="{color}" text-anchor="{anchor}"{extra}>'
|
||||||
|
f'{escape(str(value))}</text>')
|
||||||
|
|
||||||
|
|
||||||
|
def start(height, theme, title, description, emblem_body):
|
||||||
|
t = themes[theme]
|
||||||
|
return [f'<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="{height}" '
|
||||||
|
f'viewBox="0 0 1000 {height}" role="img" aria-labelledby="title desc">',
|
||||||
|
f'<title id="title">{escape(title)}</title><desc id="desc">{escape(description)}</desc>',
|
||||||
|
'<defs><linearGradient id="surface" x1="0" y1="1" x2="1" y2="0">'
|
||||||
|
f'<stop offset="0" stop-color="{t["bg"]}"/>'
|
||||||
|
f'<stop offset="1" stop-color="{t["wash"]}"/></linearGradient>'
|
||||||
|
'<linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">'
|
||||||
|
f'<stop offset="0" stop-color="{t["blue"]}"/>'
|
||||||
|
f'<stop offset="1" stop-color="{t["copper"]}"/></linearGradient>'
|
||||||
|
'<linearGradient id="area" x1="0" y1="0" x2="0" y2="1">'
|
||||||
|
f'<stop offset="0" stop-color="{t["line"]}" stop-opacity=".22"/>'
|
||||||
|
f'<stop offset="1" stop-color="{t["line"]}" stop-opacity=".015"/>'
|
||||||
|
'</linearGradient></defs>',
|
||||||
|
f'<rect x=".75" y=".75" width="998.5" height="{height-1.5}" rx="22" '
|
||||||
|
f'fill="url(#surface)" stroke="{t["edge"]}" stroke-width="1.5"/>',
|
||||||
|
f'<svg x="40" y="25" width="25" height="25" viewBox="230 213 570 570">{emblem_body}</svg>']
|
||||||
|
|
||||||
|
|
||||||
|
def heading(parts, t, eyebrow, title, subtitle, value, value_label):
|
||||||
|
parts.extend([
|
||||||
|
txt(76, 43, eyebrow, 11, t['muted'], 600, mono=True, spacing=1.7),
|
||||||
|
txt(40, 94, title, 32, t['ink'], 700),
|
||||||
|
txt(41, 123, subtitle, 14, t['muted']),
|
||||||
|
txt(958, 89, f'{value:,}', 45, t['ink'], 700, anchor='end'),
|
||||||
|
txt(957, 114, value_label, 10, t['muted'], 600, anchor='end', mono=True, spacing=1.5),
|
||||||
|
f'<path d="M40 146 H960" stroke="{t["edge"]}"/>',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def contributors(theme, people, snapshot, emblem_body):
|
||||||
|
height = 206 + 76 * math.ceil(len(people) / 10)
|
||||||
|
t = themes[theme]
|
||||||
|
parts = start(height, theme, f'SILO community — {len(people)} contributors',
|
||||||
|
f'The existing SILO community roll, including code, proposals and reports across related projects. '
|
||||||
|
f'Gold rings retain the existing significant-contribution designation. Snapshot {snapshot}.', emblem_body)
|
||||||
|
heading(parts, t, 'SILO / COMMUNITY', 'Contributors',
|
||||||
|
'Code, proposals & reports across SILO and related projects', len(people), 'COMMUNITY CONTRIBUTORS')
|
||||||
|
for row in range(math.ceil(len(people) / 10)):
|
||||||
|
group = people[row * 10:(row + 1) * 10]
|
||||||
|
row_width = len(group) * 91
|
||||||
|
for col, person in enumerate(group):
|
||||||
|
x = (1000 - row_width) / 2 + col * 91 + 45.5
|
||||||
|
y = 199 + row * 76
|
||||||
|
identifier = f'avatar-{row}-{col}'
|
||||||
|
featured = bool(person.get('featured'))
|
||||||
|
parts.append(f'<g><title>@{escape(person["handle"])} — {escape(person["what"])}</title>')
|
||||||
|
parts.append(f'<defs><clipPath id="{identifier}"><circle cx="{x}" cy="{y}" r="29"/></clipPath></defs>')
|
||||||
|
if featured:
|
||||||
|
parts.append(f'<circle cx="{x}" cy="{y}" r="34" fill="{t["copper"]}" opacity=".09"/>')
|
||||||
|
if person.get('avatarDataUrl'):
|
||||||
|
parts.append(f'<image x="{x-29}" y="{y-29}" width="58" height="58" '
|
||||||
|
f'clip-path="url(#{identifier})" href="{escape(person["avatarDataUrl"])}"/>')
|
||||||
|
else:
|
||||||
|
parts.append(f'<circle cx="{x}" cy="{y}" r="29" fill="{t["ring"]}"/>')
|
||||||
|
parts.append(txt(x, y + 9, person['handle'][0].upper(), 26, t['ink'], 700, 'middle'))
|
||||||
|
parts.append(f'<circle cx="{x}" cy="{y}" r="30.5" fill="none" '
|
||||||
|
f'stroke="{t["copper"] if featured else t["ring"]}" stroke-width="{2 if featured else 1.25}"/></g>')
|
||||||
|
parts.extend([
|
||||||
|
f'<path d="M40 {height-42} H960" stroke="{t["edge"]}"/>',
|
||||||
|
f'<circle cx="47" cy="{height-21}" r="4" fill="none" stroke="{t["copper"]}" stroke-width="1.5"/>',
|
||||||
|
txt(61, height-17, 'Gold rings mark significant contributions', 12, t['muted']),
|
||||||
|
txt(959, height-17, f'AS OF {snapshot}', 10, t['muted'], 500, 'end', mono=True, spacing=.6),
|
||||||
|
'</svg>',
|
||||||
|
])
|
||||||
|
return ''.join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
def stars(theme, history, snapshot, emblem_body):
|
||||||
|
points = history['points']
|
||||||
|
star_count = points[-1]['stars']
|
||||||
|
t = themes[theme]
|
||||||
|
provenance = ('Initial history reconstructed · Daily totals since ' + history['bootstrap']['through'] + ' · UTC'
|
||||||
|
if history['bootstrap']['reconstructed'] else 'Observed daily star totals · UTC')
|
||||||
|
parts = start(558, theme, f'SILO star history — {star_count:,} stars',
|
||||||
|
f'GitHub repository pgsty/silo. {star_count:,} stars as of {snapshot}. ' +
|
||||||
|
provenance, emblem_body)
|
||||||
|
heading(parts, t, 'SILO / GITHUB', 'Star History', 'pgsty/silo', star_count, 'GITHUB STARS')
|
||||||
|
left, right, top, bottom = 76, 958, 177, 440
|
||||||
|
begin = date.fromisoformat(points[0]['date'])
|
||||||
|
end = date.fromisoformat(points[-1]['date'])
|
||||||
|
days = max(1, (end - begin).days)
|
||||||
|
maximum = max(500, math.ceil(max(p['stars'] for p in points) / 500) * 500)
|
||||||
|
tick_step = 10 ** max(0, int(math.log10(maximum)))
|
||||||
|
xy = lambda day, n: (left + (right-left)*(date.fromisoformat(day)-begin).days / days,
|
||||||
|
bottom-(bottom-top)*n/maximum)
|
||||||
|
for value in range(0, maximum+1, tick_step):
|
||||||
|
y = xy(points[0]['date'], value)[1]
|
||||||
|
parts.append(f'<path d="M{left} {y:.2f} H{right}" stroke="{t["grid"]}" stroke-dasharray="4 6"/>')
|
||||||
|
parts.append(txt(left-16, round(y+4, 2), f'{value / 1000:g}k' if value >= 1000 else str(value), 12, t['muted'], anchor='end'))
|
||||||
|
dates = sorted({begin + timedelta(days=round((end-begin).days*i/5)) for i in range(6)})
|
||||||
|
ticks = [(d.isoformat(), d.strftime('%b %Y') if days > 90 else d.strftime('%b %d')) for d in dates]
|
||||||
|
for day, label in ticks:
|
||||||
|
x = xy(day, 0)[0]
|
||||||
|
parts.append(f'<path d="M{x:.2f} {top} V{bottom}" stroke="{t["grid"]}" stroke-opacity=".65"/>')
|
||||||
|
anchor = 'start' if day == points[0]['date'] else 'end' if day == snapshot else 'middle'
|
||||||
|
parts.append(txt(round(x, 2), 466, label, 12, t['muted'], anchor=anchor))
|
||||||
|
coords = [xy(p['date'], p['stars']) for p in points]
|
||||||
|
line = 'M' + ' L'.join(f'{x:.2f} {y:.2f}' for x, y in coords)
|
||||||
|
area = line + f' L{coords[-1][0]:.2f} {bottom} L{left} {bottom} Z'
|
||||||
|
parts.extend([
|
||||||
|
f'<path d="{area}" fill="url(#area)"/>',
|
||||||
|
f'<path d="{line}" fill="none" stroke="url(#accent)" stroke-width="3" '
|
||||||
|
'stroke-linecap="round" stroke-linejoin="round"/>',
|
||||||
|
f'<path d="M{left} {bottom} H{right}" stroke="{t["edge"]}"/>',
|
||||||
|
])
|
||||||
|
x, y = coords[-1]
|
||||||
|
parts.extend([
|
||||||
|
f'<circle cx="{x}" cy="{y}" r="10" fill="{t["copper"]}" opacity=".12"/>',
|
||||||
|
f'<circle cx="{x}" cy="{y}" r="5" fill="{t["copper"]}" stroke="{t["bg"]}" stroke-width="2"/>',
|
||||||
|
f'<path d="M40 491 H960" stroke="{t["edge"]}"/>',
|
||||||
|
txt(40, 516, f'{begin:%b %Y} — {end:%b %Y}'.upper(), 10, t['muted'], 500, mono=True, spacing=.7),
|
||||||
|
txt(959, 516, f'SNAPSHOT {snapshot}', 10, t['muted'], 500, 'end', mono=True, spacing=.6),
|
||||||
|
txt(40, 539, provenance, 11, t['muted']),
|
||||||
|
'</svg>',
|
||||||
|
])
|
||||||
|
return ''.join(parts)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
PyYAML==6.0.3
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
# Copyright (c) 2026 Feng Ruohang
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Regression checks for historical accuracy, contributor scope and SVG safety."""
|
||||||
|
|
||||||
|
import base64
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
from urllib.error import URLError
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
import render
|
||||||
|
import update
|
||||||
|
|
||||||
|
NS = {'s': 'http://www.w3.org/2000/svg'}
|
||||||
|
PNG = base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+a7mgAAAAASUVORK5CYII=')
|
||||||
|
|
||||||
|
|
||||||
|
def person(handle='Alice', group='reports', featured=False):
|
||||||
|
return {'handle': handle, 'group': group, 'featured': featured,
|
||||||
|
'what': 'A reviewed contribution', 'firstContribution': '2026-09-01'}
|
||||||
|
|
||||||
|
|
||||||
|
def history():
|
||||||
|
return {'repository': 'pgsty/silo',
|
||||||
|
'bootstrap': {'through': '2026-09-15', 'reconstructed': True},
|
||||||
|
'points': [{'date': '2026-09-14', 'stars': 100}, {'date': '2026-09-15', 'stars': 105}]}
|
||||||
|
|
||||||
|
|
||||||
|
class HistoryTests(unittest.TestCase):
|
||||||
|
def test_new_day_preserves_old_counts_and_unstars(self):
|
||||||
|
before = history()
|
||||||
|
after = update.update_history(before, '2026-09-16', 103)
|
||||||
|
self.assertEqual(after['points'][:-1], before['points'])
|
||||||
|
self.assertEqual(after['points'][-1], {'date': '2026-09-16', 'stars': 103})
|
||||||
|
self.assertEqual(before, history())
|
||||||
|
|
||||||
|
def test_same_day_rerun_replaces_instead_of_appending(self):
|
||||||
|
first = update.update_history(history(), '2026-09-15', 107)
|
||||||
|
self.assertEqual(len(first['points']), 2)
|
||||||
|
self.assertEqual(first, update.update_history(first, '2026-09-15', 107))
|
||||||
|
|
||||||
|
def test_missing_days_are_not_invented(self):
|
||||||
|
result = update.update_history(history(), '2026-09-18', 106)
|
||||||
|
self.assertEqual([p['date'] for p in result['points']], ['2026-09-14', '2026-09-15', '2026-09-18'])
|
||||||
|
|
||||||
|
def test_rejects_wrong_repository_and_corrupt_history(self):
|
||||||
|
cases = []
|
||||||
|
wrong = history(); wrong['repository'] = 'someone/else'; cases.append(wrong)
|
||||||
|
duplicate = history(); duplicate['points'].append(duplicate['points'][-1]); cases.append(duplicate)
|
||||||
|
unordered = history(); unordered['points'].reverse(); cases.append(unordered)
|
||||||
|
negative = history(); negative['points'][0]['stars'] = -1; cases.append(negative)
|
||||||
|
future = history(); future['points'][-1]['date'] = '2026-09-20'; cases.append(future)
|
||||||
|
for case in cases:
|
||||||
|
with self.subTest(case=case), self.assertRaises(ValueError):
|
||||||
|
update.update_history(case, '2026-09-16', 100)
|
||||||
|
|
||||||
|
def test_first_run_has_no_fabricated_history(self):
|
||||||
|
result = update.update_history(None, '2026-09-16', 10)
|
||||||
|
self.assertFalse(result['bootstrap']['reconstructed'])
|
||||||
|
self.assertEqual(result['points'], [{'date': '2026-09-16', 'stars': 10}])
|
||||||
|
|
||||||
|
|
||||||
|
class ContributorTests(unittest.TestCase):
|
||||||
|
def test_retries_truncated_json_before_using_it(self):
|
||||||
|
with patch('update.request', side_effect=[b'{"partial":', b'{"ok":true}']), patch('update.time.sleep'):
|
||||||
|
self.assertEqual(update.GitHub('').get('repos/pgsty/silo'), {'ok': True})
|
||||||
|
|
||||||
|
def test_paginates_past_one_full_page(self):
|
||||||
|
class API(update.GitHub):
|
||||||
|
def __init__(self): self.calls = []
|
||||||
|
def get(self, path):
|
||||||
|
self.calls.append(path)
|
||||||
|
return list(range(100)) if 'page=1&' in path else [100]
|
||||||
|
api = API()
|
||||||
|
self.assertEqual(len(list(api.issues('pgsty/silo'))), 101)
|
||||||
|
self.assertIn('state=all', api.calls[0])
|
||||||
|
self.assertIn('page=2&', api.calls[1])
|
||||||
|
|
||||||
|
def test_bots_deduplication_unmerged_work_and_reviewed_credit(self):
|
||||||
|
def issue(login, kind='issue', user_type='User'):
|
||||||
|
item = {'user': {'login': login, 'type': user_type, 'avatar_url': ''}, 'created_at': '2026-09-02T00:00:00Z'}
|
||||||
|
if kind != 'issue': item['pull_request'] = {'merged_at': None if kind == 'open' else '2026-09-03T00:00:00Z'}
|
||||||
|
return item
|
||||||
|
class API:
|
||||||
|
def issues(self, _repo):
|
||||||
|
return [issue('alice'), issue('Bob', 'open'), issue('Bob', 'merged'),
|
||||||
|
issue('Carol', 'open'), issue('Copilot'), issue('robot', user_type='Bot')]
|
||||||
|
curated = {'repositories': ['pgsty/silo', 'pgsty/mc'], 'bots': ['Copilot'],
|
||||||
|
'people': [person('Alice', featured=True), person('Reporter'), person('Copilot')]}
|
||||||
|
result = update.collect_people(API(), curated)
|
||||||
|
self.assertEqual({p['handle'] for p in result}, {'Alice', 'Bob', 'Carol', 'Reporter'})
|
||||||
|
self.assertEqual(result[0]['handle'], 'Bob')
|
||||||
|
self.assertEqual(result[1]['handle'], 'Carol')
|
||||||
|
self.assertTrue(next(p for p in result if p['handle'] == 'Alice')['featured'])
|
||||||
|
self.assertEqual(next(p for p in result if p['handle'] == 'Bob')['group'], 'code')
|
||||||
|
self.assertFalse(next(p for p in result if p['handle'] == 'Carol')['featured'])
|
||||||
|
|
||||||
|
def test_newer_reviewed_preview_survives_until_site_catches_up(self):
|
||||||
|
remote = {'updated': '2026-09-16T03:00:00+00:00'}
|
||||||
|
cached = {'updated': '2026-09-16T04:00:00+00:00'}
|
||||||
|
self.assertIs(update.select_curated(remote, cached), cached)
|
||||||
|
newer = {'updated': '2026-09-17T03:00:00+00:00'}
|
||||||
|
self.assertIs(update.select_curated(newer, cached), newer)
|
||||||
|
|
||||||
|
def test_avatar_failure_reuses_raster_cache(self):
|
||||||
|
previous = {**person(), 'avatarDataUrl': update.raster_data_url(PNG)}
|
||||||
|
with patch('update.request', side_effect=URLError('unavailable')):
|
||||||
|
result = update.add_avatars(None, [{**person(), 'avatarUrl': 'https://avatars.githubusercontent.com/u/1'}], [previous])
|
||||||
|
self.assertEqual(result[0]['avatarDataUrl'], previous['avatarDataUrl'])
|
||||||
|
with self.assertRaises(ValueError): update.raster_data_url(b'<svg onload="bad()"/>')
|
||||||
|
with self.assertRaises(ValueError): update.cached_avatar({'avatarDataUrl': 'data:image/svg+xml;base64,PHN2Zy8+'})
|
||||||
|
|
||||||
|
def test_fetch_failure_leaves_published_assets_untouched(self):
|
||||||
|
class API:
|
||||||
|
def get(self, path):
|
||||||
|
if path == 'repos/pgsty/silo': return {'full_name': 'pgsty/silo', 'stargazers_count': 106}
|
||||||
|
raise URLError('roster unavailable')
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
out = Path(directory)
|
||||||
|
original = json.dumps(history())
|
||||||
|
(out / 'history.json').write_text(original)
|
||||||
|
(out / 'contributors-light.svg').write_text('previous image')
|
||||||
|
with self.assertRaises(URLError): update.refresh(out, API(), Path('.'))
|
||||||
|
self.assertEqual((out / 'history.json').read_text(), original)
|
||||||
|
self.assertEqual((out / 'contributors-light.svg').read_text(), 'previous image')
|
||||||
|
|
||||||
|
|
||||||
|
class RenderTests(unittest.TestCase):
|
||||||
|
def test_real_emblem_generates_clean_xml(self):
|
||||||
|
emblem = render.read_emblem(Path(__file__).resolve().parents[2] / '.github/silo.svg')
|
||||||
|
svg = render.contributors('light', [person()], '2026-09-16', emblem)
|
||||||
|
ET.fromstring(svg)
|
||||||
|
self.assertTrue(all(line == line.rstrip() for line in svg.splitlines()))
|
||||||
|
|
||||||
|
def test_all_avatars_fit_when_the_roster_grows(self):
|
||||||
|
people = [{**person(f'person-{i}'), 'avatarDataUrl': update.raster_data_url(PNG)} for i in range(151)]
|
||||||
|
for theme in ('light', 'dark'):
|
||||||
|
root = ET.fromstring(render.contributors(theme, people, '2026-09-16', ''))
|
||||||
|
images = root.findall('.//s:image', NS)
|
||||||
|
self.assertEqual(len(images), 151)
|
||||||
|
footer = float(root.attrib['height']) - 42
|
||||||
|
self.assertTrue(all(float(i.attrib['y']) + float(i.attrib['height']) < footer for i in images))
|
||||||
|
self.assertTrue(all(i.attrib['href'].startswith('data:image/png;base64,') for i in images))
|
||||||
|
|
||||||
|
def test_untrusted_text_is_escaped(self):
|
||||||
|
data = [{**person(), 'what': '<script>alert("x")</script> & contributions'}]
|
||||||
|
svg = render.contributors('light', data, '2026-09-16', '')
|
||||||
|
root = ET.fromstring(svg)
|
||||||
|
self.assertEqual(root.findall('.//s:script', NS), [])
|
||||||
|
self.assertIn('<script>', svg)
|
||||||
|
|
||||||
|
def test_single_point_and_decreasing_star_history_render(self):
|
||||||
|
for data in (update.update_history(None, '2026-09-16', 0), update.update_history(history(), '2026-09-16', 90)):
|
||||||
|
for theme in ('light', 'dark'):
|
||||||
|
svg = render.stars(theme, data, '2026-09-16', '')
|
||||||
|
ET.fromstring(svg)
|
||||||
|
self.assertNotIn('nan', svg.lower())
|
||||||
|
self.assertNotIn('inf', svg.lower())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,295 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# Copyright (c) 2026 Feng Ruohang
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""Refresh the generated-asset checkout; publishing is handled by the workflow."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import base64
|
||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
from datetime import date, datetime, timezone
|
||||||
|
import json
|
||||||
|
from http.client import IncompleteRead
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from urllib.error import HTTPError, URLError
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
from urllib.request import Request, urlopen
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
import render
|
||||||
|
|
||||||
|
REPOSITORY = 'pgsty/silo'
|
||||||
|
SOURCE = 'repos/pgsty/silo.pgsty.com/contents/data/home/contributors.yaml?ref=main'
|
||||||
|
GROUPS = ('code', 'proposed', 'reports')
|
||||||
|
HANDLE = re.compile(r'[A-Za-z0-9][A-Za-z0-9-]{0,38}\Z')
|
||||||
|
|
||||||
|
|
||||||
|
def request(url, token='', limit=8 * 1024 * 1024):
|
||||||
|
headers = {'User-Agent': 'silo-repository-cards', 'Accept': 'application/vnd.github+json'}
|
||||||
|
if urlparse(url).netloc == 'api.github.com':
|
||||||
|
headers['X-GitHub-Api-Version'] = '2022-11-28'
|
||||||
|
if token:
|
||||||
|
headers['Authorization'] = f'Bearer {token}'
|
||||||
|
for attempt in range(3):
|
||||||
|
try:
|
||||||
|
with urlopen(Request(url, headers=headers), timeout=25) as response:
|
||||||
|
data = response.read(limit + 1)
|
||||||
|
if len(data) > limit:
|
||||||
|
raise ValueError('Response exceeds the size limit')
|
||||||
|
expected = response.headers.get('Content-Length')
|
||||||
|
if expected is not None and len(data) != int(expected):
|
||||||
|
raise URLError('Incomplete response body')
|
||||||
|
return data
|
||||||
|
except HTTPError as exc:
|
||||||
|
if exc.code < 500 or attempt == 2:
|
||||||
|
raise
|
||||||
|
except (URLError, TimeoutError, IncompleteRead):
|
||||||
|
if attempt == 2:
|
||||||
|
raise
|
||||||
|
time.sleep(attempt + 1)
|
||||||
|
|
||||||
|
|
||||||
|
class GitHub:
|
||||||
|
def __init__(self, token):
|
||||||
|
self.token = token
|
||||||
|
|
||||||
|
def get(self, path):
|
||||||
|
for attempt in range(3):
|
||||||
|
try:
|
||||||
|
return json.loads(request('https://api.github.com/' + path, self.token))
|
||||||
|
except (json.JSONDecodeError, UnicodeDecodeError) as exc:
|
||||||
|
if attempt == 2:
|
||||||
|
raise ValueError(f'Incomplete or invalid GitHub JSON: {path}') from exc
|
||||||
|
time.sleep(attempt + 1)
|
||||||
|
|
||||||
|
def issues(self, repository):
|
||||||
|
page = 1
|
||||||
|
while True:
|
||||||
|
batch = self.get(f'repos/{repository}/issues?state=all&per_page=100&page={page}&sort=created&direction=asc')
|
||||||
|
if not isinstance(batch, list):
|
||||||
|
raise ValueError(f'Invalid issues response for {repository}')
|
||||||
|
yield from batch
|
||||||
|
if len(batch) < 100:
|
||||||
|
return
|
||||||
|
page += 1
|
||||||
|
|
||||||
|
|
||||||
|
def curated_snapshot(data, revision):
|
||||||
|
updated = str(data['updated'])
|
||||||
|
datetime.fromisoformat(updated)
|
||||||
|
repositories = [item['repo'] for item in data['repositories']]
|
||||||
|
if not repositories or any(not re.fullmatch(r'pgsty/[A-Za-z0-9_.-]+', repo) for repo in repositories):
|
||||||
|
raise ValueError('Invalid contributor repository scope')
|
||||||
|
people = []
|
||||||
|
for group in GROUPS:
|
||||||
|
for entry in data[group]:
|
||||||
|
if not HANDLE.fullmatch(entry['handle']):
|
||||||
|
raise ValueError('Invalid GitHub contributor handle')
|
||||||
|
people.append({
|
||||||
|
'handle': entry['handle'], 'group': group,
|
||||||
|
'featured': bool(entry.get('featured')), 'what': entry['what'],
|
||||||
|
'firstContribution': str(entry.get('firstContribution', '9999-12-31')),
|
||||||
|
})
|
||||||
|
if not people or len({p['handle'].lower() for p in people}) != len(people):
|
||||||
|
raise ValueError('Empty or duplicate contributor roster')
|
||||||
|
return {'updated': updated, 'revision': revision, 'repositories': repositories,
|
||||||
|
'bots': data.get('bots', ['Copilot', 'dependabot[bot]']), 'people': people}
|
||||||
|
|
||||||
|
|
||||||
|
def select_curated(remote, cached):
|
||||||
|
# The initial, approved preview can contain reviewed credit not published by
|
||||||
|
# the companion site yet. Keep that newer snapshot until the site catches up.
|
||||||
|
if cached and datetime.fromisoformat(cached['updated']) > datetime.fromisoformat(remote['updated']):
|
||||||
|
return cached
|
||||||
|
return remote
|
||||||
|
|
||||||
|
|
||||||
|
def collect_people(api, curated):
|
||||||
|
bots = {name.lower() for name in curated['bots']}
|
||||||
|
people = {p['handle'].lower(): dict(p) for p in curated['people']
|
||||||
|
if p['handle'].lower() not in bots and not p['handle'].lower().endswith('[bot]')}
|
||||||
|
order = {p['handle'].lower(): index for index, p in enumerate(curated['people'])}
|
||||||
|
for repository in curated['repositories']:
|
||||||
|
print(f'Reading issue and PR authors: {repository}', flush=True)
|
||||||
|
for issue in api.issues(repository):
|
||||||
|
user = issue.get('user') or {}
|
||||||
|
handle = user.get('login', '')
|
||||||
|
key = handle.lower()
|
||||||
|
if user.get('type') != 'User' or key in bots or key.endswith('[bot]'):
|
||||||
|
continue
|
||||||
|
if not HANDLE.fullmatch(handle):
|
||||||
|
raise ValueError('Invalid issue author')
|
||||||
|
pr = issue.get('pull_request')
|
||||||
|
group = 'code' if pr and pr.get('merged_at') else 'proposed' if pr else 'reports'
|
||||||
|
first = issue['created_at'][:10]
|
||||||
|
date.fromisoformat(first)
|
||||||
|
person = people.setdefault(key, {
|
||||||
|
'handle': handle, 'group': group, 'featured': False,
|
||||||
|
'what': 'Contributed an issue or pull request to SILO and related projects',
|
||||||
|
'firstContribution': first,
|
||||||
|
})
|
||||||
|
person['avatarUrl'] = user.get('avatar_url', '')
|
||||||
|
person['firstContribution'] = min(person['firstContribution'], first)
|
||||||
|
if GROUPS.index(group) < GROUPS.index(person['group']):
|
||||||
|
person['group'] = group
|
||||||
|
if not people:
|
||||||
|
raise ValueError('No human contributors were collected')
|
||||||
|
return sorted(people.values(), key=lambda p: (
|
||||||
|
GROUPS.index(p['group']), not p['featured'],
|
||||||
|
order.get(p['handle'].lower(), len(order)), p['firstContribution'], p['handle'].lower()))
|
||||||
|
|
||||||
|
|
||||||
|
def raster_data_url(data):
|
||||||
|
if data.startswith(b'\x89PNG\r\n\x1a\n'):
|
||||||
|
mime = 'image/png'
|
||||||
|
elif data.startswith(b'\xff\xd8\xff'):
|
||||||
|
mime = 'image/jpeg'
|
||||||
|
elif data.startswith((b'GIF87a', b'GIF89a')):
|
||||||
|
mime = 'image/gif'
|
||||||
|
elif data[:4] == b'RIFF' and data[8:12] == b'WEBP':
|
||||||
|
mime = 'image/webp'
|
||||||
|
else:
|
||||||
|
raise ValueError('Avatar is not a raster image')
|
||||||
|
return f'data:{mime};base64,' + base64.b64encode(data).decode('ascii')
|
||||||
|
|
||||||
|
|
||||||
|
def cached_avatar(person):
|
||||||
|
value = person.get('avatarDataUrl', '')
|
||||||
|
if not value:
|
||||||
|
return ''
|
||||||
|
prefix, encoded = value.split(',', 1)
|
||||||
|
if prefix not in ('data:image/png;base64', 'data:image/jpeg;base64', 'data:image/gif;base64', 'data:image/webp;base64'):
|
||||||
|
raise ValueError('Invalid cached avatar format')
|
||||||
|
raw = base64.b64decode(encoded, validate=True)
|
||||||
|
if len(raw) > 512 * 1024 or raster_data_url(raw) != value:
|
||||||
|
raise ValueError('Invalid cached avatar')
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def add_avatars(api, people, previous):
|
||||||
|
cached = {p['handle'].lower(): cached_avatar(p) for p in previous}
|
||||||
|
|
||||||
|
def update(person):
|
||||||
|
person = dict(person)
|
||||||
|
try:
|
||||||
|
url = person.pop('avatarUrl', '') or api.get('users/' + person['handle'])['avatar_url']
|
||||||
|
parsed = urlparse(url)
|
||||||
|
if parsed.scheme != 'https' or parsed.netloc != 'avatars.githubusercontent.com':
|
||||||
|
raise ValueError('Unexpected avatar host')
|
||||||
|
data = request(url + ('&' if '?' in url else '?') + 's=96', limit=512 * 1024)
|
||||||
|
person['avatarDataUrl'] = raster_data_url(data)
|
||||||
|
except (HTTPError, URLError, TimeoutError, IncompleteRead, ValueError, KeyError) as exc:
|
||||||
|
person.pop('avatarUrl', None)
|
||||||
|
person['avatarDataUrl'] = cached.get(person['handle'].lower(), '')
|
||||||
|
print(f'Avatar fallback for @{person["handle"]}: {type(exc).__name__}', file=sys.stderr)
|
||||||
|
return person
|
||||||
|
|
||||||
|
with ThreadPoolExecutor(max_workers=6) as pool:
|
||||||
|
return list(pool.map(update, people))
|
||||||
|
|
||||||
|
|
||||||
|
def update_history(history, day, stars):
|
||||||
|
date.fromisoformat(day)
|
||||||
|
if type(stars) is not int or stars < 0:
|
||||||
|
raise ValueError('Invalid repository star count')
|
||||||
|
if history is None:
|
||||||
|
history = {'repository': REPOSITORY, 'bootstrap': {'through': day, 'reconstructed': False}, 'points': []}
|
||||||
|
if history['repository'] != REPOSITORY:
|
||||||
|
raise ValueError('Star history belongs to a different repository')
|
||||||
|
date.fromisoformat(history['bootstrap']['through'])
|
||||||
|
dates = []
|
||||||
|
for point in history['points']:
|
||||||
|
date.fromisoformat(point['date'])
|
||||||
|
if type(point['stars']) is not int or point['stars'] < 0:
|
||||||
|
raise ValueError('Invalid historical star count')
|
||||||
|
dates.append(point['date'])
|
||||||
|
if dates != sorted(set(dates)) or any(d > day for d in dates):
|
||||||
|
raise ValueError('History contains duplicate, unordered, or future dates')
|
||||||
|
# Replace today's observation, preserve previous days, and allow unstars.
|
||||||
|
points = [dict(p) for p in history['points'] if p['date'] != day]
|
||||||
|
points.append({'date': day, 'stars': stars})
|
||||||
|
return {**history, 'points': points}
|
||||||
|
|
||||||
|
|
||||||
|
def read_json(path, default=None):
|
||||||
|
return json.loads(path.read_text()) if path.exists() else default
|
||||||
|
|
||||||
|
|
||||||
|
def refresh(output, api, source_root):
|
||||||
|
day = datetime.now(timezone.utc).date().isoformat()
|
||||||
|
metadata = api.get('repos/' + REPOSITORY)
|
||||||
|
if metadata['full_name'].lower() != REPOSITORY:
|
||||||
|
raise ValueError('Unexpected repository metadata')
|
||||||
|
history = update_history(read_json(output / 'history.json'), day, metadata['stargazers_count'])
|
||||||
|
source = api.get(SOURCE)
|
||||||
|
reviewed = yaml.safe_load(base64.b64decode(source['content'], validate=False))
|
||||||
|
curated = select_curated(curated_snapshot(reviewed, source['sha']), read_json(output / 'curated.json'))
|
||||||
|
people = collect_people(api, curated)
|
||||||
|
previous = read_json(output / 'contributors.json', {}).get('people', [])
|
||||||
|
people = add_avatars(api, people, previous)
|
||||||
|
emblem = render.read_emblem(source_root / '.github/silo.svg')
|
||||||
|
payloads = {}
|
||||||
|
for theme in ('light', 'dark'):
|
||||||
|
payloads[f'contributors-{theme}.svg'] = render.contributors(theme, people, day, emblem) + '\n'
|
||||||
|
payloads[f'star-history-{theme}.svg'] = render.stars(theme, history, day, emblem) + '\n'
|
||||||
|
for svg in payloads.values():
|
||||||
|
ET.fromstring(svg)
|
||||||
|
for name, data in {
|
||||||
|
'history.json': history,
|
||||||
|
'curated.json': curated,
|
||||||
|
'contributors.json': {'repository': REPOSITORY, 'updated': day, 'people': people},
|
||||||
|
}.items():
|
||||||
|
payloads[name] = json.dumps(data, indent=2, ensure_ascii=False) + '\n'
|
||||||
|
payloads['README.md'] = f'''# SILO repository cards
|
||||||
|
|
||||||
|
Generated by [Repository Cards](https://github.com/pgsty/silo/actions/workflows/repository-cards.yml)
|
||||||
|
at 00:00 UTC daily (08:00 Asia/Shanghai). GitHub may queue scheduled runs.
|
||||||
|
|
||||||
|
Snapshot: {day}. {metadata['stargazers_count']:,} stars; {len(people)} community contributors.
|
||||||
|
|
||||||
|
- `contributors-light.svg` / `contributors-dark.svg`: human issue and PR authors across the SILO project scope, plus reviewed acknowledgements. Bots are excluded. Gold rings follow the reviewed companion-site roster; new authors are collected automatically.
|
||||||
|
- `star-history-light.svg` / `star-history-dark.svg`: initial history reconstructed from the then-current stargazers; later points are daily observed totals, including decreases. Missing days are not fabricated.
|
||||||
|
- `curated.json`: a cache of reviewed contributor credit from `pgsty/silo.pgsty.com/data/home/contributors.yaml`. The approved initial preview may be newer than the published site; a newer reviewed snapshot is retained until the site catches up.
|
||||||
|
- `contributors.json`: generated contributor data and embedded raster avatars. Failed avatar refreshes use the previous image, or an initial when no image is available.
|
||||||
|
- `history.json`: persistent daily totals. Keep this file when regenerating images.
|
||||||
|
|
||||||
|
The SVGs are self-contained. Source and instructions live on the default branch;
|
||||||
|
this branch contains generated assets only. Do not merge it into `main`.
|
||||||
|
'''
|
||||||
|
# Collect and validate everything before touching the publication checkout.
|
||||||
|
output.mkdir(parents=True, exist_ok=True)
|
||||||
|
for filename, text in payloads.items():
|
||||||
|
(output / filename).write_text(text)
|
||||||
|
print(f'{day}: {len(people)} contributors; {metadata["stargazers_count"]:,} stars; {len(history["points"])} history points')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('--output', type=Path, required=True)
|
||||||
|
args = parser.parse_args()
|
||||||
|
configured = os.environ.get('GITHUB_REPOSITORY', REPOSITORY)
|
||||||
|
if configured.lower() != REPOSITORY:
|
||||||
|
raise SystemExit('This workflow is scoped to pgsty/silo')
|
||||||
|
refresh(args.output, GitHub(os.environ.get('GH_TOKEN', '')), Path(__file__).resolve().parents[2])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -18,8 +18,8 @@ function start_silo_5drive() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MC_HOST_silo="http://silo:silo123@127.0.0.1:${start_port}/"
|
export MC_HOST_silo="http://silo:silo1234@127.0.0.1:${start_port}/"
|
||||||
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ function verify_rewrite() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ACCESS_KEY=silo
|
export MINIO_ACCESS_KEY=silo
|
||||||
export MINIO_SECRET_KEY=silo123
|
export MINIO_SECRET_KEY=silo1234
|
||||||
export MC_HOST_silo="http://silo:silo123@127.0.0.1:${start_port}/"
|
export MC_HOST_silo="http://silo:silo1234@127.0.0.1:${start_port}/"
|
||||||
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ function verify_rewrite() {
|
|||||||
-debug \
|
-debug \
|
||||||
-versions \
|
-versions \
|
||||||
-access-key silo \
|
-access-key silo \
|
||||||
-secret-key silo123 \
|
-secret-key silo1234 \
|
||||||
-endpoint "http://127.0.0.1:${start_port}/" 2>&1 | grep INTACT; then
|
-endpoint "http://127.0.0.1:${start_port}/" 2>&1 | grep INTACT; then
|
||||||
echo "server1 log:"
|
echo "server1 log:"
|
||||||
cat "${WORK_DIR}/server1.log"
|
cat "${WORK_DIR}/server1.log"
|
||||||
@@ -105,14 +105,14 @@ function verify_rewrite() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
go run ./buildscripts/heal-manual.go "127.0.0.1:${start_port}" "silo" "silo123"
|
go run ./buildscripts/heal-manual.go "127.0.0.1:${start_port}" "silo" "silo1234"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
if ! ./s3-check-md5 \
|
if ! ./s3-check-md5 \
|
||||||
-debug \
|
-debug \
|
||||||
-versions \
|
-versions \
|
||||||
-access-key silo \
|
-access-key silo \
|
||||||
-secret-key silo123 \
|
-secret-key silo1234 \
|
||||||
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
|
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
|
||||||
echo "server1 log:"
|
echo "server1 log:"
|
||||||
cat "${WORK_DIR}/server1.log"
|
cat "${WORK_DIR}/server1.log"
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ function test_silo_with_timeout() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MC_HOST_silo="http://silo:silo123@127.0.0.1:${start_port}/"
|
export MC_HOST_silo="http://silo:silo1234@127.0.0.1:${start_port}/"
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
mkdir ${WORK_DIR}
|
mkdir ${WORK_DIR}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ WORK_DIR="$PWD/.verify-$RANDOM"
|
|||||||
export MINT_MODE=core
|
export MINT_MODE=core
|
||||||
export MINT_DATA_DIR="$WORK_DIR/data"
|
export MINT_DATA_DIR="$WORK_DIR/data"
|
||||||
export SERVER_ENDPOINT="127.0.0.1:9000"
|
export SERVER_ENDPOINT="127.0.0.1:9000"
|
||||||
export MC_HOST_verify="http://silo:silo123@${SERVER_ENDPOINT}/"
|
export MC_HOST_verify="http://silo:silo1234@${SERVER_ENDPOINT}/"
|
||||||
export MC_HOST_verify_ipv6="http://silo:silo123@[::1]:9000/"
|
export MC_HOST_verify_ipv6="http://silo:silo1234@[::1]:9000/"
|
||||||
export ACCESS_KEY="silo"
|
export ACCESS_KEY="silo"
|
||||||
export SECRET_KEY="silo123"
|
export SECRET_KEY="silo1234"
|
||||||
export ENABLE_HTTPS=0
|
export ENABLE_HTTPS=0
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
export GOGC=25
|
export GOGC=25
|
||||||
@@ -225,7 +225,7 @@ function __init__() {
|
|||||||
shred -n 1 -s 65M - 1>"$FILE_65_MB" 2>/dev/null
|
shred -n 1 -s 65M - 1>"$FILE_65_MB" 2>/dev/null
|
||||||
|
|
||||||
## version is purposefully set to '3' for minio to migrate configuration file
|
## version is purposefully set to '3' for minio to migrate configuration file
|
||||||
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo123"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo1234"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
||||||
|
|
||||||
"$(git rev-parse --show-toplevel)/buildscripts/install-verified-fixture.sh" \
|
"$(git rev-parse --show-toplevel)/buildscripts/install-verified-fixture.sh" \
|
||||||
https://raw.githubusercontent.com/pgsty/mc/4c4dcc4b55baf238cd0c81030d77945b3828f157/functional-tests.sh \
|
https://raw.githubusercontent.com/pgsty/mc/4c4dcc4b55baf238cd0c81030d77945b3828f157/functional-tests.sh \
|
||||||
@@ -282,7 +282,6 @@ function main() {
|
|||||||
purge "$WORK_DIR"
|
purge "$WORK_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
(__init__ "$@" && main "$@")
|
trap 'purge "$WORK_DIR"' EXIT
|
||||||
rv=$?
|
__init__ "$@"
|
||||||
purge "$WORK_DIR"
|
main "$@"
|
||||||
exit "$rv"
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ SILO=("$PWD/silo" --config-dir "$SILO_CONFIG_DIR" server)
|
|||||||
|
|
||||||
function start_silo_3_node() {
|
function start_silo_3_node() {
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MINIO_ERASURE_SET_DRIVE_COUNT=6
|
export MINIO_ERASURE_SET_DRIVE_COUNT=6
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ function start_silo_3_node() {
|
|||||||
pid3=$!
|
pid3=$!
|
||||||
disown $pid3
|
disown $pid3
|
||||||
|
|
||||||
export MC_HOST_mysilo="http://silo:silo123@127.0.0.1:$((start_port + 1))"
|
export MC_HOST_mysilo="http://silo:silo1234@127.0.0.1:$((start_port + 1))"
|
||||||
|
|
||||||
timeout 15m /tmp/mc ready mysilo || fail
|
timeout 15m /tmp/mc ready mysilo || fail
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ function __init__() {
|
|||||||
mkdir -p "$SILO_CONFIG_DIR"
|
mkdir -p "$SILO_CONFIG_DIR"
|
||||||
|
|
||||||
## version is purposefully set to '3' for minio to migrate configuration file
|
## version is purposefully set to '3' for minio to migrate configuration file
|
||||||
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo123"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo1234"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
||||||
|
|
||||||
if [ ! -f /tmp/mc ]; then
|
if [ ! -f /tmp/mc ]; then
|
||||||
"$(git rev-parse --show-toplevel)/buildscripts/install-mcli.sh" /tmp/mc
|
"$(git rev-parse --show-toplevel)/buildscripts/install-mcli.sh" /tmp/mc
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function start_silo() {
|
|||||||
start_port=$1
|
start_port=$1
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
|
||||||
unset MINIO_CI_CD
|
unset MINIO_CI_CD
|
||||||
unset CI
|
unset CI
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function start_silo_3_node() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
export MINIO_ROOT_USER=silo
|
export MINIO_ROOT_USER=silo
|
||||||
export MINIO_ROOT_PASSWORD=silo123
|
export MINIO_ROOT_PASSWORD=silo1234
|
||||||
export MINIO_ERASURE_SET_DRIVE_COUNT=6
|
export MINIO_ERASURE_SET_DRIVE_COUNT=6
|
||||||
export MINIO_CI_CD=1
|
export MINIO_CI_CD=1
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ function start_silo_3_node() {
|
|||||||
pid3=$!
|
pid3=$!
|
||||||
disown $pid3
|
disown $pid3
|
||||||
|
|
||||||
export MC_HOST_mysilo="http://silo:silo123@127.0.0.1:$((start_port + 1))"
|
export MC_HOST_mysilo="http://silo:silo1234@127.0.0.1:$((start_port + 1))"
|
||||||
timeout 15m /tmp/mc ready mysilo || fail
|
timeout 15m /tmp/mc ready mysilo || fail
|
||||||
|
|
||||||
[ ${first_time} -eq 0 ] && upload_objects
|
[ ${first_time} -eq 0 ] && upload_objects
|
||||||
@@ -117,7 +117,7 @@ function __init__() {
|
|||||||
mkdir -p "$SILO_CONFIG_DIR"
|
mkdir -p "$SILO_CONFIG_DIR"
|
||||||
|
|
||||||
## version is purposefully set to '3' for minio to migrate configuration file
|
## version is purposefully set to '3' for minio to migrate configuration file
|
||||||
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo123"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
echo '{"version": "3", "credential": {"accessKey": "silo", "secretKey": "silo1234"}, "region": "us-east-1"}' >"$SILO_CONFIG_DIR/config.json"
|
||||||
|
|
||||||
if [ ! -f /tmp/mc ]; then
|
if [ ! -f /tmp/mc ]; then
|
||||||
"$(git rev-parse --show-toplevel)/buildscripts/install-mcli.sh" /tmp/mc
|
"$(git rev-parse --show-toplevel)/buildscripts/install-mcli.sh" /tmp/mc
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ helm_run template my-release "${new_chart}" \
|
|||||||
go run ./buildscripts/helm-migration-guard "${old_render}" "${new_render}"
|
go run ./buildscripts/helm-migration-guard "${old_render}" "${new_render}"
|
||||||
|
|
||||||
helm_run package "${new_chart}" --destination "${output_dir}" >/dev/null
|
helm_run package "${new_chart}" --destination "${output_dir}" >/dev/null
|
||||||
test -s "${work_dir}/silo-7.0.1.tgz"
|
test -s "${work_dir}/silo-7.0.2.tgz"
|
||||||
if find "${work_dir}" -maxdepth 1 -type f -name 'minio-*.tgz' | grep -q .; then
|
if find "${work_dir}" -maxdepth 1 -type f -name 'minio-*.tgz' | grep -q .; then
|
||||||
echo "Helm packaging emitted a legacy MinIO chart name" >&2
|
echo "Helm packaging emitted a legacy MinIO chart name" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ for file in \
|
|||||||
buildscripts/verify-helm-migration.sh \
|
buildscripts/verify-helm-migration.sh \
|
||||||
Dockerfile.goreleaser \
|
Dockerfile.goreleaser \
|
||||||
Dockerfile.distroless \
|
Dockerfile.distroless \
|
||||||
dockerscripts/download-static-curl.sh \
|
dockerscripts/build-static-curl.sh \
|
||||||
dockerscripts/docker-entrypoint.sh \
|
dockerscripts/docker-entrypoint.sh \
|
||||||
helm/silo/Chart.yaml \
|
helm/silo/Chart.yaml \
|
||||||
helm/silo/values.yaml \
|
helm/silo/values.yaml \
|
||||||
@@ -101,7 +101,7 @@ require_text Dockerfile.goreleaser "Published checksum drift"
|
|||||||
require_text Dockerfile.distroless 'COPY --chmod=0755 silo /usr/bin/silo'
|
require_text Dockerfile.distroless 'COPY --chmod=0755 silo /usr/bin/silo'
|
||||||
require_text Dockerfile.distroless 'ENTRYPOINT ["/usr/bin/silo"]'
|
require_text Dockerfile.distroless 'ENTRYPOINT ["/usr/bin/silo"]'
|
||||||
require_text Dockerfile.distroless '"/usr/bin/silo", "healthcheck", "ready"'
|
require_text Dockerfile.distroless '"/usr/bin/silo", "healthcheck", "ready"'
|
||||||
require_text dockerscripts/download-static-curl.sh "sha256sum -c"
|
require_text dockerscripts/build-static-curl.sh "sha256sum -c"
|
||||||
require_text helm/silo/Chart.yaml "name: silo"
|
require_text helm/silo/Chart.yaml "name: silo"
|
||||||
require_text helm/silo/values.yaml "repository: pgsty/silo"
|
require_text helm/silo/values.yaml "repository: pgsty/silo"
|
||||||
require_text helm/silo/templates/deployment.yaml "/usr/bin/docker-entrypoint.sh silo server"
|
require_text helm/silo/templates/deployment.yaml "/usr/bin/docker-entrypoint.sh silo server"
|
||||||
@@ -159,11 +159,13 @@ fi
|
|||||||
# The repository and its default branch are pgsty/silo and main. The invariant
|
# The repository and its default branch are pgsty/silo and main. The invariant
|
||||||
# is that the old name is never a live target, not that it is never spoken: the
|
# is that the old name is never a live target, not that it is never spoken: the
|
||||||
# READMEs have to name it to explain the rename and to point at the archived
|
# READMEs have to name it to explain the rename and to point at the archived
|
||||||
# artifacts, which is the opposite of stranding a reader on it.
|
# artifacts, which is the opposite of stranding a reader on it. CONTRIBUTORS.md
|
||||||
|
# also quotes historical issue titles.
|
||||||
#
|
#
|
||||||
# So two rules. First, no live URL may resolve to the old repository anywhere,
|
# So two rules. First, no live URL may resolve to the old repository anywhere,
|
||||||
# READMEs included.
|
# READMEs and CONTRIBUTORS.md included.
|
||||||
stale_repo_url="$(rg -n -e 'github\.com/pgsty/minio' -e 'hub\.docker\.com/r/pgsty/minio' \
|
old_repo_pattern='pgsty/minio(\.git)?([^[:alnum:]_.-]|$)'
|
||||||
|
stale_repo_url="$(rg -n -e "github\.com/${old_repo_pattern}" -e "hub\.docker\.com/r/${old_repo_pattern}" \
|
||||||
--glob '!.git/**' --glob '!dist/**' \
|
--glob '!.git/**' --glob '!dist/**' \
|
||||||
--glob '!SILO_REBRANDING_MIGRATION.md' \
|
--glob '!SILO_REBRANDING_MIGRATION.md' \
|
||||||
--glob '!buildscripts/rebrand-guard/compat-baseline.json' . |
|
--glob '!buildscripts/rebrand-guard/compat-baseline.json' . |
|
||||||
@@ -175,10 +177,10 @@ fi
|
|||||||
|
|
||||||
# Second, the bare name may only appear where it is deliberate: the pinned
|
# Second, the bare name may only appear where it is deliberate: the pinned
|
||||||
# pre-rebrand image digest in the upgrade test, the two guards that refuse a
|
# pre-rebrand image digest in the upgrade test, the two guards that refuse a
|
||||||
# legacy image, and the two READMEs that document the rename and the archived
|
# legacy image, the two READMEs that document the rename and the archived
|
||||||
# minio branch.
|
# minio branch, and historical issue titles in CONTRIBUTORS.md.
|
||||||
repo_guard_allowlist='^(buildscripts/minio-upgrade\.sh|buildscripts/verify-rebrand\.sh|buildscripts/helm-migration-guard/main\.go|README\.md|README_ZH\.md):'
|
repo_guard_allowlist='^(buildscripts/minio-upgrade\.sh|buildscripts/verify-rebrand\.sh|buildscripts/helm-migration-guard/main\.go|README\.md|README_ZH\.md|CONTRIBUTORS\.md):'
|
||||||
stale_repo="$(rg -n 'pgsty/minio' --glob '!.git/**' --glob '!dist/**' \
|
stale_repo="$(rg -n "${old_repo_pattern}" --glob '!.git/**' --glob '!dist/**' \
|
||||||
--glob '!SILO_REBRANDING_MIGRATION.md' \
|
--glob '!SILO_REBRANDING_MIGRATION.md' \
|
||||||
--glob '!buildscripts/rebrand-guard/compat-baseline.json' . |
|
--glob '!buildscripts/rebrand-guard/compat-baseline.json' . |
|
||||||
sed 's#^\./##' | grep -Ev "${repo_guard_allowlist}" || true)"
|
sed 's#^\./##' | grep -Ev "${repo_guard_allowlist}" || true)"
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ import (
|
|||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Data types used for returning dummy access control
|
// Data types used for returning dummy access control
|
||||||
|
|||||||
@@ -0,0 +1,348 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/madmin-go/v3"
|
||||||
|
"github.com/minio/minio/internal/auth"
|
||||||
|
"github.com/minio/mux"
|
||||||
|
)
|
||||||
|
|
||||||
|
func corsAdminRequest(t *testing.T, cred auth.Credentials, method, path string, body []byte) *httptest.ResponseRecorder {
|
||||||
|
t.Helper()
|
||||||
|
router := mux.NewRouter()
|
||||||
|
registerAdminRouter(router, true)
|
||||||
|
req, err := newTestSignedRequestV4(method, adminPathPrefix+adminAPIVersionPrefix+path,
|
||||||
|
int64(len(body)), bytes.NewReader(body), cred.AccessKey, cred.SecretKey, nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
router.ServeHTTP(rec, req)
|
||||||
|
if rec.Code != http.StatusOK {
|
||||||
|
t.Fatalf("admin %s: %d: %s", path, rec.Code, rec.Body.String())
|
||||||
|
}
|
||||||
|
return rec
|
||||||
|
}
|
||||||
|
|
||||||
|
func corsImportReport(t *testing.T, rec *httptest.ResponseRecorder) madmin.BucketMetaImportErrs {
|
||||||
|
t.Helper()
|
||||||
|
var rpt madmin.BucketMetaImportErrs
|
||||||
|
if err := json.Unmarshal(rec.Body.Bytes(), &rpt); err != nil {
|
||||||
|
t.Fatalf("import report %q: %v", rec.Body.String(), err)
|
||||||
|
}
|
||||||
|
return rpt
|
||||||
|
}
|
||||||
|
|
||||||
|
func corsZip(t *testing.T, entries map[string][]byte) []byte {
|
||||||
|
t.Helper()
|
||||||
|
var buf bytes.Buffer
|
||||||
|
zw := zip.NewWriter(&buf)
|
||||||
|
for name, data := range entries {
|
||||||
|
w, err := zw.Create(name)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = w.Write(data); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := zw.Close(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return buf.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
// corsCorruptedZip builds an archive holding a stored (uncompressed) cors.xml
|
||||||
|
// whose payload is altered after the checksum is computed, plus the given
|
||||||
|
// companion entries. The altered document stays well formed, so only the zip
|
||||||
|
// checksum tells the two apart.
|
||||||
|
func corsCorruptedZip(t *testing.T, name string, doc []byte, others map[string][]byte) []byte {
|
||||||
|
t.Helper()
|
||||||
|
var buf bytes.Buffer
|
||||||
|
zw := zip.NewWriter(&buf)
|
||||||
|
w, err := zw.CreateHeader(&zip.FileHeader{Name: name, Method: zip.Store})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = w.Write(doc); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for other, data := range others {
|
||||||
|
ow, err := zw.Create(other)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err = ow.Write(data); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err = zw.Close(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
raw := buf.Bytes()
|
||||||
|
at := bytes.Index(raw, []byte("app.example.com"))
|
||||||
|
if at < 0 {
|
||||||
|
t.Fatalf("stored CORS payload not found in archive")
|
||||||
|
}
|
||||||
|
raw[at] = 'A'
|
||||||
|
return raw
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestAdminBucketMetadataCORSRoundTrip covers the export/import round trip for
|
||||||
|
// per-bucket CORS, per-file error reporting for an invalid document, and that
|
||||||
|
// an archive without cors.xml leaves an existing configuration alone.
|
||||||
|
func TestAdminBucketMetadataCORSRoundTrip(t *testing.T) {
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{t: t, objAPITest: func(obj ObjectLayer, instanceType, bucket string, _ http.Handler, cred auth.Credentials, t *testing.T) {
|
||||||
|
corsXML := []byte(testSiteReplicationCORSDoc)
|
||||||
|
if _, err := updateLocalBucketCORSMetadata(t.Context(), obj, bucket, corsXML); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export must carry the stored document verbatim.
|
||||||
|
rec := corsAdminRequest(t, cred, http.MethodGet, "/export-bucket-metadata?bucket="+bucket, nil)
|
||||||
|
archive := rec.Body.Bytes()
|
||||||
|
zr, err := zip.NewReader(bytes.NewReader(archive), int64(len(archive)))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var exported []byte
|
||||||
|
for _, f := range zr.File {
|
||||||
|
if f.Name != bucket+"/"+bucketCorsConfig {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
r, err := f.Open()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
exported, err = io.ReadAll(r)
|
||||||
|
r.Close()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bytes.Equal(exported, corsXML) {
|
||||||
|
t.Fatalf("%s: exported CORS = %q, want %q", instanceType, exported, corsXML)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop the configuration: the archive must then omit the entry.
|
||||||
|
if _, err = updateLocalBucketCORSMetadata(t.Context(), obj, bucket, nil); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, _, err = globalBucketMetadataSys.GetCorsConfigXML(bucket); err == nil {
|
||||||
|
t.Fatalf("%s: CORS still present before restore", instanceType)
|
||||||
|
}
|
||||||
|
rec = corsAdminRequest(t, cred, http.MethodGet, "/export-bucket-metadata?bucket="+bucket, nil)
|
||||||
|
empty := rec.Body.Bytes()
|
||||||
|
zr, err = zip.NewReader(bytes.NewReader(empty), int64(len(empty)))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, f := range zr.File {
|
||||||
|
if f.Name == bucket+"/"+bucketCorsConfig {
|
||||||
|
t.Fatalf("%s: export emitted %s for a bucket without CORS", instanceType, f.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rec = corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata", archive)
|
||||||
|
if st := corsImportReport(t, rec).Buckets[bucket]; !st.Cors.IsSet || st.Cors.Err != "" {
|
||||||
|
t.Fatalf("%s: import report cors = %+v", instanceType, st.Cors)
|
||||||
|
}
|
||||||
|
stored, storedAt, err := globalBucketMetadataSys.GetCorsConfigXML(bucket)
|
||||||
|
if err != nil || !bytes.Equal(stored, corsXML) {
|
||||||
|
t.Fatalf("%s: restored CORS = %q, err = %v", instanceType, stored, err)
|
||||||
|
}
|
||||||
|
created, err := globalBucketMetadataSys.CreatedAt(bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !storedAt.After(created) {
|
||||||
|
t.Fatalf("%s: restored CORS timestamp %v is not after bucket creation %v", instanceType, storedAt, created)
|
||||||
|
}
|
||||||
|
|
||||||
|
// An archive without cors.xml must not remove the configuration.
|
||||||
|
corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata",
|
||||||
|
corsZip(t, map[string][]byte{bucket + "/quota.json": []byte(`{"quota":0}`)}))
|
||||||
|
if stored, _, err = globalBucketMetadataSys.GetCorsConfigXML(bucket); err != nil || !bytes.Equal(stored, corsXML) {
|
||||||
|
t.Fatalf("%s: import without cors.xml changed CORS: %q, err = %v", instanceType, stored, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A bucket the import itself creates must still land above its own
|
||||||
|
// creation time, otherwise CORS replication would drop the restore.
|
||||||
|
fresh := "cors-import-created-bucket"
|
||||||
|
rec = corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata",
|
||||||
|
corsZip(t, map[string][]byte{fresh + "/" + bucketCorsConfig: corsXML}))
|
||||||
|
if st := corsImportReport(t, rec).Buckets[fresh]; !st.Cors.IsSet || st.Cors.Err != "" {
|
||||||
|
t.Fatalf("%s: fresh bucket import report cors = %+v", instanceType, st.Cors)
|
||||||
|
}
|
||||||
|
freshStored, freshAt, err := globalBucketMetadataSys.GetCorsConfigXML(fresh)
|
||||||
|
if err != nil || !bytes.Equal(freshStored, corsXML) {
|
||||||
|
t.Fatalf("%s: fresh bucket CORS = %q, err = %v", instanceType, freshStored, err)
|
||||||
|
}
|
||||||
|
freshCreated, err := globalBucketMetadataSys.CreatedAt(fresh)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !freshAt.After(freshCreated) {
|
||||||
|
t.Fatalf("%s: fresh bucket CORS timestamp %v is not after creation %v", instanceType, freshAt, freshCreated)
|
||||||
|
}
|
||||||
|
|
||||||
|
// An invalid document must fail loudly for that bucket and change nothing.
|
||||||
|
rec = corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata",
|
||||||
|
corsZip(t, map[string][]byte{bucket + "/" + bucketCorsConfig: []byte("<CORSConfiguration><CORSRule>")}))
|
||||||
|
if st := corsImportReport(t, rec).Buckets[bucket]; st.Cors.Err == "" {
|
||||||
|
t.Fatalf("%s: invalid CORS import reported no error: %+v", instanceType, st)
|
||||||
|
}
|
||||||
|
if stored, _, err = globalBucketMetadataSys.GetCorsConfigXML(bucket); err != nil || !bytes.Equal(stored, corsXML) {
|
||||||
|
t.Fatalf("%s: invalid CORS import changed stored config: %q, err = %v", instanceType, stored, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A well formed document carried by a corrupt zip entry must be
|
||||||
|
// rejected too, leaving the stored document and its timestamp alone
|
||||||
|
// while the other configs in the same archive still apply.
|
||||||
|
_, corsAt, err := globalBucketMetadataSys.GetCorsConfigXML(bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
rec = corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata",
|
||||||
|
corsCorruptedZip(t, bucket+"/"+bucketCorsConfig, corsXML,
|
||||||
|
map[string][]byte{bucket + "/quota.json": []byte(`{"quota":4096,"quotatype":"hard"}`)}))
|
||||||
|
st := corsImportReport(t, rec).Buckets[bucket]
|
||||||
|
if st.Cors.Err == "" {
|
||||||
|
t.Fatalf("%s: corrupt CORS entry reported no error: %+v", instanceType, st)
|
||||||
|
}
|
||||||
|
if !st.Quota.IsSet || st.Quota.Err != "" {
|
||||||
|
t.Fatalf("%s: corrupt CORS entry blocked the neighboring quota: %+v", instanceType, st.Quota)
|
||||||
|
}
|
||||||
|
stored, storedAt, err = globalBucketMetadataSys.GetCorsConfigXML(bucket)
|
||||||
|
if err != nil || !bytes.Equal(stored, corsXML) || !storedAt.Equal(corsAt) {
|
||||||
|
t.Fatalf("%s: corrupt CORS entry changed stored config: %q at %v (was %v), err = %v", instanceType, stored, storedAt, corsAt, err)
|
||||||
|
}
|
||||||
|
quota, _, err := globalBucketMetadataSys.GetQuotaConfig(t.Context(), bucket)
|
||||||
|
if err != nil || quota == nil || quota.Quota != 4096 {
|
||||||
|
t.Fatalf("%s: neighboring quota not applied: %+v, err = %v", instanceType, quota, err)
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
|
||||||
|
// corsPeerStub is a stand-in site-replication peer. It records every
|
||||||
|
// SRBucketMeta it is asked to apply and answers with status.
|
||||||
|
func corsPeerStub(t *testing.T, applied chan<- madmin.SRBucketMeta, status int) *httptest.Server {
|
||||||
|
t.Helper()
|
||||||
|
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method == http.MethodPut && applied != nil {
|
||||||
|
var item madmin.SRBucketMeta
|
||||||
|
if err := json.NewDecoder(r.Body).Decode(&item); err != nil {
|
||||||
|
t.Errorf("decode peer apply: %v", err)
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
applied <- item
|
||||||
|
}
|
||||||
|
w.WriteHeader(status)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestAdminBucketMetadataCORSImportReplicatesPastPeerFailure pins that an
|
||||||
|
// imported CORS document reaches the reachable peers even when the shared
|
||||||
|
// bucket metadata hook failed against an unreachable one, and that both
|
||||||
|
// failures are still reported for the bucket.
|
||||||
|
func TestAdminBucketMetadataCORSImportReplicatesPastPeerFailure(t *testing.T) {
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{t: t, objAPITest: func(obj ObjectLayer, instanceType, bucket string, _ http.Handler, cred auth.Credentials, t *testing.T) {
|
||||||
|
ctx := t.Context()
|
||||||
|
corsXML := []byte(testSiteReplicationCORSDoc)
|
||||||
|
|
||||||
|
healthyApplies := make(chan madmin.SRBucketMeta, 4)
|
||||||
|
healthy := corsPeerStub(t, healthyApplies, http.StatusOK)
|
||||||
|
defer healthy.Close()
|
||||||
|
broken := corsPeerStub(t, nil, http.StatusBadRequest)
|
||||||
|
defer broken.Close()
|
||||||
|
|
||||||
|
// With site replication on, admin requests resolve their token signing
|
||||||
|
// key through the site replicator account, so it has to exist.
|
||||||
|
serviceCred, err := auth.CreateCredentials(siteReplicatorSvcAcc, "cors-import-service-secret")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
serviceCred.ParentUser = cred.AccessKey
|
||||||
|
if _, err = globalIAMSys.store.AddServiceAccount(ctx, serviceCred); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer globalIAMSys.DeleteServiceAccount(ctx, serviceCred.AccessKey, false)
|
||||||
|
globalSiteReplicatorCred.Set(serviceCred.SecretKey)
|
||||||
|
defer globalSiteReplicatorCred.Set("")
|
||||||
|
|
||||||
|
globalSiteReplicationSys.Lock()
|
||||||
|
oldEnabled, oldState := globalSiteReplicationSys.enabled, globalSiteReplicationSys.state
|
||||||
|
globalSiteReplicationSys.enabled = true
|
||||||
|
globalSiteReplicationSys.state = srState{
|
||||||
|
Name: "cors-import-test",
|
||||||
|
ServiceAccountAccessKey: serviceCred.AccessKey,
|
||||||
|
Peers: map[string]madmin.PeerInfo{
|
||||||
|
globalDeploymentID(): {Name: "local", DeploymentID: globalDeploymentID()},
|
||||||
|
"peer-healthy": {Name: "healthy", DeploymentID: "peer-healthy", Endpoint: healthy.URL},
|
||||||
|
"peer-broken": {Name: "broken", DeploymentID: "peer-broken", Endpoint: broken.URL},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
globalSiteReplicationSys.Unlock()
|
||||||
|
defer func() {
|
||||||
|
globalSiteReplicationSys.Lock()
|
||||||
|
globalSiteReplicationSys.enabled, globalSiteReplicationSys.state = oldEnabled, oldState
|
||||||
|
globalSiteReplicationSys.Unlock()
|
||||||
|
}()
|
||||||
|
|
||||||
|
rec := corsAdminRequest(t, cred, http.MethodPut, "/import-bucket-metadata",
|
||||||
|
corsZip(t, map[string][]byte{
|
||||||
|
bucket + "/" + bucketCorsConfig: corsXML,
|
||||||
|
bucket + "/quota.json": []byte(`{"quota":8192,"quotatype":"hard"}`),
|
||||||
|
}))
|
||||||
|
st := corsImportReport(t, rec).Buckets[bucket]
|
||||||
|
if !st.Cors.IsSet || st.Cors.Err != "" {
|
||||||
|
t.Fatalf("%s: import report cors = %+v", instanceType, st.Cors)
|
||||||
|
}
|
||||||
|
stored, storedAt, err := globalBucketMetadataSys.GetCorsConfigXML(bucket)
|
||||||
|
if err != nil || !bytes.Equal(stored, corsXML) {
|
||||||
|
t.Fatalf("%s: stored CORS = %q, err = %v", instanceType, stored, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The reachable peer must have been told about the CORS document,
|
||||||
|
// carrying exactly the timestamp that was saved locally.
|
||||||
|
var corsSeen, sharedSeen bool
|
||||||
|
for range 2 {
|
||||||
|
select {
|
||||||
|
case item := <-healthyApplies:
|
||||||
|
if item.Type != madmin.SRBucketMetaTypeCorsConfig {
|
||||||
|
sharedSeen = item.Bucket == bucket && item.Quota != nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if item.Bucket != bucket || item.Cors == nil || !item.UpdatedAt.Equal(storedAt) {
|
||||||
|
t.Fatalf("%s: peer CORS event = %#v, want %s at %v", instanceType, item, bucket, storedAt)
|
||||||
|
}
|
||||||
|
payload, decErr := base64.StdEncoding.Strict().DecodeString(*item.Cors)
|
||||||
|
if decErr != nil || !bytes.Equal(payload, corsXML) {
|
||||||
|
t.Fatalf("%s: peer CORS payload = %q, err = %v", instanceType, payload, decErr)
|
||||||
|
}
|
||||||
|
corsSeen = true
|
||||||
|
case <-time.After(10 * time.Second):
|
||||||
|
t.Fatalf("%s: healthy peer received no further events (shared=%v cors=%v)", instanceType, sharedSeen, corsSeen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !sharedSeen || !corsSeen {
|
||||||
|
t.Fatalf("%s: healthy peer events shared=%v cors=%v, want both", instanceType, sharedSeen, corsSeen)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both hook failures against the unreachable peer stay reported.
|
||||||
|
if got := strings.Count(st.Err, "->broken:"); got != 2 {
|
||||||
|
t.Fatalf("%s: bucket error mentions the broken peer %d times, want 2: %q", instanceType, got, st.Err)
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
}
|
||||||
+205
-19
@@ -41,7 +41,7 @@ import (
|
|||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -76,7 +76,7 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
quotaConfig, err := parseBucketQuota(bucket, data)
|
_, err = parseBucketQuota(bucket, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
return
|
return
|
||||||
@@ -94,9 +94,6 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *
|
|||||||
Quota: data,
|
Quota: data,
|
||||||
UpdatedAt: updatedAt,
|
UpdatedAt: updatedAt,
|
||||||
}
|
}
|
||||||
if quotaConfig.Size == 0 && quotaConfig.Quota == 0 {
|
|
||||||
bucketMeta.Quota = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call site replication hook.
|
// Call site replication hook.
|
||||||
replLogIf(ctx, globalSiteReplicationSys.BucketMetaHook(ctx, bucketMeta))
|
replLogIf(ctx, globalSiteReplicationSys.BucketMetaHook(ctx, bucketMeta))
|
||||||
@@ -417,6 +414,7 @@ func (a adminAPIHandlers) ExportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
bucketLifecycleConfig,
|
bucketLifecycleConfig,
|
||||||
bucketSSEConfig,
|
bucketSSEConfig,
|
||||||
bucketTaggingConfig,
|
bucketTaggingConfig,
|
||||||
|
bucketCorsConfig,
|
||||||
bucketQuotaConfigFile,
|
bucketQuotaConfigFile,
|
||||||
objectLockConfig,
|
objectLockConfig,
|
||||||
bucketVersioningConfig,
|
bucketVersioningConfig,
|
||||||
@@ -437,7 +435,7 @@ func (a adminAPIHandlers) ExportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
writeErrorResponse(ctx, w, exportError(ctx, err, cfgFile, bucket), r.URL)
|
writeErrorResponse(ctx, w, exportError(ctx, err, cfgFile, bucket), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
configData, err := json.Marshal(config)
|
configData, err := canonicalBucketPolicy(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, exportError(ctx, err, cfgFile, bucket), r.URL)
|
writeErrorResponse(ctx, w, exportError(ctx, err, cfgFile, bucket), r.URL)
|
||||||
return
|
return
|
||||||
@@ -517,6 +515,19 @@ func (a adminAPIHandlers) ExportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
rawDataFn(bytes.NewReader(configData), cfgPath, len(configData))
|
rawDataFn(bytes.NewReader(configData), cfgPath, len(configData))
|
||||||
|
case bucketCorsConfig:
|
||||||
|
// Export the stored document verbatim: GetBucketCors returns
|
||||||
|
// the bytes exactly as they were PUT, so the archive must
|
||||||
|
// round-trip them unchanged.
|
||||||
|
configData, _, err := globalBucketMetadataSys.GetCorsConfigXML(bucket)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, errConfigNotFound) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
writeErrorResponse(ctx, w, exportError(ctx, err, cfgFile, bucket), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rawDataFn(bytes.NewReader(configData), cfgPath, len(configData))
|
||||||
case objectLockConfig:
|
case objectLockConfig:
|
||||||
config, _, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)
|
config, _, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -589,6 +600,50 @@ type importMetaReport struct {
|
|||||||
madmin.BucketMetaImportErrs
|
madmin.BucketMetaImportErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type importMetadataFields map[string]struct{}
|
||||||
|
|
||||||
|
func (f importMetadataFields) add(configFile string) {
|
||||||
|
f[configFile] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func applyImportedBucketMetadata(dst *BucketMetadata, src BucketMetadata, fields importMetadataFields) {
|
||||||
|
for configFile := range fields {
|
||||||
|
switch configFile {
|
||||||
|
case bucketPolicyConfig:
|
||||||
|
dst.PolicyConfigJSON = bytes.Clone(src.PolicyConfigJSON)
|
||||||
|
dst.PolicyConfigUpdatedAt = src.PolicyConfigUpdatedAt
|
||||||
|
case bucketNotificationConfig:
|
||||||
|
dst.NotificationConfigXML = bytes.Clone(src.NotificationConfigXML)
|
||||||
|
dst.NotificationConfigUpdatedAt = src.NotificationConfigUpdatedAt
|
||||||
|
case bucketLifecycleConfig:
|
||||||
|
dst.LifecycleConfigXML = bytes.Clone(src.LifecycleConfigXML)
|
||||||
|
dst.LifecycleConfigUpdatedAt = src.LifecycleConfigUpdatedAt
|
||||||
|
case bucketSSEConfig:
|
||||||
|
dst.EncryptionConfigXML = bytes.Clone(src.EncryptionConfigXML)
|
||||||
|
dst.EncryptionConfigUpdatedAt = src.EncryptionConfigUpdatedAt
|
||||||
|
case bucketTaggingConfig:
|
||||||
|
dst.TaggingConfigXML = bytes.Clone(src.TaggingConfigXML)
|
||||||
|
dst.TaggingConfigUpdatedAt = src.TaggingConfigUpdatedAt
|
||||||
|
case bucketQuotaConfigFile:
|
||||||
|
dst.QuotaConfigJSON = bytes.Clone(src.QuotaConfigJSON)
|
||||||
|
dst.QuotaConfigUpdatedAt = src.QuotaConfigUpdatedAt
|
||||||
|
case bucketCorsConfig:
|
||||||
|
// The import stamps its fields before creating any missing bucket,
|
||||||
|
// and a CORS event stamped before bucket creation is discarded as
|
||||||
|
// belonging to an older incarnation, so the imported document takes
|
||||||
|
// the same monotonic timestamp a local PutBucketCors would assign.
|
||||||
|
dst.CorsConfigUpdatedAt = localCORSUpdatedAt(*dst, src.CorsConfigUpdatedAt)
|
||||||
|
dst.CorsConfigXML = bytes.Clone(src.CorsConfigXML)
|
||||||
|
case objectLockConfig:
|
||||||
|
dst.ObjectLockConfigXML = bytes.Clone(src.ObjectLockConfigXML)
|
||||||
|
dst.ObjectLockConfigUpdatedAt = src.ObjectLockConfigUpdatedAt
|
||||||
|
case bucketVersioningConfig:
|
||||||
|
dst.VersioningConfigXML = bytes.Clone(src.VersioningConfigXML)
|
||||||
|
dst.VersioningConfigUpdatedAt = src.VersioningConfigUpdatedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (i *importMetaReport) SetStatus(bucket, fname string, err error) {
|
func (i *importMetaReport) SetStatus(bucket, fname string, err error) {
|
||||||
st := i.Buckets[bucket]
|
st := i.Buckets[bucket]
|
||||||
var errMsg string
|
var errMsg string
|
||||||
@@ -608,6 +663,8 @@ func (i *importMetaReport) SetStatus(bucket, fname string, err error) {
|
|||||||
st.Tagging = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
st.Tagging = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
||||||
case bucketQuotaConfigFile:
|
case bucketQuotaConfigFile:
|
||||||
st.Quota = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
st.Quota = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
||||||
|
case bucketCorsConfig:
|
||||||
|
st.Cors = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
||||||
case objectLockConfig:
|
case objectLockConfig:
|
||||||
st.ObjectLock = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
st.ObjectLock = madmin.MetaStatus{IsSet: true, Err: errMsg}
|
||||||
case bucketVersioningConfig:
|
case bucketVersioningConfig:
|
||||||
@@ -649,6 +706,16 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
}
|
}
|
||||||
|
|
||||||
bucketMap := make(map[string]*BucketMetadata, len(zr.File))
|
bucketMap := make(map[string]*BucketMetadata, len(zr.File))
|
||||||
|
importedFields := make(map[string]importMetadataFields, len(zr.File))
|
||||||
|
blockedBuckets := make(map[string]struct{})
|
||||||
|
markImported := func(bucket, configFile string) {
|
||||||
|
fields := importedFields[bucket]
|
||||||
|
if fields == nil {
|
||||||
|
fields = make(importMetadataFields)
|
||||||
|
importedFields[bucket] = fields
|
||||||
|
}
|
||||||
|
fields.add(configFile)
|
||||||
|
}
|
||||||
|
|
||||||
updatedAt := UTCNow()
|
updatedAt := UTCNow()
|
||||||
|
|
||||||
@@ -664,6 +731,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
bucketMap[bucket] = &meta
|
bucketMap[bucket] = &meta
|
||||||
} else if err != errConfigNotFound {
|
} else if err != errConfigNotFound {
|
||||||
rpt.SetStatus(bucket, "", err)
|
rpt.SetStatus(bucket, "", err)
|
||||||
|
blockedBuckets[bucket] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,6 +743,9 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bucket, fileName := slc[0], slc[1]
|
bucket, fileName := slc[0], slc[1]
|
||||||
|
if _, blocked := blockedBuckets[bucket]; blocked {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if fileName == objectLockConfig {
|
if fileName == objectLockConfig {
|
||||||
reader, err := file.Open()
|
reader, err := file.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -708,6 +779,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].ObjectLockConfigXML = configData
|
bucketMap[bucket].ObjectLockConfigXML = configData
|
||||||
bucketMap[bucket].ObjectLockConfigUpdatedAt = updatedAt
|
bucketMap[bucket].ObjectLockConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -720,6 +792,9 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bucket, fileName := slc[0], slc[1]
|
bucket, fileName := slc[0], slc[1]
|
||||||
|
if _, blocked := blockedBuckets[bucket]; blocked {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if fileName == bucketVersioningConfig {
|
if fileName == bucketVersioningConfig {
|
||||||
reader, err := file.Open()
|
reader, err := file.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -764,6 +839,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].VersioningConfigXML = configData
|
bucketMap[bucket].VersioningConfigXML = configData
|
||||||
bucketMap[bucket].VersioningConfigUpdatedAt = updatedAt
|
bucketMap[bucket].VersioningConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -781,6 +857,9 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
bucket, fileName := slc[0], slc[1]
|
bucket, fileName := slc[0], slc[1]
|
||||||
|
if _, blocked := blockedBuckets[bucket]; blocked {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// create bucket if it does not exist yet.
|
// create bucket if it does not exist yet.
|
||||||
if _, ok := bucketMap[bucket]; !ok {
|
if _, ok := bucketMap[bucket]; !ok {
|
||||||
@@ -813,6 +892,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].NotificationConfigXML = configData
|
bucketMap[bucket].NotificationConfigXML = configData
|
||||||
bucketMap[bucket].NotificationConfigUpdatedAt = updatedAt
|
bucketMap[bucket].NotificationConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
case bucketPolicyConfig:
|
case bucketPolicyConfig:
|
||||||
// Error out if Content-Length is beyond allowed size.
|
// Error out if Content-Length is beyond allowed size.
|
||||||
@@ -839,7 +919,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
configData, err := json.Marshal(bucketPolicy)
|
configData, err := canonicalBucketPolicy(bucketPolicy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rpt.SetStatus(bucket, fileName, err)
|
rpt.SetStatus(bucket, fileName, err)
|
||||||
continue
|
continue
|
||||||
@@ -847,6 +927,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].PolicyConfigJSON = configData
|
bucketMap[bucket].PolicyConfigJSON = configData
|
||||||
bucketMap[bucket].PolicyConfigUpdatedAt = updatedAt
|
bucketMap[bucket].PolicyConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
case bucketLifecycleConfig:
|
case bucketLifecycleConfig:
|
||||||
bucketLifecycle, err := lifecycle.ParseLifecycleConfig(io.LimitReader(reader, sz))
|
bucketLifecycle, err := lifecycle.ParseLifecycleConfig(io.LimitReader(reader, sz))
|
||||||
@@ -879,6 +960,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].LifecycleConfigXML = configData
|
bucketMap[bucket].LifecycleConfigXML = configData
|
||||||
bucketMap[bucket].LifecycleConfigUpdatedAt = updatedAt
|
bucketMap[bucket].LifecycleConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
case bucketSSEConfig:
|
case bucketSSEConfig:
|
||||||
// Parse bucket encryption xml
|
// Parse bucket encryption xml
|
||||||
@@ -917,6 +999,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].EncryptionConfigXML = configData
|
bucketMap[bucket].EncryptionConfigXML = configData
|
||||||
bucketMap[bucket].EncryptionConfigUpdatedAt = updatedAt
|
bucketMap[bucket].EncryptionConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
case bucketTaggingConfig:
|
case bucketTaggingConfig:
|
||||||
tags, err := tags.ParseBucketXML(io.LimitReader(reader, sz))
|
tags, err := tags.ParseBucketXML(io.LimitReader(reader, sz))
|
||||||
@@ -933,6 +1016,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].TaggingConfigXML = configData
|
bucketMap[bucket].TaggingConfigXML = configData
|
||||||
bucketMap[bucket].TaggingConfigUpdatedAt = updatedAt
|
bucketMap[bucket].TaggingConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
case bucketQuotaConfigFile:
|
case bucketQuotaConfigFile:
|
||||||
data, err := io.ReadAll(reader)
|
data, err := io.ReadAll(reader)
|
||||||
@@ -949,6 +1033,33 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
|
|
||||||
bucketMap[bucket].QuotaConfigJSON = data
|
bucketMap[bucket].QuotaConfigJSON = data
|
||||||
bucketMap[bucket].QuotaConfigUpdatedAt = updatedAt
|
bucketMap[bucket].QuotaConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
|
case bucketCorsConfig:
|
||||||
|
if sz > maxBucketCorsSize {
|
||||||
|
rpt.SetStatus(bucket, fileName, errors.New(ErrEntityTooLarge.String()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read one byte past the declared size: stopping exactly at sz
|
||||||
|
// leaves archive/zip short of EOF, so it never verifies the entry
|
||||||
|
// checksum and a corrupt entry carrying well formed XML would be
|
||||||
|
// stored as a valid document. The extra byte also lets the reader
|
||||||
|
// reject an entry longer than it declares.
|
||||||
|
corsData, err := io.ReadAll(io.LimitReader(reader, sz+1))
|
||||||
|
if err != nil {
|
||||||
|
rpt.SetStatus(bucket, fileName, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = validateCORSReplicationPayload(corsData); err != nil {
|
||||||
|
rpt.SetStatus(bucket, fileName, fmt.Errorf("%s (%s)", errorCodes[ErrMalformedXML].Description, err))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
bucketMap[bucket].CorsConfigXML = corsData
|
||||||
|
bucketMap[bucket].CorsConfigUpdatedAt = updatedAt
|
||||||
|
markImported(bucket, fileName)
|
||||||
rpt.SetStatus(bucket, fileName, nil)
|
rpt.SetStatus(bucket, fileName, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -962,22 +1073,97 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
|||||||
}
|
}
|
||||||
|
|
||||||
for bucket, meta := range bucketMap {
|
for bucket, meta := range bucketMap {
|
||||||
err := globalBucketMetadataSys.save(ctx, *meta)
|
fields := importedFields[bucket]
|
||||||
|
if len(fields) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var merged BucketMetadata
|
||||||
|
var commitAt time.Time
|
||||||
|
err := func() error {
|
||||||
|
lockCtx, unlock, err := lockBucketMetadata(ctx, objectAPI, bucket)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer unlock()
|
||||||
|
merged, err = loadBucketMetadataParse(lockCtx, objectAPI, bucket, false)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := ensureBucketMetadataCreated(lockCtx, objectAPI, &merged); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
commitAt = UTCNow()
|
||||||
|
for _, file := range replicatedBucketConfigs {
|
||||||
|
if _, ok := fields[file]; ok {
|
||||||
|
commitAt = localBucketConfigUpdatedAt(merged, file, commitAt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
applyImportedBucketMetadata(&merged, *meta, fields)
|
||||||
|
for _, file := range replicatedBucketConfigs {
|
||||||
|
if _, ok := fields[file]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
data, at := replicatedBucketConfig(&merged, file)
|
||||||
|
payload, _, err := bucketConfigPayload(bucket, file, *data, len(merged.ObjectLockConfigXML) != 0)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*data, *at = payload, commitAt
|
||||||
|
}
|
||||||
|
return globalBucketMetadataSys.saveMetadata(lockCtx, objectAPI, &merged)
|
||||||
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rpt.SetStatus(bucket, "", err)
|
rpt.SetStatus(bucket, "", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Call site replication hook.
|
*meta = merged
|
||||||
if err = globalSiteReplicationSys.BucketMetaHook(ctx, madmin.SRBucketMeta{
|
globalNotificationSys.LoadBucketMetadata(bgContext(ctx), bucket)
|
||||||
Bucket: bucket,
|
hook := madmin.SRBucketMeta{Bucket: bucket, UpdatedAt: commitAt}
|
||||||
Quota: meta.QuotaConfigJSON,
|
var hookNeeded bool
|
||||||
Policy: meta.PolicyConfigJSON,
|
if _, ok := fields[bucketQuotaConfigFile]; ok {
|
||||||
Versioning: enc(meta.VersioningConfigXML),
|
hook.Quota = meta.QuotaConfigJSON
|
||||||
Tags: enc(meta.TaggingConfigXML),
|
hookNeeded = true
|
||||||
ObjectLockConfig: enc(meta.ObjectLockConfigXML),
|
}
|
||||||
SSEConfig: enc(meta.EncryptionConfigXML),
|
if _, ok := fields[bucketPolicyConfig]; ok {
|
||||||
UpdatedAt: updatedAt,
|
hook.Policy = meta.PolicyConfigJSON
|
||||||
}); err != nil {
|
hookNeeded = hookNeeded || len(hook.Policy) != 0
|
||||||
|
}
|
||||||
|
if _, ok := fields[bucketVersioningConfig]; ok {
|
||||||
|
hook.Versioning = enc(meta.VersioningConfigXML)
|
||||||
|
hookNeeded = true
|
||||||
|
}
|
||||||
|
if _, ok := fields[bucketTaggingConfig]; ok {
|
||||||
|
hook.Tags = enc(meta.TaggingConfigXML)
|
||||||
|
hookNeeded = true
|
||||||
|
}
|
||||||
|
if _, ok := fields[objectLockConfig]; ok {
|
||||||
|
hook.ObjectLockConfig = enc(meta.ObjectLockConfigXML)
|
||||||
|
hookNeeded = true
|
||||||
|
}
|
||||||
|
if _, ok := fields[bucketSSEConfig]; ok {
|
||||||
|
hook.SSEConfig = enc(meta.EncryptionConfigXML)
|
||||||
|
hookNeeded = true
|
||||||
|
}
|
||||||
|
if hookNeeded {
|
||||||
|
err = globalSiteReplicationSys.BucketMetaHook(ctx, hook)
|
||||||
|
}
|
||||||
|
if _, ok := fields[bucketPolicyConfig]; ok && len(meta.PolicyConfigJSON) == 0 {
|
||||||
|
// An omitted bulk Policy cannot express deletion.
|
||||||
|
err = errors.Join(err, globalSiteReplicationSys.BucketMetaHook(ctx, madmin.SRBucketMeta{
|
||||||
|
Type: madmin.SRBucketMetaTypePolicy, Bucket: bucket, UpdatedAt: commitAt,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
if _, ok := fields[bucketCorsConfig]; ok {
|
||||||
|
// CORS carries its own timestamp, so it replicates through the
|
||||||
|
// dedicated event rather than the shared bucket metadata hook. It
|
||||||
|
// is announced even when the shared hook failed: the document is
|
||||||
|
// already committed locally, and a peer that is unreachable for
|
||||||
|
// one config must not withhold CORS from the reachable ones.
|
||||||
|
if corsEvent, live := newBucketCORSReplicationEvent(bucket, *meta); live {
|
||||||
|
err = errors.Join(err, globalSiteReplicationSys.BucketMetaHook(ctx, corsEvent))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
rpt.SetStatus(bucket, "", err)
|
rpt.SetStatus(bucket, "", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/minio/internal/config"
|
"github.com/minio/minio/internal/config"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// validateAdminReq will validate request against and return whether it is allowed.
|
// validateAdminReq will validate request against and return whether it is allowed.
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import (
|
|||||||
"github.com/minio/minio/internal/config/subnet"
|
"github.com/minio/minio/internal/config/subnet"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DelConfigKVHandler - DELETE /minio/admin/v3/del-config-kv
|
// DelConfigKVHandler - DELETE /minio/admin/v3/del-config-kv
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import (
|
|||||||
cfgldap "github.com/minio/minio/internal/config/identity/ldap"
|
cfgldap "github.com/minio/minio/internal/config/identity/ldap"
|
||||||
"github.com/minio/minio/internal/config/identity/openid"
|
"github.com/minio/minio/internal/config/identity/openid"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/ldap"
|
"github.com/pgsty/silo-pkg/v3/ldap"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) {
|
func addOrUpdateIDPHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, isUpdate bool) {
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
xldap "github.com/minio/pkg/v3/ldap"
|
xldap "github.com/pgsty/silo-pkg/v3/ldap"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListLDAPPolicyMappingEntities lists users/groups mapped to given/all policies.
|
// ListLDAPPolicyMappingEntities lists users/groups mapped to given/all policies.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const dummyRoleARN = "dummy-internal"
|
const dummyRoleARN = "dummy-internal"
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
xioutil "github.com/minio/minio/internal/ioutil"
|
xioutil "github.com/minio/minio/internal/ioutil"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SiteReplicationAdd - PUT /minio/admin/v3/site-replication/add
|
// SiteReplicationAdd - PUT /minio/admin/v3/site-replication/add
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import (
|
|||||||
|
|
||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
minio "github.com/minio/minio-go/v7"
|
minio "github.com/minio/minio-go/v7"
|
||||||
"github.com/minio/pkg/v3/sync/errgroup"
|
"github.com/pgsty/silo-pkg/v3/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runAllIAMConcurrencyTests(suite *TestSuiteIAM, c *check) {
|
func runAllIAMConcurrencyTests(suite *TestSuiteIAM, c *check) {
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/config/dns"
|
"github.com/minio/minio/internal/config/dns"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
xldap "github.com/minio/pkg/v3/ldap"
|
xldap "github.com/pgsty/silo-pkg/v3/ldap"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/puzpuzpuz/xsync/v3"
|
"github.com/puzpuzpuz/xsync/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -502,11 +502,15 @@ func (a adminAPIHandlers) AddUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkDenyOnly := accessKey == cred.AccessKey
|
checkDenyOnly := accessKey == cred.AccessKey
|
||||||
|
action := policy.Action(policy.CreateUserAdminAction)
|
||||||
|
if checkDenyOnly {
|
||||||
|
action = policy.ChangeMyPasswordAdminAction
|
||||||
|
}
|
||||||
|
|
||||||
if !globalIAMSys.IsAllowed(policy.Args{
|
if !globalIAMSys.IsAllowed(policy.Args{
|
||||||
AccountName: cred.AccessKey,
|
AccountName: cred.AccessKey,
|
||||||
Groups: cred.Groups,
|
Groups: cred.Groups,
|
||||||
Action: policy.CreateUserAdminAction,
|
Action: action,
|
||||||
ConditionValues: getConditionValues(r, "", cred),
|
ConditionValues: getConditionValues(r, "", cred),
|
||||||
IsOwner: owner,
|
IsOwner: owner,
|
||||||
Claims: cred.Claims,
|
Claims: cred.Claims,
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ import (
|
|||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/minio-go/v7/pkg/signer"
|
"github.com/minio/minio-go/v7/pkg/signer"
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -243,6 +243,7 @@ func TestIAMInternalIDPServerSuite(t *testing.T) {
|
|||||||
|
|
||||||
suite.SetUpSuite(c)
|
suite.SetUpSuite(c)
|
||||||
suite.TestUserCreate(c)
|
suite.TestUserCreate(c)
|
||||||
|
suite.TestUserPasswordActionAuthorization(c)
|
||||||
suite.TestUserStatusActionAuthorization(c)
|
suite.TestUserStatusActionAuthorization(c)
|
||||||
suite.TestGroupStatusActionAuthorization(c)
|
suite.TestGroupStatusActionAuthorization(c)
|
||||||
suite.TestUserPolicyEscalationBug(c)
|
suite.TestUserPolicyEscalationBug(c)
|
||||||
@@ -356,6 +357,106 @@ func (s *TestSuiteIAM) TestUserCreate(c *check) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *TestSuiteIAM) TestUserPasswordActionAuthorization(c *check) {
|
||||||
|
for _, tt := range []struct {
|
||||||
|
name string
|
||||||
|
statements string
|
||||||
|
self bool
|
||||||
|
other bool
|
||||||
|
}{
|
||||||
|
{"readonly", "", true, false},
|
||||||
|
{"consolereadonly", "", true, false},
|
||||||
|
{"password grant", `{"Effect":"Allow","Action":"admin:ChangeMyPassword"}`, true, false},
|
||||||
|
{"legacy CreateUser deny", `{"Effect":"Deny","Action":"admin:CreateUser","Resource":"arn:aws:s3:::*"}`, true, false},
|
||||||
|
{"password deny", `{"Effect":"Deny","Action":"admin:ChangeMyPassword"}`, false, false},
|
||||||
|
{"user admin", `{"Effect":"Allow","Action":"admin:CreateUser"}`, true, true},
|
||||||
|
{"user admin with password deny", `{"Effect":"Allow","Action":"admin:CreateUser"},{"Effect":"Deny","Action":"admin:ChangeMyPassword"}`, false, true},
|
||||||
|
{"password deny overrides grant", `{"Effect":"Allow","Action":"admin:ChangeMyPassword"},{"Effect":"Deny","Action":"admin:ChangeMyPassword"}`, false, false},
|
||||||
|
{"wildcard deny", `{"Effect":"Deny","Action":"admin:*"}`, false, false},
|
||||||
|
} {
|
||||||
|
c.Run(tt.name, func(t *testing.T) {
|
||||||
|
c := &check{t, s.serverType}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), testDefaultTimeout)
|
||||||
|
defer cancel()
|
||||||
|
var users []string
|
||||||
|
policyName := tt.name
|
||||||
|
defer func() {
|
||||||
|
for _, user := range users {
|
||||||
|
if err := s.adm.RemoveUser(ctx, user); err != nil {
|
||||||
|
c.Errorf("remove test user: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if tt.statements != "" {
|
||||||
|
if err := s.adm.RemoveCannedPolicy(ctx, policyName); err != nil {
|
||||||
|
c.Errorf("remove test policy: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
createUser := func() (string, string) {
|
||||||
|
accessKey, secretKey := mustGenerateCredentials(c)
|
||||||
|
if err := s.adm.SetUser(ctx, accessKey, secretKey, madmin.AccountEnabled); err != nil {
|
||||||
|
c.Fatalf("create test user: %v", err)
|
||||||
|
}
|
||||||
|
users = append(users, accessKey)
|
||||||
|
return accessKey, secretKey
|
||||||
|
}
|
||||||
|
client := func(accessKey, secretKey string) *madmin.AdminClient {
|
||||||
|
adm, err := madmin.New(s.endpoint, accessKey, secretKey, s.secure)
|
||||||
|
if err != nil {
|
||||||
|
c.Fatal(err)
|
||||||
|
}
|
||||||
|
adm.SetCustomTransport(s.TestSuiteCommon.client.Transport)
|
||||||
|
return adm
|
||||||
|
}
|
||||||
|
if tt.statements != "" {
|
||||||
|
policyName = getRandomBucketName()
|
||||||
|
doc := []byte(`{"Version":"2012-10-17","Statement":[` + tt.statements + `]}`)
|
||||||
|
if err := s.adm.AddCannedPolicy(ctx, policyName, doc); err != nil {
|
||||||
|
c.Fatalf("save test policy: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
accessKey, secretKey := createUser()
|
||||||
|
if _, err := s.adm.AttachPolicy(ctx, madmin.PolicyAssociationReq{
|
||||||
|
User: accessKey, Policies: []string{policyName},
|
||||||
|
}); err != nil {
|
||||||
|
c.Fatalf("attach test policy: %v", err)
|
||||||
|
}
|
||||||
|
adm := client(accessKey, secretKey)
|
||||||
|
_, newSecretKey := mustGenerateCredentials(c)
|
||||||
|
err := adm.SetUser(ctx, accessKey, newSecretKey, madmin.AccountEnabled)
|
||||||
|
if tt.self {
|
||||||
|
if err != nil {
|
||||||
|
c.Fatalf("change own password: %v", err)
|
||||||
|
}
|
||||||
|
if _, err = adm.AccountInfo(ctx, madmin.AccountOpts{}); err == nil {
|
||||||
|
c.Fatal("old password still authenticates")
|
||||||
|
}
|
||||||
|
adm = client(accessKey, newSecretKey)
|
||||||
|
} else if err == nil || madmin.ToErrorResponse(err).Code != "AccessDenied" {
|
||||||
|
c.Fatalf("self password change: expected AccessDenied, got %v", err)
|
||||||
|
}
|
||||||
|
if _, err := adm.AccountInfo(ctx, madmin.AccountOpts{}); err != nil {
|
||||||
|
c.Fatalf("current password no longer authenticates: %v", err)
|
||||||
|
}
|
||||||
|
target, _ := createUser()
|
||||||
|
newUser, newUserSecret := mustGenerateCredentials(c)
|
||||||
|
for _, key := range []string{target, newUser} {
|
||||||
|
err := adm.SetUser(ctx, key, newUserSecret, madmin.AccountEnabled)
|
||||||
|
if tt.other {
|
||||||
|
if err != nil {
|
||||||
|
c.Fatalf("create or update another user: %v", err)
|
||||||
|
}
|
||||||
|
if key == newUser {
|
||||||
|
users = append(users, newUser)
|
||||||
|
}
|
||||||
|
} else if err == nil || madmin.ToErrorResponse(err).Code != "AccessDenied" {
|
||||||
|
c.Fatalf("create or update another user: expected AccessDenied, got %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *TestSuiteIAM) TestUserStatusActionAuthorization(c *check) {
|
func (s *TestSuiteIAM) TestUserStatusActionAuthorization(c *check) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testDefaultTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testDefaultTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -946,6 +1047,7 @@ func (s *TestSuiteIAM) TestCannedPolicies(c *check) {
|
|||||||
defaultPolicies := []string{
|
defaultPolicies := []string{
|
||||||
"readwrite",
|
"readwrite",
|
||||||
"readonly",
|
"readonly",
|
||||||
|
"consolereadonly",
|
||||||
"writeonly",
|
"writeonly",
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
"consoleAdmin",
|
"consoleAdmin",
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
xnet "github.com/minio/pkg/v3/net"
|
xnet "github.com/pgsty/silo-pkg/v3/net"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/secure-io/sio-go"
|
"github.com/secure-io/sio-go"
|
||||||
"github.com/zeebo/xxh3"
|
"github.com/zeebo/xxh3"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ func registerAdminRouter(router *mux.Router, enableConfigOps bool) {
|
|||||||
|
|
||||||
// StorageInfo operations
|
// StorageInfo operations
|
||||||
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/storageinfo").HandlerFunc(adminMiddleware(adminAPI.StorageInfoHandler, traceAllFlag))
|
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/storageinfo").HandlerFunc(adminMiddleware(adminAPI.StorageInfoHandler, traceAllFlag))
|
||||||
|
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/multipart-preflight").HandlerFunc(adminMiddleware(adminAPI.MultipartPreflightHandler, traceAllFlag))
|
||||||
// DataUsageInfo operations
|
// DataUsageInfo operations
|
||||||
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/datausageinfo").HandlerFunc(adminMiddleware(adminAPI.DataUsageInfoHandler, traceAllFlag))
|
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/datausageinfo").HandlerFunc(adminMiddleware(adminAPI.DataUsageInfoHandler, traceAllFlag))
|
||||||
// Metrics operation
|
// Metrics operation
|
||||||
@@ -388,6 +389,7 @@ func registerAdminRouter(router *mux.Router, enableConfigOps bool) {
|
|||||||
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/join").HandlerFunc(adminMiddleware(adminAPI.SRPeerJoin))
|
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/join").HandlerFunc(adminMiddleware(adminAPI.SRPeerJoin))
|
||||||
adminRouter.Methods(http.MethodPut).Path(adminVersion+"/site-replication/peer/bucket-ops").HandlerFunc(adminMiddleware(adminAPI.SRPeerBucketOps)).Queries("bucket", "{bucket:.*}").Queries("operation", "{operation:.*}")
|
adminRouter.Methods(http.MethodPut).Path(adminVersion+"/site-replication/peer/bucket-ops").HandlerFunc(adminMiddleware(adminAPI.SRPeerBucketOps)).Queries("bucket", "{bucket:.*}").Queries("operation", "{operation:.*}")
|
||||||
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/iam-item").HandlerFunc(adminMiddleware(adminAPI.SRPeerReplicateIAMItem))
|
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/iam-item").HandlerFunc(adminMiddleware(adminAPI.SRPeerReplicateIAMItem))
|
||||||
|
adminRouter.Methods(http.MethodGet, http.MethodPut).Path(adminVersion + "/site-replication/peer/iam-revisions").HandlerFunc(adminMiddleware(adminAPI.SRPeerIAMRevisions))
|
||||||
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/bucket-meta").HandlerFunc(adminMiddleware(adminAPI.SRPeerReplicateBucketItem))
|
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/peer/bucket-meta").HandlerFunc(adminMiddleware(adminAPI.SRPeerReplicateBucketItem))
|
||||||
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/site-replication/peer/idp-settings").HandlerFunc(adminMiddleware(adminAPI.SRPeerGetIDPSettings))
|
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/site-replication/peer/idp-settings").HandlerFunc(adminMiddleware(adminAPI.SRPeerGetIDPSettings))
|
||||||
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/edit").HandlerFunc(adminMiddleware(adminAPI.SiteReplicationEdit))
|
adminRouter.Methods(http.MethodPut).Path(adminVersion + "/site-replication/edit").HandlerFunc(adminMiddleware(adminAPI.SiteReplicationEdit))
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio/internal/config"
|
"github.com/minio/minio/internal/config"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
xnet "github.com/minio/pkg/v3/net"
|
xnet "github.com/pgsty/silo-pkg/v3/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// getLocalServerProperty - returns madmin.ServerProperties for only the
|
// getLocalServerProperty - returns madmin.ServerProperties for only the
|
||||||
|
|||||||
+30
-2
@@ -48,7 +48,7 @@ import (
|
|||||||
levent "github.com/minio/minio/internal/config/lambda/event"
|
levent "github.com/minio/minio/internal/config/lambda/event"
|
||||||
"github.com/minio/minio/internal/event"
|
"github.com/minio/minio/internal/event"
|
||||||
"github.com/minio/minio/internal/hash"
|
"github.com/minio/minio/internal/hash"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIError structure
|
// APIError structure
|
||||||
@@ -450,6 +450,9 @@ const (
|
|||||||
ErrAdminNoSecretKey
|
ErrAdminNoSecretKey
|
||||||
|
|
||||||
ErrIAMNotInitialized
|
ErrIAMNotInitialized
|
||||||
|
ErrMultipartListingLegacy
|
||||||
|
ErrMultipartListingIdentity
|
||||||
|
ErrSlowDown
|
||||||
|
|
||||||
apiErrCodeEnd // This is used only for the testing code
|
apiErrCodeEnd // This is used only for the testing code
|
||||||
)
|
)
|
||||||
@@ -1336,6 +1339,21 @@ var errorCodes = errorCodeMap{
|
|||||||
Description: "IAM sub-system not initialized yet, please try again.",
|
Description: "IAM sub-system not initialized yet, please try again.",
|
||||||
HTTPStatusCode: http.StatusServiceUnavailable,
|
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||||
},
|
},
|
||||||
|
ErrMultipartListingLegacy: {
|
||||||
|
Code: "MultipartListingNotReady",
|
||||||
|
Description: "Legacy multipart uploads prevent a complete listing. Upgrade all writers, drain old uploads and run the multipart preflight check.",
|
||||||
|
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||||
|
},
|
||||||
|
ErrMultipartListingIdentity: {
|
||||||
|
Code: "MultipartListingMetadataInvalid",
|
||||||
|
Description: "Multipart upload metadata is inconsistent. Run the multipart preflight check to locate the affected storage set.",
|
||||||
|
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||||
|
},
|
||||||
|
ErrSlowDown: {
|
||||||
|
Code: "SlowDown",
|
||||||
|
Description: "Please reduce your request rate",
|
||||||
|
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||||
|
},
|
||||||
ErrBucketMetadataNotInitialized: {
|
ErrBucketMetadataNotInitialized: {
|
||||||
Code: "XMinioBucketMetadataNotInitialized",
|
Code: "XMinioBucketMetadataNotInitialized",
|
||||||
Description: "Bucket metadata not initialized yet, please try again.",
|
Description: "Bucket metadata not initialized yet, please try again.",
|
||||||
@@ -1523,10 +1541,14 @@ var errorCodes = errorCodeMap{
|
|||||||
Description: "Your Host header is malformed.",
|
Description: "Your Host header is malformed.",
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
|
// The stored object cannot be served: a server-side data condition, not a
|
||||||
|
// successful partial read. Upstream maps it to http.StatusPartialContent
|
||||||
|
// (since ca6b4773e, 2017), which lets SDKs accept the XML error document
|
||||||
|
// as object content; SILO deliberately diverges and returns 500.
|
||||||
ErrObjectTampered: {
|
ErrObjectTampered: {
|
||||||
Code: "XMinioObjectTampered",
|
Code: "XMinioObjectTampered",
|
||||||
Description: errObjectTampered.Error(),
|
Description: errObjectTampered.Error(),
|
||||||
HTTPStatusCode: http.StatusPartialContent,
|
HTTPStatusCode: http.StatusInternalServerError,
|
||||||
},
|
},
|
||||||
|
|
||||||
ErrSiteReplicationInvalidRequest: {
|
ErrSiteReplicationInvalidRequest: {
|
||||||
@@ -2169,6 +2191,10 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
|
|||||||
err = unwrapAll(err)
|
err = unwrapAll(err)
|
||||||
|
|
||||||
switch err {
|
switch err {
|
||||||
|
case errMultipartListingLegacy:
|
||||||
|
apiErr = ErrMultipartListingLegacy
|
||||||
|
case errMultipartListingIdentity:
|
||||||
|
apiErr = ErrMultipartListingIdentity
|
||||||
case errCompleteMultipartChecksumMismatch, errCompleteMultipartChecksumTypeMismatch:
|
case errCompleteMultipartChecksumMismatch, errCompleteMultipartChecksumTypeMismatch:
|
||||||
apiErr = ErrBadDigest
|
apiErr = ErrBadDigest
|
||||||
case errMissingPartChecksum:
|
case errMissingPartChecksum:
|
||||||
@@ -2299,6 +2325,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
|
case SlowDown:
|
||||||
|
apiErr = ErrSlowDown
|
||||||
case StorageFull:
|
case StorageFull:
|
||||||
apiErr = ErrStorageFull
|
apiErr = ErrStorageFull
|
||||||
case hash.BadDigest:
|
case hash.BadDigest:
|
||||||
|
|||||||
+4
-1
@@ -212,7 +212,10 @@ func setObjectHeaders(ctx context.Context, w http.ResponseWriter, objInfo Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
if rs == nil && opts.PartNumber > 0 {
|
if rs == nil && opts.PartNumber > 0 {
|
||||||
rs = partNumberToRangeSpec(objInfo, opts.PartNumber)
|
rs, err = partNumberToRangeSpec(objInfo, opts.PartNumber)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For providing ranged content
|
// For providing ranged content
|
||||||
|
|||||||
+2
-2
@@ -34,14 +34,14 @@ import (
|
|||||||
"github.com/minio/minio/internal/hash"
|
"github.com/minio/minio/internal/hash"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
|
||||||
xxml "github.com/minio/xxml"
|
xxml "github.com/minio/xxml"
|
||||||
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
maxObjectList = 1000 // Limit number of objects in a listObjectsResponse/listObjectsVersionsResponse.
|
maxObjectList = 1000 // Limit number of objects in a listObjectsResponse/listObjectsVersionsResponse.
|
||||||
maxDeleteList = 1000 // Limit number of objects deleted in a delete call.
|
maxDeleteList = 1000 // Limit number of objects deleted in a delete call.
|
||||||
maxUploadsList = 10000 // Limit number of uploads in a listUploadsResponse.
|
maxUploadsList = 1000 // Limit number of uploads in a listUploadsResponse.
|
||||||
maxPartsList = 10000 // Limit number of parts in a listPartsResponse.
|
maxPartsList = 10000 // Limit number of parts in a listPartsResponse.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+11
-13
@@ -29,7 +29,7 @@ import (
|
|||||||
bktcors "github.com/minio/minio/internal/bucket/cors"
|
bktcors "github.com/minio/minio/internal/bucket/cors"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/wildcard"
|
"github.com/pgsty/silo-pkg/v3/wildcard"
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -461,15 +461,15 @@ func registerAPIRouter(router *mux.Router) {
|
|||||||
router.Methods(http.MethodPut).
|
router.Methods(http.MethodPut).
|
||||||
HandlerFunc(s3APIMiddleware(api.PutBucketACLHandler)).
|
HandlerFunc(s3APIMiddleware(api.PutBucketACLHandler)).
|
||||||
Queries("acl", "")
|
Queries("acl", "")
|
||||||
// GetBucketCors - this is a dummy call.
|
// GetBucketCors
|
||||||
router.Methods(http.MethodGet).
|
router.Methods(http.MethodGet).
|
||||||
HandlerFunc(s3APIMiddleware(api.GetBucketCorsHandler)).
|
HandlerFunc(s3APIMiddleware(api.GetBucketCorsHandler)).
|
||||||
Queries("cors", "")
|
Queries("cors", "")
|
||||||
// PutBucketCors - this is a dummy call.
|
// PutBucketCors
|
||||||
router.Methods(http.MethodPut).
|
router.Methods(http.MethodPut).
|
||||||
HandlerFunc(s3APIMiddleware(api.PutBucketCorsHandler)).
|
HandlerFunc(s3APIMiddleware(api.PutBucketCorsHandler)).
|
||||||
Queries("cors", "")
|
Queries("cors", "")
|
||||||
// DeleteBucketCors - this is a dummy call.
|
// DeleteBucketCors
|
||||||
router.Methods(http.MethodDelete).
|
router.Methods(http.MethodDelete).
|
||||||
HandlerFunc(s3APIMiddleware(api.DeleteBucketCorsHandler)).
|
HandlerFunc(s3APIMiddleware(api.DeleteBucketCorsHandler)).
|
||||||
Queries("cors", "")
|
Queries("cors", "")
|
||||||
@@ -787,15 +787,13 @@ func corsHandler(handler http.Handler) http.Handler {
|
|||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Header.Get("Origin") != "" {
|
if r.Header.Get("Origin") != "" {
|
||||||
if bucket, _ := request2BucketObjectName(r); bucket != "" && globalBucketMetadataSys != nil {
|
if bucket, _ := request2BucketObjectName(r); bucket != "" && globalBucketMetadataSys != nil {
|
||||||
// Resident-only lookup: this runs pre-auth for every
|
// Resident-only lookup: this runs before authentication with a
|
||||||
// Origin-bearing request using a client-supplied path segment as
|
// client-supplied path segment as the bucket name, so it must
|
||||||
// the bucket name. It must never load or cache metadata for
|
// never load or cache metadata. While startup loading is still
|
||||||
// arbitrary names (see GetResidentCorsConfig). GetResidentCorsConfig
|
// running, for a real bucket whose metadata failed to load, and
|
||||||
// is the single decision point: it returns errInvalidArgument for
|
// for a bucket whose stored CORS document failed to parse, the
|
||||||
// the internal .minio.sys namespace (fail closed), a config for a
|
// request gets no CORS headers; any other non-resident name falls
|
||||||
// resident bucket, errBucketMetadataNotInitialized for a real but
|
// back to the global policy below.
|
||||||
// unloaded bucket (fail closed), and errConfigNotFound otherwise
|
|
||||||
// (fall back to the global policy below).
|
|
||||||
cfg, _, err := globalBucketMetadataSys.GetResidentCorsConfig(bucket)
|
cfg, _, err := globalBucketMetadataSys.GetResidentCorsConfig(bucket)
|
||||||
if err == nil && cfg != nil {
|
if err == nil && cfg != nil {
|
||||||
if applyBucketCors(w, r, cfg) {
|
if applyBucketCors(w, r, cfg) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+57
-39
@@ -41,7 +41,7 @@ import (
|
|||||||
xjwt "github.com/minio/minio/internal/jwt"
|
xjwt "github.com/minio/minio/internal/jwt"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/minio/internal/mcontext"
|
"github.com/minio/minio/internal/mcontext"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Verify if request has JWT.
|
// Verify if request has JWT.
|
||||||
@@ -363,17 +363,6 @@ func checkRequestAuthTypeWithRequestTags(ctx context.Context, r *http.Request, a
|
|||||||
return authorizeRequestWithTags(ctx, r, action, "", requestTags)
|
return authorizeRequestWithTags(ctx, r, action, "", requestTags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkRequestAuthTypeWithVID is similar to checkRequestAuthType
|
|
||||||
// passes versionID additionally.
|
|
||||||
func checkRequestAuthTypeWithVID(ctx context.Context, r *http.Request, action policy.Action, bucketName, objectName, versionID string) (s3Err APIErrorCode) {
|
|
||||||
logger.GetReqInfo(ctx).BucketName = bucketName
|
|
||||||
logger.GetReqInfo(ctx).ObjectName = objectName
|
|
||||||
logger.GetReqInfo(ctx).VersionID = versionID
|
|
||||||
|
|
||||||
_, _, s3Err = checkRequestAuthTypeCredential(ctx, r, action)
|
|
||||||
return s3Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func authenticateRequest(ctx context.Context, r *http.Request, action policy.Action) (s3Err APIErrorCode) {
|
func authenticateRequest(ctx context.Context, r *http.Request, action policy.Action) (s3Err APIErrorCode) {
|
||||||
if logger.GetReqInfo(ctx) == nil {
|
if logger.GetReqInfo(ctx) == nil {
|
||||||
bugLogIf(ctx, errors.New("unexpected context.Context does not have a logger.ReqInfo"), logger.ErrorKind)
|
bugLogIf(ctx, errors.New("unexpected context.Context does not have a logger.ReqInfo"), logger.ErrorKind)
|
||||||
@@ -439,6 +428,23 @@ func authorizeRequest(ctx context.Context, r *http.Request, action policy.Action
|
|||||||
return authorizeRequestWithExistingTags(ctx, r, action, "")
|
return authorizeRequestWithExistingTags(ctx, r, action, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteObjectAction(versionID string) policy.Action {
|
||||||
|
if versionID != "" {
|
||||||
|
return policy.DeleteObjectVersionAction
|
||||||
|
}
|
||||||
|
return policy.DeleteObjectAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func actionUsesObjectVersion(action policy.Action) bool {
|
||||||
|
switch action {
|
||||||
|
case policy.DeleteObjectAction, policy.DeleteObjectVersionAction,
|
||||||
|
policy.ReplicateDeleteAction, policy.BypassGovernanceRetentionAction:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func authorizeRequestWithExistingTags(ctx context.Context, r *http.Request, action policy.Action, existingTags string) (s3Err APIErrorCode) {
|
func authorizeRequestWithExistingTags(ctx context.Context, r *http.Request, action policy.Action, existingTags string) (s3Err APIErrorCode) {
|
||||||
return authorizeRequestWithTags(ctx, r, action, existingTags, nil)
|
return authorizeRequestWithTags(ctx, r, action, existingTags, nil)
|
||||||
}
|
}
|
||||||
@@ -457,7 +463,7 @@ func authorizeRequestWithTags(ctx context.Context, r *http.Request, action polic
|
|||||||
versionID := reqInfo.VersionID
|
versionID := reqInfo.VersionID
|
||||||
conditionValuesForAuth := func(locationConstraint string, credentials auth.Credentials) map[string][]string {
|
conditionValuesForAuth := func(locationConstraint string, credentials auth.Credentials) map[string][]string {
|
||||||
values := getConditionValuesWithTags(r, locationConstraint, credentials, existingTags, requestTags)
|
values := getConditionValuesWithTags(r, locationConstraint, credentials, existingTags, requestTags)
|
||||||
if action == policy.DeleteObjectAction {
|
if actionUsesObjectVersion(action) {
|
||||||
// DeleteObjects carries the effective version ID in each XML object,
|
// DeleteObjects carries the effective version ID in each XML object,
|
||||||
// not in the request query. Keep authorization scoped to that entry.
|
// not in the request query. Keep authorization scoped to that entry.
|
||||||
if versionID == "" {
|
if versionID == "" {
|
||||||
@@ -503,21 +509,6 @@ func authorizeRequestWithTags(ctx context.Context, r *http.Request, action polic
|
|||||||
|
|
||||||
return ErrAccessDenied
|
return ErrAccessDenied
|
||||||
}
|
}
|
||||||
if action == policy.DeleteObjectAction && versionID != "" {
|
|
||||||
if !globalIAMSys.IsAllowed(policy.Args{
|
|
||||||
AccountName: cred.AccessKey,
|
|
||||||
Groups: cred.Groups,
|
|
||||||
Action: policy.Action(policy.DeleteObjectVersionAction),
|
|
||||||
BucketName: bucket,
|
|
||||||
ConditionValues: conditionValuesForAuth("", cred),
|
|
||||||
ObjectName: object,
|
|
||||||
IsOwner: owner,
|
|
||||||
Claims: cred.Claims,
|
|
||||||
DenyOnly: true,
|
|
||||||
}) { // Request is not allowed if Deny action on DeleteObjectVersionAction
|
|
||||||
return ErrAccessDenied
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if globalIAMSys.IsAllowed(policy.Args{
|
if globalIAMSys.IsAllowed(policy.Args{
|
||||||
AccountName: cred.AccessKey,
|
AccountName: cred.AccessKey,
|
||||||
Groups: cred.Groups,
|
Groups: cred.Groups,
|
||||||
@@ -553,6 +544,40 @@ func authorizeRequestWithTags(ctx context.Context, r *http.Request, action polic
|
|||||||
return ErrAccessDenied
|
return ErrAccessDenied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// authorizeReplicationDelete preserves the established target-credential
|
||||||
|
// contract for trusted replication: DeleteObject and ReplicateDelete must be
|
||||||
|
// allowed, while an explicit DeleteObjectVersion deny still blocks a named
|
||||||
|
// version. Ordinary S3 requests never use this compatibility path.
|
||||||
|
func authorizeReplicationDelete(ctx context.Context, r *http.Request) APIErrorCode {
|
||||||
|
if s3Err := authorizeRequest(ctx, r, policy.DeleteObjectAction); s3Err != ErrNone {
|
||||||
|
return s3Err
|
||||||
|
}
|
||||||
|
reqInfo := logger.GetReqInfo(ctx)
|
||||||
|
if reqInfo == nil {
|
||||||
|
return ErrAccessDenied
|
||||||
|
}
|
||||||
|
if reqInfo.VersionID == "" {
|
||||||
|
return ErrNone
|
||||||
|
}
|
||||||
|
cred := reqInfo.Cred
|
||||||
|
values := getConditionValuesWithTags(r, "", cred, "", nil)
|
||||||
|
values["versionid"] = []string{reqInfo.VersionID}
|
||||||
|
if !globalIAMSys.IsAllowed(policy.Args{
|
||||||
|
AccountName: cred.AccessKey,
|
||||||
|
Groups: cred.Groups,
|
||||||
|
Action: policy.DeleteObjectVersionAction,
|
||||||
|
BucketName: reqInfo.BucketName,
|
||||||
|
ConditionValues: values,
|
||||||
|
ObjectName: reqInfo.ObjectName,
|
||||||
|
IsOwner: reqInfo.Owner,
|
||||||
|
Claims: cred.Claims,
|
||||||
|
DenyOnly: true,
|
||||||
|
}) {
|
||||||
|
return ErrAccessDenied
|
||||||
|
}
|
||||||
|
return ErrNone
|
||||||
|
}
|
||||||
|
|
||||||
// Check request auth type verifies the incoming http request
|
// Check request auth type verifies the incoming http request
|
||||||
// - validates the request signature
|
// - validates the request signature
|
||||||
// - validates the policy action if anonymous tests bucket policies if any,
|
// - validates the policy action if anonymous tests bucket policies if any,
|
||||||
@@ -607,18 +632,11 @@ func isReqAuthenticated(ctx context.Context, r *http.Request, region string, sty
|
|||||||
return ErrInvalidDigest
|
return ErrInvalidDigest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract either 'X-Amz-Content-Sha256' header or 'X-Amz-Content-Sha256' query parameter (if V4 presigned)
|
// Honor the selected header/query checksum, including the header fallback
|
||||||
// Do not verify 'X-Amz-Content-Sha256' if skipSHA256.
|
// for a presigned request. STS separately hashes its body for its signature.
|
||||||
var contentSHA256 []byte
|
var contentSHA256 []byte
|
||||||
if skipSHA256 := skipContentSha256Cksum(r); !skipSHA256 && isRequestPresignedSignatureV4(r) {
|
if !skipContentSha256Cksum(r) {
|
||||||
if sha256Sum, ok := r.Form[xhttp.AmzContentSha256]; ok && len(sha256Sum) > 0 {
|
contentSHA256, err = hex.DecodeString(getContentSha256Cksum(r, serviceS3))
|
||||||
contentSHA256, err = hex.DecodeString(sha256Sum[0])
|
|
||||||
if err != nil {
|
|
||||||
return ErrContentSHA256Mismatch
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if _, ok := r.Header[xhttp.AmzContentSha256]; !skipSHA256 && ok {
|
|
||||||
contentSHA256, err = hex.DecodeString(r.Header.Get(xhttp.AmzContentSha256))
|
|
||||||
if err != nil || len(contentSHA256) == 0 {
|
if err != nil || len(contentSHA256) == 0 {
|
||||||
return ErrContentSHA256Mismatch
|
return ErrContentSHA256Mismatch
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
type nullReader struct{}
|
type nullReader struct{}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
// healTask represents what to heal along with options
|
// healTask represents what to heal along with options
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/minio/internal/config"
|
"github.com/minio/minio/internal/config"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+4
-4
@@ -33,10 +33,10 @@ import (
|
|||||||
"github.com/minio/minio/internal/bucket/versioning"
|
"github.com/minio/minio/internal/bucket/versioning"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
xioutil "github.com/minio/minio/internal/ioutil"
|
xioutil "github.com/minio/minio/internal/ioutil"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
"github.com/minio/pkg/v3/wildcard"
|
"github.com/pgsty/silo-pkg/v3/wildcard"
|
||||||
"github.com/minio/pkg/v3/workers"
|
"github.com/pgsty/silo-pkg/v3/workers"
|
||||||
"github.com/minio/pkg/v3/xtime"
|
"github.com/pgsty/silo-pkg/v3/xtime"
|
||||||
"go.yaml.in/yaml/v3"
|
"go.yaml.in/yaml/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ import (
|
|||||||
"github.com/minio/minio/internal/hash"
|
"github.com/minio/minio/internal/hash"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
xioutil "github.com/minio/minio/internal/ioutil"
|
xioutil "github.com/minio/minio/internal/ioutil"
|
||||||
"github.com/minio/pkg/v3/console"
|
"github.com/pgsty/silo-pkg/v3/console"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/workers"
|
"github.com/pgsty/silo-pkg/v3/workers"
|
||||||
"go.yaml.in/yaml/v3"
|
"go.yaml.in/yaml/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/minio/pkg/v3/wildcard"
|
"github.com/pgsty/silo-pkg/v3/wildcard"
|
||||||
"go.yaml.in/yaml/v3"
|
"go.yaml.in/yaml/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
miniogo "github.com/minio/minio-go/v7"
|
miniogo "github.com/minio/minio-go/v7"
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/pkg/v3/xtime"
|
"github.com/pgsty/silo-pkg/v3/xtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate msgp -file $GOFILE
|
//go:generate msgp -file $GOFILE
|
||||||
|
|||||||
+2
-2
@@ -34,8 +34,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/crypto"
|
"github.com/minio/minio/internal/crypto"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
"github.com/minio/pkg/v3/workers"
|
"github.com/pgsty/silo-pkg/v3/workers"
|
||||||
)
|
)
|
||||||
|
|
||||||
// keyrotate:
|
// keyrotate:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import (
|
|||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/minio/internal/grid"
|
"github.com/minio/minio/internal/grid"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/env"
|
"github.com/pgsty/silo-pkg/v3/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
// To abstract a node over network.
|
// To abstract a node over network.
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
hashpkg "github.com/minio/minio/internal/hash"
|
hashpkg "github.com/minio/minio/internal/hash"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// maxBucketCorsSize is the maximum allowed size of a CORS configuration document.
|
// maxBucketCorsSize is the maximum allowed size of a CORS configuration document.
|
||||||
|
|||||||
@@ -261,6 +261,11 @@ func TestBucketCorsMetadataErrorFailsClosed(t *testing.T) {
|
|||||||
oldMetadataSys := globalBucketMetadataSys
|
oldMetadataSys := globalBucketMetadataSys
|
||||||
setObjectLayer(nil)
|
setObjectLayer(nil)
|
||||||
globalBucketMetadataSys = NewBucketMetadataSys()
|
globalBucketMetadataSys = NewBucketMetadataSys()
|
||||||
|
// A resident bucket whose stored CORS document does not parse must not be
|
||||||
|
// answered with the global policy: it has a configuration we cannot honor.
|
||||||
|
meta := newBucketMetadata("cors-metadata-error")
|
||||||
|
meta.corsConfigErr = fmt.Errorf("invalid bucket CORS configuration")
|
||||||
|
globalBucketMetadataSys.Set("cors-metadata-error", meta)
|
||||||
defer func() {
|
defer func() {
|
||||||
setObjectLayer(oldObjectAPI)
|
setObjectLayer(oldObjectAPI)
|
||||||
globalBucketMetadataSys = oldMetadataSys
|
globalBucketMetadataSys = oldMetadataSys
|
||||||
@@ -707,34 +712,32 @@ func testBucketCorsLoadFailedBucketFailsClosed(obj ObjectLayer, _ string, _ stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestBucketCorsInternalBucketFailsClosed guards P2: an Origin-bearing request
|
// TestBucketCorsResidentConfigSurvivesRefreshFailure: a resident bucket keeps
|
||||||
// whose first path segment is the reserved .minio.sys namespace must preserve
|
// its last loaded CORS configuration through a failed refresh, like every
|
||||||
// GetConfig's errInvalidArgument semantics and fail closed, not fall back to
|
// other bucket configuration, and the failure set never records a resident
|
||||||
// the permissive global CORS policy.
|
// bucket. Only a bucket that was never loaded fails closed.
|
||||||
func TestBucketCorsInternalBucketFailsClosed(t *testing.T) {
|
func TestBucketCorsResidentConfigSurvivesRefreshFailure(t *testing.T) {
|
||||||
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
t: t,
|
t: t,
|
||||||
objAPITest: testBucketCorsInternalBucketFailsClosed,
|
objAPITest: testBucketCorsResidentConfigSurvivesRefreshFailure,
|
||||||
endpoints: []string{"GetBucketCors"},
|
endpoints: []string{"GetBucketCors"},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBucketCorsInternalBucketFailsClosed(_ ObjectLayer, _ string, _ string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
func testBucketCorsResidentConfigSurvivesRefreshFailure(obj ObjectLayer, _ string, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
||||||
restoreInit := markBucketMetadataInitialized(t)
|
if _, err := updateLocalBucketCORSMetadata(t.Context(), obj, bucket, []byte(testSiteReplicationCORSDoc)); err != nil {
|
||||||
defer restoreInit()
|
t.Fatal(err)
|
||||||
|
|
||||||
wrapped := corsHandler(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
|
||||||
w.WriteHeader(http.StatusNotFound)
|
|
||||||
}))
|
|
||||||
rec := httptest.NewRecorder()
|
|
||||||
req := httptest.NewRequest(http.MethodGet, getGetObjectURL("", minioMetaBucket, "object"), nil)
|
|
||||||
req.Header.Set("Origin", "https://app.example.com")
|
|
||||||
wrapped.ServeHTTP(rec, req)
|
|
||||||
|
|
||||||
if got := rec.Header().Get("Access-Control-Allow-Origin"); got != "" {
|
|
||||||
t.Fatalf("internal bucket fell back to global allow-origin %q", got)
|
|
||||||
}
|
}
|
||||||
if got := rec.Header().Get("Access-Control-Allow-Credentials"); got != "" {
|
sys := globalBucketMetadataSys
|
||||||
t.Fatalf("internal bucket fell back to global credentials %q", got)
|
sys.Lock()
|
||||||
|
sys.noteLoadFailure(bucket)
|
||||||
|
_, marked := sys.loadFailed[bucket]
|
||||||
|
sys.Unlock()
|
||||||
|
if marked {
|
||||||
|
t.Fatal("a resident bucket was recorded as a load failure")
|
||||||
|
}
|
||||||
|
cfg, _, err := sys.GetResidentCorsConfig(bucket)
|
||||||
|
if err != nil || cfg == nil {
|
||||||
|
t.Fatalf("resident CORS configuration lost after a refresh failure: cfg=%v err=%v", cfg, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ func testPeerBucketCorsReplicationOrdering(_ ObjectLayer, _ string, bucket strin
|
|||||||
if !meta.CorsConfigUpdatedAt.Equal(putAt) {
|
if !meta.CorsConfigUpdatedAt.Equal(putAt) {
|
||||||
t.Fatalf("peer PUT timestamp = %v, want source time %v", meta.CorsConfigUpdatedAt, putAt)
|
t.Fatalf("peer PUT timestamp = %v, want source time %v", meta.CorsConfigUpdatedAt, putAt)
|
||||||
}
|
}
|
||||||
cfg, cfgAt, err := globalBucketMetadataSys.GetCorsConfig(bucket)
|
cfg, cfgAt, err := globalBucketMetadataSys.GetResidentCorsConfig(bucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("peer PUT stored raw XML but no parsed config: %v", err)
|
t.Fatalf("peer PUT stored raw XML but no parsed config: %v", err)
|
||||||
}
|
}
|
||||||
@@ -165,10 +165,10 @@ func TestSiteReplicationMetaInfoPreservesCorsTombstone(t *testing.T) {
|
|||||||
|
|
||||||
func testSiteReplicationMetaInfoPreservesCorsTombstone(obj ObjectLayer, _ string, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
func testSiteReplicationMetaInfoPreservesCorsTombstone(obj ObjectLayer, _ string, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
||||||
ctx := t.Context()
|
ctx := t.Context()
|
||||||
if _, err := globalBucketMetadataSys.Update(ctx, bucket, bucketCorsConfig, []byte(testSiteReplicationCORSDoc)); err != nil {
|
if _, err := updateLocalBucketCORSMetadata(ctx, obj, bucket, []byte(testSiteReplicationCORSDoc)); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
deleteAt, err := globalBucketMetadataSys.Delete(ctx, bucket, bucketCorsConfig)
|
deleteAt, err := updateLocalBucketCORSMetadata(ctx, obj, bucket, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -467,25 +467,6 @@ func testAdversarialHealCorsPropagatesNewerEqualValueTimestamp(obj ObjectLayer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAdversarialBucketMetadataComparisonIsBase64CaseSensitive(t *testing.T) {
|
|
||||||
upper := "QQ=="
|
|
||||||
lower := "qQ=="
|
|
||||||
upperBytes, err := base64.StdEncoding.Strict().DecodeString(upper)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
lowerBytes, err := base64.StdEncoding.Strict().DecodeString(lower)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if string(upperBytes) == string(lowerBytes) {
|
|
||||||
t.Fatal("test inputs unexpectedly decode to the same bytes")
|
|
||||||
}
|
|
||||||
if isBucketMetadataEqual(&upper, &lower) {
|
|
||||||
t.Fatal("different decoded payloads were treated as equal")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSiteReplicationStatusDetectsCorsTimestampMismatch(t *testing.T) {
|
func TestSiteReplicationStatusDetectsCorsTimestampMismatch(t *testing.T) {
|
||||||
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
t: t,
|
t: t,
|
||||||
@@ -918,8 +899,8 @@ func testLegacyInvalidCorsMetadataCanBeDeleted(obj ObjectLayer, _ string, bucket
|
|||||||
t.Fatalf("legacy CORS state = (%#v, %v), want fail-closed parse error", loaded.corsConfig, loaded.corsConfigErr)
|
t.Fatalf("legacy CORS state = (%#v, %v), want fail-closed parse error", loaded.corsConfig, loaded.corsConfigErr)
|
||||||
}
|
}
|
||||||
globalBucketMetadataSys.Set(bucket, loaded)
|
globalBucketMetadataSys.Set(bucket, loaded)
|
||||||
if _, gotAt, err := globalBucketMetadataSys.GetCorsConfig(bucket); err == nil || !gotAt.Equal(legacyAt) {
|
if _, gotAt, err := globalBucketMetadataSys.GetResidentCorsConfig(bucket); err == nil || !gotAt.Equal(legacyAt) {
|
||||||
t.Fatalf("GetCorsConfig = timestamp %v, error %v; want legacy timestamp and error", gotAt, err)
|
t.Fatalf("GetResidentCorsConfig = timestamp %v, error %v; want legacy timestamp and error", gotAt, err)
|
||||||
}
|
}
|
||||||
if _, gotAt, err := globalBucketMetadataSys.GetCorsConfigXML(bucket); err == nil || !gotAt.Equal(legacyAt) {
|
if _, gotAt, err := globalBucketMetadataSys.GetCorsConfigXML(bucket); err == nil || !gotAt.Equal(legacyAt) {
|
||||||
t.Fatalf("GetCorsConfigXML = timestamp %v, error %v; want legacy timestamp and error", gotAt, err)
|
t.Fatalf("GetCorsConfigXML = timestamp %v, error %v; want legacy timestamp and error", gotAt, err)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+17
-20
@@ -62,8 +62,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/ioutil"
|
"github.com/minio/minio/internal/ioutil"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/sync/errgroup"
|
"github.com/pgsty/silo-pkg/v3/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -277,14 +277,6 @@ func (api objectAPIHandlers) ListMultipartUploadsHandler(w http.ResponseWriter,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if keyMarker != "" {
|
|
||||||
// Marker not common with prefix is not implemented.
|
|
||||||
if !HasPrefix(keyMarker, prefix) {
|
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
listMultipartsInfo, err := objectAPI.ListMultipartUploads(ctx, bucket, prefix, keyMarker, uploadIDMarker, delimiter, maxUploads)
|
listMultipartsInfo, err := objectAPI.ListMultipartUploads(ctx, bucket, prefix, keyMarker, uploadIDMarker, delimiter, maxUploads)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
@@ -463,13 +455,20 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter,
|
|||||||
// Make sure to update context to print ObjectNames for multi objects.
|
// Make sure to update context to print ObjectNames for multi objects.
|
||||||
ctx = updateReqContext(ctx, objects...)
|
ctx = updateReqContext(ctx, objects...)
|
||||||
|
|
||||||
// Call checkRequestAuthType to populate ReqInfo.AccessKey before GetBucketInfo()
|
|
||||||
// Ignore errors here to preserve the S3 error behavior of GetBucketInfo()
|
|
||||||
checkRequestAuthType(ctx, r, policy.DeleteObjectAction, bucket, "")
|
|
||||||
|
|
||||||
deleteObjectsFn := objectAPI.DeleteObjects
|
deleteObjectsFn := objectAPI.DeleteObjects
|
||||||
|
|
||||||
// Return Malformed XML as S3 spec if the number of objects is empty
|
reqInfo := logger.GetReqInfo(ctx)
|
||||||
|
if reqInfo == nil {
|
||||||
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrAccessDenied), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reqInfo.BucketName = bucket
|
||||||
|
reqInfo.ObjectName = ""
|
||||||
|
if s3Err := authenticateRequest(ctx, r, policy.DeleteObjectAction); s3Err != ErrNone {
|
||||||
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Err), r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Return Malformed XML as S3 spec if the number of objects is empty.
|
||||||
if len(deleteObjectsReq.Objects) == 0 || len(deleteObjectsReq.Objects) > maxDeleteList {
|
if len(deleteObjectsReq.Objects) == 0 || len(deleteObjectsReq.Objects) > maxDeleteList {
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMalformedXML), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrMalformedXML), r.URL)
|
||||||
return
|
return
|
||||||
@@ -499,11 +498,9 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter,
|
|||||||
vc, _ := globalBucketVersioningSys.Get(bucket)
|
vc, _ := globalBucketVersioningSys.Get(bucket)
|
||||||
oss := make([]*objSweeper, len(deleteObjectsReq.Objects))
|
oss := make([]*objSweeper, len(deleteObjectsReq.Objects))
|
||||||
for index, object := range deleteObjectsReq.Objects {
|
for index, object := range deleteObjectsReq.Objects {
|
||||||
if apiErrCode := checkRequestAuthTypeWithVID(ctx, r, policy.DeleteObjectAction, bucket, object.ObjectName, object.VersionID); apiErrCode != ErrNone {
|
reqInfo.ObjectName = object.ObjectName
|
||||||
if apiErrCode == ErrSignatureDoesNotMatch || apiErrCode == ErrInvalidAccessKeyID {
|
reqInfo.VersionID = object.VersionID
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(apiErrCode), r.URL)
|
if apiErrCode := authorizeRequest(ctx, r, deleteObjectAction(object.VersionID)); apiErrCode != ErrNone {
|
||||||
return
|
|
||||||
}
|
|
||||||
apiErr := errorCodes.ToAPIErr(apiErrCode)
|
apiErr := errorCodes.ToAPIErr(apiErrCode)
|
||||||
deleteResults[index].errInfo = DeleteError{
|
deleteResults[index].errInfo = DeleteError{
|
||||||
Code: apiErr.Code,
|
Code: apiErr.Code,
|
||||||
|
|||||||
+29
-16
@@ -425,7 +425,7 @@ func testListMultipartUploadsHandler(obj ObjectLayer, instanceType, bucketName s
|
|||||||
shouldPass: true,
|
shouldPass: true,
|
||||||
},
|
},
|
||||||
// Test case - 4.
|
// Test case - 4.
|
||||||
// Setting Invalid prefix and marker combination.
|
// A key marker outside the prefix is valid and produces an empty page.
|
||||||
{
|
{
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
prefix: "asia",
|
prefix: "asia",
|
||||||
@@ -435,8 +435,8 @@ func testListMultipartUploadsHandler(obj ObjectLayer, instanceType, bucketName s
|
|||||||
maxUploads: "0",
|
maxUploads: "0",
|
||||||
accessKey: credentials.AccessKey,
|
accessKey: credentials.AccessKey,
|
||||||
secretKey: credentials.SecretKey,
|
secretKey: credentials.SecretKey,
|
||||||
expectedRespStatus: http.StatusNotImplemented,
|
expectedRespStatus: http.StatusOK,
|
||||||
shouldPass: false,
|
shouldPass: true,
|
||||||
},
|
},
|
||||||
// Test case - 5.
|
// Test case - 5.
|
||||||
// Invalid upload id and marker combination.
|
// Invalid upload id and marker combination.
|
||||||
@@ -1018,14 +1018,23 @@ func testAPIDeleteMultipleObjectsVersionIDNullCondition(obj ObjectLayer, instanc
|
|||||||
|
|
||||||
policyBytes := fmt.Appendf(nil, `{
|
policyBytes := fmt.Appendf(nil, `{
|
||||||
"Version":"2012-10-17",
|
"Version":"2012-10-17",
|
||||||
"Statement":[{
|
"Statement":[
|
||||||
|
{
|
||||||
"Effect":"Allow",
|
"Effect":"Allow",
|
||||||
"Principal":"*",
|
"Principal":"*",
|
||||||
"Action":"s3:DeleteObject",
|
"Action":"s3:DeleteObject",
|
||||||
"Resource":"arn:aws:s3:::%s/*",
|
"Resource":"arn:aws:s3:::%s/*",
|
||||||
"Condition":{"Null":{"s3:versionid":"true"}}
|
"Condition":{"Null":{"s3:versionid":"true"}}
|
||||||
}]
|
},
|
||||||
}`, bucketName)
|
{
|
||||||
|
"Effect":"Allow",
|
||||||
|
"Principal":"*",
|
||||||
|
"Action":"s3:DeleteObjectVersion",
|
||||||
|
"Resource":"arn:aws:s3:::%s/*",
|
||||||
|
"Condition":{"StringEquals":{"s3:versionid":"%s"}}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}`, bucketName, bucketName, versionIDs["with-version-id"])
|
||||||
policyReq, err := newTestSignedRequestV4(http.MethodPut, getPutPolicyURL("", bucketName), int64(len(policyBytes)),
|
policyReq, err := newTestSignedRequestV4(http.MethodPut, getPutPolicyURL("", bucketName), int64(len(policyBytes)),
|
||||||
bytes.NewReader(policyBytes), credentials.AccessKey, credentials.SecretKey, nil)
|
bytes.NewReader(policyBytes), credentials.AccessKey, credentials.SecretKey, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1071,29 +1080,30 @@ func testAPIDeleteMultipleObjectsVersionIDNullCondition(obj ObjectLayer, instanc
|
|||||||
t.Errorf("%s: %q was not a successful delete-marker creation: %+v", instanceType, objectName, response.DeletedObjects)
|
t.Errorf("%s: %q was not a successful delete-marker creation: %+v", instanceType, objectName, response.DeletedObjects)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(deleted) != 2 {
|
if object, ok := deleted["with-version-id"]; !ok || object.VersionID != versionIDs["with-version-id"] {
|
||||||
|
t.Errorf("%s: matching explicit version was not deleted: %+v", instanceType, response.DeletedObjects)
|
||||||
|
}
|
||||||
|
if len(deleted) != 3 {
|
||||||
t.Errorf("%s: unexpected deleted objects: %+v", instanceType, response.DeletedObjects)
|
t.Errorf("%s: unexpected deleted objects: %+v", instanceType, response.DeletedObjects)
|
||||||
}
|
}
|
||||||
errorsByKey := make(map[string]DeleteError, len(response.Errors))
|
errorsByKey := make(map[string]DeleteError, len(response.Errors))
|
||||||
for _, deleteErr := range response.Errors {
|
for _, deleteErr := range response.Errors {
|
||||||
errorsByKey[deleteErr.Key] = deleteErr
|
errorsByKey[deleteErr.Key] = deleteErr
|
||||||
}
|
}
|
||||||
for objectName, versionID := range map[string]string{
|
for objectName, versionID := range map[string]string{"with-null-version-id": nullVersionID} {
|
||||||
"with-version-id": versionIDs["with-version-id"],
|
|
||||||
"with-null-version-id": nullVersionID,
|
|
||||||
} {
|
|
||||||
deleteErr, ok := errorsByKey[objectName]
|
deleteErr, ok := errorsByKey[objectName]
|
||||||
if !ok || deleteErr.VersionID != versionID || deleteErr.Code != errorCodes[ErrAccessDenied].Code {
|
if !ok || deleteErr.VersionID != versionID || deleteErr.Code != errorCodes[ErrAccessDenied].Code {
|
||||||
t.Errorf("%s: %q did not return AccessDenied for version %q: %+v", instanceType, objectName, versionID, response.Errors)
|
t.Errorf("%s: %q did not return AccessDenied for version %q: %+v", instanceType, objectName, versionID, response.Errors)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(errorsByKey) != 2 {
|
if len(errorsByKey) != 1 {
|
||||||
t.Errorf("%s: unexpected delete errors: %+v", instanceType, response.Errors)
|
t.Errorf("%s: unexpected delete errors: %+v", instanceType, response.Errors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A simple delete adds a marker and keeps the old version. The explicitly
|
// A simple delete adds a marker and keeps the old version. The null-version
|
||||||
// named version must also remain because its policy condition did not match.
|
// delete remains denied because its per-entry condition does not match.
|
||||||
for objectName, versionID := range versionIDs {
|
for _, objectName := range []string{"without-version-id-before", "without-version-id-after", "with-null-version-id"} {
|
||||||
|
versionID := versionIDs[objectName]
|
||||||
if _, err = obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{VersionID: versionID}); err != nil {
|
if _, err = obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{VersionID: versionID}); err != nil {
|
||||||
t.Errorf("%s: version %s of %q was not preserved: %v", instanceType, versionID, objectName, err)
|
t.Errorf("%s: version %s of %q was not preserved: %v", instanceType, versionID, objectName, err)
|
||||||
}
|
}
|
||||||
@@ -1103,7 +1113,10 @@ func testAPIDeleteMultipleObjectsVersionIDNullCondition(obj ObjectLayer, instanc
|
|||||||
t.Errorf("%s: simple delete of %q did not hide the latest object behind a delete marker: %v", instanceType, objectName, err)
|
t.Errorf("%s: simple delete of %q did not hide the latest object behind a delete marker: %v", instanceType, objectName, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, objectName := range []string{"with-version-id", "with-null-version-id"} {
|
if _, err = obj.GetObjectInfo(t.Context(), bucketName, "with-version-id", ObjectOptions{VersionID: versionIDs["with-version-id"]}); !isErrVersionNotFound(err) && !isErrObjectNotFound(err) {
|
||||||
|
t.Errorf("%s: matching explicit version still exists: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
for _, objectName := range []string{"with-null-version-id"} {
|
||||||
if info, err := obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{}); err != nil {
|
if info, err := obj.GetObjectInfo(t.Context(), bucketName, objectName, ObjectOptions{}); err != nil {
|
||||||
t.Errorf("%s: denied version delete removed latest %q: %v", instanceType, objectName, err)
|
t.Errorf("%s: denied version delete removed latest %q: %v", instanceType, objectName, err)
|
||||||
} else if info.VersionID != versionIDs[objectName] {
|
} else if info.VersionID != versionIDs[objectName] {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import (
|
|||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import (
|
|||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/minio/internal/s3select"
|
"github.com/minio/minio/internal/s3select"
|
||||||
xnet "github.com/minio/pkg/v3/net"
|
xnet "github.com/pgsty/silo-pkg/v3/net"
|
||||||
"github.com/zeebo/xxh3"
|
"github.com/zeebo/xxh3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
|
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Validate all the ListObjects query arguments, returns an APIErrorCode
|
// Validate all the ListObjects query arguments, returns an APIErrorCode
|
||||||
|
|||||||
@@ -0,0 +1,455 @@
|
|||||||
|
// Copyright (c) 2015-2026 MinIO, Inc.
|
||||||
|
// Copyright (c) 2026 PGSTY
|
||||||
|
//
|
||||||
|
// This file is part of MinIO Object Storage stack
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/madmin-go/v3"
|
||||||
|
"github.com/minio/minio/internal/auth"
|
||||||
|
"github.com/minio/minio/internal/bucket/lifecycle"
|
||||||
|
"github.com/minio/minio/internal/bucket/versioning"
|
||||||
|
)
|
||||||
|
|
||||||
|
type metadataRMWWriterKey struct{}
|
||||||
|
|
||||||
|
type metadataRMWBarrierObjectLayer struct {
|
||||||
|
ObjectLayer
|
||||||
|
bucket string
|
||||||
|
aReady chan struct{}
|
||||||
|
aRelease chan struct{}
|
||||||
|
bLockAttempt chan struct{}
|
||||||
|
aReadyOnce sync.Once
|
||||||
|
bLockOnce sync.Once
|
||||||
|
cancelOnce sync.Once
|
||||||
|
cancelOnPut context.CancelFunc
|
||||||
|
reads atomic.Int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *metadataRMWBarrierObjectLayer) metadataObject() string {
|
||||||
|
return pathJoin(bucketMetaPrefix, o.bucket, bucketMetadataFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *metadataRMWBarrierObjectLayer) metadataLock() string {
|
||||||
|
return pathJoin(bucketMetaPrefix, o.bucket, "metadata.lock")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *metadataRMWBarrierObjectLayer) GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, opts ObjectOptions) (*GetObjectReader, error) {
|
||||||
|
if bucket == minioMetaBucket && object == o.metadataObject() {
|
||||||
|
o.reads.Add(1)
|
||||||
|
}
|
||||||
|
return o.ObjectLayer.GetObjectNInfo(ctx, bucket, object, rs, h, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *metadataRMWBarrierObjectLayer) PutObject(ctx context.Context, bucket, object string, data *PutObjReader, opts ObjectOptions) (ObjectInfo, error) {
|
||||||
|
if bucket == minioMetaBucket && object == o.metadataObject() && o.cancelOnPut != nil {
|
||||||
|
o.cancelOnce.Do(o.cancelOnPut)
|
||||||
|
}
|
||||||
|
if bucket == minioMetaBucket && object == o.metadataObject() && ctx.Value(metadataRMWWriterKey{}) == "A" {
|
||||||
|
o.aReadyOnce.Do(func() { close(o.aReady) })
|
||||||
|
select {
|
||||||
|
case <-o.aRelease:
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ObjectInfo{}, ctx.Err()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o.ObjectLayer.PutObject(ctx, bucket, object, data, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *metadataRMWBarrierObjectLayer) NewNSLock(bucket string, objects ...string) RWLocker {
|
||||||
|
lock := o.ObjectLayer.NewNSLock(bucket, objects...)
|
||||||
|
if bucket != minioMetaBucket || len(objects) != 1 || objects[0] != o.metadataLock() {
|
||||||
|
return lock
|
||||||
|
}
|
||||||
|
return metadataObservedRWLocker{RWLocker: lock, onLock: func(ctx context.Context) {
|
||||||
|
if ctx.Value(metadataRMWWriterKey{}) == "B" {
|
||||||
|
o.bLockOnce.Do(func() { close(o.bLockAttempt) })
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
type metadataObservedRWLocker struct {
|
||||||
|
RWLocker
|
||||||
|
onLock func(context.Context)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l metadataObservedRWLocker) GetLock(ctx context.Context, timeout *dynamicTimeout) (LockContext, error) {
|
||||||
|
l.onLock(ctx)
|
||||||
|
return l.RWLocker.GetLock(ctx, timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBucketMetadataLockPreservesPolicyAndCORS(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testBucketMetadataLockPreservesPolicyAndCORS,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBucketMetadataLockPreservesPolicyAndCORS(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
policyJSON := fmt.Appendf(nil, `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::%s/*"}]}`, bucket)
|
||||||
|
corsXML := []byte(testSiteReplicationCORSDoc)
|
||||||
|
runBucketMetadataRMWConflict(t, obj, bucket,
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, policyJSON)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := updateLocalBucketCORSMetadata(ctx, objectAPI, bucket, corsXML)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(meta BucketMetadata) bool {
|
||||||
|
return bytes.Equal(meta.PolicyConfigJSON, policyJSON) && bytes.Equal(meta.CorsConfigXML, corsXML)
|
||||||
|
}, instanceType+": policy+CORS")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBucketMetadataLockPreservesTaggingAndSSE(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testBucketMetadataLockPreservesTaggingAndSSE,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBucketMetadataLockPreservesPeerBulkAndLocalUpdate(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testBucketMetadataLockPreservesPeerBulkAndLocalUpdate,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBucketMetadataLockPreservesPeerBulkAndLocalUpdate(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
meta, err := readBucketMetadata(t.Context(), obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
policyJSON := fmt.Appendf(nil, `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::%s/*"}]}`, bucket)
|
||||||
|
tagXML := []byte(`<Tagging><TagSet><Tag><Key>local</Key><Value>tag</Value></Tag></TagSet></Tagging>`)
|
||||||
|
runBucketMetadataRMWConflict(t, obj, bucket,
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
return globalSiteReplicationSys.PeerBucketMetadataUpdateHandler(ctx, madmin.SRBucketMeta{
|
||||||
|
Bucket: bucket, Policy: policyJSON, UpdatedAt: meta.Created.Add(time.Second),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, tagXML)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(meta BucketMetadata) bool {
|
||||||
|
return bytes.Equal(meta.PolicyConfigJSON, policyJSON) && bytes.Equal(meta.TaggingConfigXML, tagXML)
|
||||||
|
}, instanceType+": peer bulk+local tagging")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBucketMetadataLockPreservesLifecycleDeleteAndSSE(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testBucketMetadataLockPreservesLifecycleDeleteAndSSE,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBucketMetadataLockPreservesLifecycleDeleteAndSSE(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
lifecycleXML := []byte(`<LifecycleConfiguration><Rule><ID>expire</ID><Filter><Prefix>logs/</Prefix></Filter><Status>Enabled</Status><Expiration><Days>30</Days></Expiration></Rule></LifecycleConfiguration>`)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(t.Context(), bucket, bucketLifecycleConfig, lifecycleXML); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
sseXML := []byte(`<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Rule><ApplyServerSideEncryptionByDefault><SSEAlgorithm>AES256</SSEAlgorithm></ApplyServerSideEncryptionByDefault></Rule></ServerSideEncryptionConfiguration>`)
|
||||||
|
runBucketMetadataRMWConflict(t, obj, bucket,
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Delete(ctx, bucket, bucketLifecycleConfig)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, sseXML)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(meta BucketMetadata) bool {
|
||||||
|
cfg, err := lifecycle.ParseLifecycleConfig(bytes.NewReader(meta.LifecycleConfigXML))
|
||||||
|
return err == nil && cfg.ExpiryUpdatedAt != nil && len(cfg.Rules) == 0 && bytes.Equal(meta.EncryptionConfigXML, sseXML)
|
||||||
|
}, instanceType+": lifecycle delete+SSE")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMakeBucketForceCreatePreservesMetadata(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testMakeBucketForceCreatePreservesMetadata,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testMakeBucketForceCreatePreservesMetadata(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
ctx := t.Context()
|
||||||
|
policyJSON := fmt.Appendf(nil, `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::%s/*"}]}`, bucket)
|
||||||
|
corsXML := []byte(testSiteReplicationCORSDoc)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, policyJSON); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err := updateLocalBucketCORSMetadata(ctx, obj, bucket, corsXML); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
before, err := readBucketMetadata(ctx, obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{ForceCreate: true}); err != nil {
|
||||||
|
t.Fatalf("%s: ForceCreate existing bucket: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
after, err := readBucketMetadata(ctx, obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !after.Created.Equal(before.Created) || !bytes.Equal(after.PolicyConfigJSON, policyJSON) || !bytes.Equal(after.CorsConfigXML, corsXML) {
|
||||||
|
t.Fatalf("%s: ForceCreate replaced metadata: before=%+v after=%+v", instanceType, before, after)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestApplyImportedBucketMetadataPreservesUnspecifiedFields(t *testing.T) {
|
||||||
|
policyJSON := []byte(`{"Version":"2012-10-17","Statement":[]}`)
|
||||||
|
tagXML := []byte(`<Tagging><TagSet><Tag><Key>existing</Key><Value>tag</Value></Tag></TagSet></Tagging>`)
|
||||||
|
src := newBucketMetadata("bucket")
|
||||||
|
src.PolicyConfigJSON = policyJSON
|
||||||
|
src.PolicyConfigUpdatedAt = UTCNow()
|
||||||
|
dst := newBucketMetadata("bucket")
|
||||||
|
dst.TaggingConfigXML = bytes.Clone(tagXML)
|
||||||
|
|
||||||
|
applyImportedBucketMetadata(&dst, src, importMetadataFields{bucketPolicyConfig: {}})
|
||||||
|
if !bytes.Equal(dst.PolicyConfigJSON, policyJSON) || !bytes.Equal(dst.TaggingConfigXML, tagXML) {
|
||||||
|
t.Fatalf("import patch overwrote unspecified metadata: %+v", dst)
|
||||||
|
}
|
||||||
|
src.PolicyConfigJSON[0] = '!'
|
||||||
|
if dst.PolicyConfigJSON[0] == '!' {
|
||||||
|
t.Fatal("import patch retained the source byte slice")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMakeBucketDoesNotAdoptGhostMetadata(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testMakeBucketDoesNotAdoptGhostMetadata,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testMakeBucketDoesNotAdoptGhostMetadata(obj ObjectLayer, instanceType, _ string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
ctx := t.Context()
|
||||||
|
bucket := getRandomBucketName()
|
||||||
|
if err := obj.MakeBucket(ctx, bucket, MakeBucketOptions{}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
policyJSON := fmt.Appendf(nil, `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::%s/*"}]}`, bucket)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, policyJSON); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
oldMeta, err := readBucketMetadata(ctx, obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
z, ok := obj.(*erasureServerPools)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("%s: object layer is %T, want *erasureServerPools", instanceType, obj)
|
||||||
|
}
|
||||||
|
if err = z.s3Peer.DeleteBucket(ctx, bucket, DeleteBucketOptions{Force: true}); err != nil {
|
||||||
|
t.Fatalf("%s: delete bucket volume only: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
if err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{}); err != nil {
|
||||||
|
t.Fatalf("%s: recreate bucket: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
newMeta, err := readBucketMetadata(ctx, obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if bytes.Equal(newMeta.PolicyConfigJSON, policyJSON) || newMeta.Created.Equal(oldMeta.Created) {
|
||||||
|
t.Fatalf("%s: new bucket adopted ghost metadata: old=%+v new=%+v", instanceType, oldMeta, newMeta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMakeBucketForceCreateLockEnablesVersioning(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testMakeBucketForceCreateLockEnablesVersioning,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestPeerBucketMetadataSaveSurvivesCallerCancellation(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testPeerBucketMetadataSaveSurvivesCallerCancellation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testPeerBucketMetadataSaveSurvivesCallerCancellation(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
previousObjectAPI := newObjectLayerFn()
|
||||||
|
ctx, cancel := context.WithCancel(t.Context())
|
||||||
|
barrier := &metadataRMWBarrierObjectLayer{
|
||||||
|
ObjectLayer: obj,
|
||||||
|
bucket: bucket,
|
||||||
|
cancelOnPut: cancel,
|
||||||
|
}
|
||||||
|
setObjectLayer(barrier)
|
||||||
|
defer setObjectLayer(previousObjectAPI)
|
||||||
|
|
||||||
|
err := globalSiteReplicationSys.PeerBucketMakeWithVersioningHandler(ctx, bucket, MakeBucketOptions{VersioningEnabled: true})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s: peer metadata save failed after caller cancellation: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
if ctx.Err() != context.Canceled {
|
||||||
|
t.Fatalf("%s: metadata write did not trigger caller cancellation", instanceType)
|
||||||
|
}
|
||||||
|
meta, err := readBucketMetadata(t.Context(), obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
cfg, err := versioning.ParseConfig(bytes.NewReader(meta.VersioningConfigXML))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !cfg.Enabled() {
|
||||||
|
t.Fatalf("%s: peer metadata save lost versioning after cancellation", instanceType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testMakeBucketForceCreateLockEnablesVersioning(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
ctx := t.Context()
|
||||||
|
suspended := []byte(`<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Status>Suspended</Status></VersioningConfiguration>`)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(ctx, bucket, bucketVersioningConfig, suspended); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := obj.MakeBucket(ctx, bucket, MakeBucketOptions{ForceCreate: true, LockEnabled: true}); err != nil {
|
||||||
|
t.Fatalf("%s: ForceCreate with object lock: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
meta, err := readBucketMetadata(ctx, obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
cfg, err := versioning.ParseConfig(bytes.NewReader(meta.VersioningConfigXML))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !cfg.Enabled() || len(meta.ObjectLockConfigXML) == 0 {
|
||||||
|
t.Fatalf("%s: object lock state lacks enabled versioning: metadata=%+v", instanceType, meta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testBucketMetadataLockPreservesTaggingAndSSE(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
tagXML := []byte(`<Tagging><TagSet><Tag><Key>key</Key><Value>value</Value></Tag></TagSet></Tagging>`)
|
||||||
|
sseXML := []byte(`<ServerSideEncryptionConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Rule><ApplyServerSideEncryptionByDefault><SSEAlgorithm>AES256</SSEAlgorithm></ApplyServerSideEncryptionByDefault></Rule></ServerSideEncryptionConfiguration>`)
|
||||||
|
runBucketMetadataRMWConflict(t, obj, bucket,
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, tagXML)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(ctx context.Context, objectAPI ObjectLayer) error {
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, sseXML)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
func(meta BucketMetadata) bool {
|
||||||
|
return bytes.Equal(meta.TaggingConfigXML, tagXML) && bytes.Equal(meta.EncryptionConfigXML, sseXML)
|
||||||
|
}, instanceType+": tagging+SSE")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runBucketMetadataRMWConflict(t *testing.T, obj ObjectLayer, bucket string,
|
||||||
|
writerA, writerB func(context.Context, ObjectLayer) error,
|
||||||
|
complete func(BucketMetadata) bool, name string,
|
||||||
|
) {
|
||||||
|
t.Helper()
|
||||||
|
previousObjectAPI := newObjectLayerFn()
|
||||||
|
barrier := &metadataRMWBarrierObjectLayer{
|
||||||
|
ObjectLayer: obj,
|
||||||
|
bucket: bucket,
|
||||||
|
aReady: make(chan struct{}),
|
||||||
|
aRelease: make(chan struct{}),
|
||||||
|
bLockAttempt: make(chan struct{}),
|
||||||
|
}
|
||||||
|
setObjectLayer(barrier)
|
||||||
|
defer setObjectLayer(previousObjectAPI)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(t.Context(), 10*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
aCtx := context.WithValue(ctx, metadataRMWWriterKey{}, "A")
|
||||||
|
bCtx := context.WithValue(ctx, metadataRMWWriterKey{}, "B")
|
||||||
|
aDone := make(chan error, 1)
|
||||||
|
bDone := make(chan error, 1)
|
||||||
|
go func() { aDone <- writerA(aCtx, barrier) }()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-barrier.aReady:
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatalf("%s: writer A did not reach metadata save: %v", name, ctx.Err())
|
||||||
|
}
|
||||||
|
go func() { bDone <- writerB(bCtx, barrier) }()
|
||||||
|
|
||||||
|
var (
|
||||||
|
bErr error
|
||||||
|
bFinished bool
|
||||||
|
)
|
||||||
|
select {
|
||||||
|
case <-barrier.bLockAttempt:
|
||||||
|
if got := barrier.reads.Load(); got != 1 {
|
||||||
|
t.Fatalf("%s: writer B read metadata before acquiring metadata.lock: reads=%d", name, got)
|
||||||
|
}
|
||||||
|
case bErr = <-bDone:
|
||||||
|
bFinished = true
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatalf("%s: writer B neither completed nor attempted metadata.lock: %v", name, ctx.Err())
|
||||||
|
}
|
||||||
|
close(barrier.aRelease)
|
||||||
|
if err := <-aDone; err != nil {
|
||||||
|
t.Fatalf("%s: writer A failed: %v", name, err)
|
||||||
|
}
|
||||||
|
if !bFinished {
|
||||||
|
select {
|
||||||
|
case bErr = <-bDone:
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatalf("%s: writer B did not finish: %v", name, ctx.Err())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if bErr != nil {
|
||||||
|
t.Fatalf("%s: writer B failed: %v", name, bErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
disk, err := readBucketMetadata(ctx, barrier, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s: read disk metadata: %v", name, err)
|
||||||
|
}
|
||||||
|
resident, err := globalBucketMetadataSys.Get(bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s: read resident metadata: %v", name, err)
|
||||||
|
}
|
||||||
|
if !complete(disk) || !complete(resident) {
|
||||||
|
t.Fatalf("%s: concurrent updates lost a field: disk=%+v resident=%+v", name, disk, resident)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
// Copyright 2026 PGSTY contributors.
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio/internal/auth"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDeleteBucketMetadataLockCancellation(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{t: t, objAPITest: testDeleteBucketMetadataLockCancellation})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testDeleteBucketMetadataLockCancellation(obj ObjectLayer, instanceType, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
||||||
|
_, unlock, err := lockBucketMetadata(t.Context(), obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
release := sync.OnceFunc(unlock)
|
||||||
|
defer release()
|
||||||
|
|
||||||
|
// Observe DeleteBucket's ACTUAL metadata.lock attempt. Set the hook after
|
||||||
|
// our own acquisition above so it only trips on the delete.
|
||||||
|
delAtLock := make(chan struct{})
|
||||||
|
var once sync.Once
|
||||||
|
hook := func(b string) {
|
||||||
|
if b == bucket {
|
||||||
|
once.Do(func() { close(delAtLock) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockBucketMetadataAcquireHook.Store(&hook)
|
||||||
|
defer lockBucketMetadataAcquireHook.Store(nil)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(t.Context())
|
||||||
|
defer cancel()
|
||||||
|
done := make(chan error, 1)
|
||||||
|
go func() { done <- obj.DeleteBucket(ctx, bucket, DeleteBucketOptions{Force: true, NoLock: true}) }()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-delAtLock:
|
||||||
|
// Fixed tree: the delete reached metadata.lock and is blocking on the
|
||||||
|
// lock we hold. Cancel it and confirm it fails WITHOUT deleting, while we
|
||||||
|
// still hold the lock (release stays deferred until after the checks).
|
||||||
|
cancel()
|
||||||
|
if err := <-done; err == nil {
|
||||||
|
t.Errorf("%s: canceled deletion succeeded", instanceType)
|
||||||
|
}
|
||||||
|
if _, err := obj.GetBucketInfo(t.Context(), bucket, BucketOptions{}); err != nil {
|
||||||
|
t.Errorf("%s: bucket disappeared while metadata.lock was held: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
if _, err := readBucketMetadata(t.Context(), obj, bucket); err != nil {
|
||||||
|
t.Errorf("%s: canceled deletion removed metadata: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
case err := <-done:
|
||||||
|
// Broken tree: the delete finished without ever taking metadata.lock,
|
||||||
|
// i.e. it did not serialize the destructive operation behind the lock.
|
||||||
|
t.Errorf("%s: delete bypassed metadata.lock (err=%v)", instanceType, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQueuedMetadataUpdateAfterDelete(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
for _, expiry := range []bool{false, true} {
|
||||||
|
t.Run(fmt.Sprintf("expiry=%v", expiry), func(t *testing.T) {
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{t: t, objAPITest: func(obj ObjectLayer, instanceType, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
||||||
|
previous := newObjectLayerFn()
|
||||||
|
barrier := &lcMergeBarrier{ObjectLayer: obj, bucket: bucket, mAtLock: make(chan struct{}), mProceed: make(chan struct{})}
|
||||||
|
setObjectLayer(barrier)
|
||||||
|
defer setObjectLayer(previous)
|
||||||
|
release := sync.OnceFunc(func() { close(barrier.mProceed) })
|
||||||
|
defer release()
|
||||||
|
ctx, cancel := context.WithTimeout(t.Context(), 10*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
ctx = context.WithValue(ctx, lcMergeWriterKey{}, "M")
|
||||||
|
done := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
if expiry {
|
||||||
|
done <- globalBucketMetadataSys.UpdateExpiryLCConfig(ctx, bucket, nil, UTCNow())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err := globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, []byte(`<Tagging><TagSet/></Tagging>`))
|
||||||
|
done <- err
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case <-barrier.mAtLock:
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatal("writer did not reach metadata.lock")
|
||||||
|
}
|
||||||
|
if err := obj.DeleteBucket(t.Context(), bucket, DeleteBucketOptions{Force: true}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
release()
|
||||||
|
if err := <-done; !isErrBucketNotFound(err) {
|
||||||
|
t.Errorf("%s: queued update should reject a deleted bucket, got %v", instanceType, err)
|
||||||
|
}
|
||||||
|
if _, err := readBucketMetadata(t.Context(), obj, bucket); !errors.Is(err, errConfigNotFound) && !isErrBucketNotFound(err) {
|
||||||
|
t.Errorf("%s: queued update recreated metadata: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
// Copyright (c) 2015-2026 MinIO, Inc.
|
||||||
|
// Copyright (c) 2026 PGSTY
|
||||||
|
//
|
||||||
|
// This file is part of MinIO Object Storage stack
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio/internal/auth"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Target 1 (issue #105): a higher-level lifecycle XML merge racing another
|
||||||
|
// bucket-metadata transition outside BucketMetadataSys.Delete.
|
||||||
|
//
|
||||||
|
// Before the fix, PeerBucketLCConfigHandler / healBucketILMExpiry read the
|
||||||
|
// current lifecycle document without metadata.lock, merged the replicated expiry
|
||||||
|
// rules with the local transition rules, and then persisted the merged blob with
|
||||||
|
// BucketMetadataSys.Update. Update re-read the record under metadata.lock but
|
||||||
|
// overwrote LifecycleConfigXML wholesale with the pre-computed blob, so any
|
||||||
|
// lifecycle transition change committed between the merge read and the merge
|
||||||
|
// write was silently lost on disk. BucketMetadataSys.UpdateExpiryLCConfig now
|
||||||
|
// performs the read, merge, and save under a single metadata.lock. This test
|
||||||
|
// drives PeerBucketLCConfigHandler and asserts the concurrent change survives.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
type lcMergeWriterKey struct{}
|
||||||
|
|
||||||
|
// lcMergeBarrier pauses the merge writer (context value "M") exactly when it
|
||||||
|
// tries to take metadata.lock for its persisting Update. By that point the
|
||||||
|
// merge has already read the stale lifecycle document, so the test can commit a
|
||||||
|
// concurrent transition change before releasing the merge write.
|
||||||
|
type lcMergeBarrier struct {
|
||||||
|
ObjectLayer
|
||||||
|
bucket string
|
||||||
|
mAtLock chan struct{}
|
||||||
|
mProceed chan struct{}
|
||||||
|
mOnce sync.Once
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *lcMergeBarrier) metadataLock() string {
|
||||||
|
return pathJoin(bucketMetaPrefix, o.bucket, "metadata.lock")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *lcMergeBarrier) NewNSLock(bucket string, objects ...string) RWLocker {
|
||||||
|
lock := o.ObjectLayer.NewNSLock(bucket, objects...)
|
||||||
|
if bucket != minioMetaBucket || len(objects) != 1 || objects[0] != o.metadataLock() {
|
||||||
|
return lock
|
||||||
|
}
|
||||||
|
return metadataObservedRWLocker{RWLocker: lock, onLock: func(ctx context.Context) {
|
||||||
|
if ctx.Value(lcMergeWriterKey{}) != "M" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
o.mOnce.Do(func() { close(o.mAtLock) })
|
||||||
|
select {
|
||||||
|
case <-o.mProceed:
|
||||||
|
case <-ctx.Done():
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLifecycleExpiryMergeRaceLosesConcurrentTransition(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testLifecycleExpiryMergeRaceLosesConcurrentTransition,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testLifecycleExpiryMergeRaceLosesConcurrentTransition(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
// Revision N: a single transition-only rule.
|
||||||
|
baseXML := []byte(`<LifecycleConfiguration><Rule><ID>keep</ID><Filter><Prefix>data/</Prefix></Filter><Status>Enabled</Status><Transition><Days>30</Days><StorageClass>WARM</StorageClass></Transition></Rule></LifecycleConfiguration>`)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(t.Context(), bucket, bucketLifecycleConfig, baseXML); err != nil {
|
||||||
|
t.Fatalf("%s: seed lifecycle: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A replicated expiry-only rule arriving from a peer site.
|
||||||
|
expXML := `<LifecycleConfiguration><Rule><ID>expire</ID><Filter><Prefix>tmp/</Prefix></Filter><Status>Enabled</Status><Expiration><Days>7</Days></Expiration></Rule></LifecycleConfiguration>`
|
||||||
|
expLCConfig := base64.StdEncoding.EncodeToString([]byte(expXML))
|
||||||
|
|
||||||
|
previousObjectAPI := newObjectLayerFn()
|
||||||
|
barrier := &lcMergeBarrier{
|
||||||
|
ObjectLayer: obj,
|
||||||
|
bucket: bucket,
|
||||||
|
mAtLock: make(chan struct{}),
|
||||||
|
mProceed: make(chan struct{}),
|
||||||
|
}
|
||||||
|
setObjectLayer(barrier)
|
||||||
|
defer setObjectLayer(previousObjectAPI)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
mCtx := context.WithValue(ctx, lcMergeWriterKey{}, "M")
|
||||||
|
|
||||||
|
mDone := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
mDone <- globalSiteReplicationSys.PeerBucketLCConfigHandler(mCtx, bucket, &expLCConfig, UTCNow())
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Wait until the merge writer has read revision N and is about to persist.
|
||||||
|
select {
|
||||||
|
case <-barrier.mAtLock:
|
||||||
|
case err := <-mDone:
|
||||||
|
t.Fatalf("%s: merge writer finished before persisting: %v", instanceType, err)
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatalf("%s: merge writer never reached metadata.lock: %v", instanceType, ctx.Err())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Concurrent local lifecycle transition change commits revision N+1.
|
||||||
|
concurrentXML := []byte(`<LifecycleConfiguration><Rule><ID>keep</ID><Filter><Prefix>data/</Prefix></Filter><Status>Enabled</Status><Transition><Days>10</Days><StorageClass>COLD</StorageClass></Transition></Rule></LifecycleConfiguration>`)
|
||||||
|
if _, err := globalBucketMetadataSys.Update(ctx, bucket, bucketLifecycleConfig, concurrentXML); err != nil {
|
||||||
|
t.Fatalf("%s: concurrent transition update: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release the merge write so it lands after the concurrent commit.
|
||||||
|
close(barrier.mProceed)
|
||||||
|
if err := <-mDone; err != nil {
|
||||||
|
t.Fatalf("%s: merge writer failed: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The persisted lifecycle must contain both the replicated expiry rule and
|
||||||
|
// the concurrent transition change.
|
||||||
|
cfg, _, err := globalBucketMetadataSys.GetLifecycleConfig(bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s: read merged lifecycle: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
var keep, expire bool
|
||||||
|
for i := range cfg.Rules {
|
||||||
|
switch cfg.Rules[i].ID {
|
||||||
|
case "keep":
|
||||||
|
keep = true
|
||||||
|
if cfg.Rules[i].Transition.Days != 10 || cfg.Rules[i].Transition.StorageClass != "COLD" {
|
||||||
|
t.Fatalf("%s: lifecycle merge overwrote the concurrent transition change: got Days=%d StorageClass=%q, want Days=10 StorageClass=COLD",
|
||||||
|
instanceType, cfg.Rules[i].Transition.Days, cfg.Rules[i].Transition.StorageClass)
|
||||||
|
}
|
||||||
|
case "expire":
|
||||||
|
expire = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !expire {
|
||||||
|
t.Fatalf("%s: merged lifecycle dropped the replicated expiry rule: %+v", instanceType, cfg.Rules)
|
||||||
|
}
|
||||||
|
if !keep {
|
||||||
|
t.Fatalf("%s: merged lifecycle dropped the transition rule entirely: %+v", instanceType, cfg.Rules)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Target 2 (issue #105): DeleteBucket racing an in-flight metadata writer must
|
||||||
|
// not resurrect a ghost .metadata.bin record.
|
||||||
|
//
|
||||||
|
// Before the fix, erasureServerPools.DeleteBucket took only <bucket>.lck and
|
||||||
|
// purged the metadata prefix while config writers (updateAndParse) took only
|
||||||
|
// metadata.lock, so a writer already MID-SAVE (holding metadata.lock, past
|
||||||
|
// saveMetadata's existence recheck) could persist .metadata.bin after the purge.
|
||||||
|
// DeleteBucket now takes metadata.lock before deleting, so it waits for that
|
||||||
|
// writer and then purges whatever the writer wrote.
|
||||||
|
//
|
||||||
|
// This test isolates the DeleteBucket-lock fix specifically: the writer holds
|
||||||
|
// metadata.lock and is paused at the .metadata.bin PutObject, so the earlier
|
||||||
|
// saveMetadata existence recheck cannot save it — only serializing the delete
|
||||||
|
// behind the writer can. Removing just DeleteBucket's metadata.lock (keeping the
|
||||||
|
// recheck) therefore makes this test fail. The delete's ACTUAL metadata.lock
|
||||||
|
// attempt is observed with lockBucketMetadataAcquireHook (its lock is taken
|
||||||
|
// through the erasureServerPools receiver, invisible to the object-layer
|
||||||
|
// barrier), so the handshake is deterministic with no timing assumption.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func TestDeleteBucketResurrectsGhostMetadata(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{
|
||||||
|
t: t,
|
||||||
|
objAPITest: testDeleteBucketResurrectsGhostMetadata,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testDeleteBucketResurrectsGhostMetadata(obj ObjectLayer, instanceType, bucket string,
|
||||||
|
_ http.Handler, _ auth.Credentials, t *testing.T,
|
||||||
|
) {
|
||||||
|
previousObjectAPI := newObjectLayerFn()
|
||||||
|
// Writer A holds metadata.lock and pauses at the .metadata.bin PutObject,
|
||||||
|
// i.e. already past saveMetadata's existence recheck and mid-save.
|
||||||
|
barrier := &metadataRMWBarrierObjectLayer{
|
||||||
|
ObjectLayer: obj,
|
||||||
|
bucket: bucket,
|
||||||
|
aReady: make(chan struct{}),
|
||||||
|
aRelease: make(chan struct{}),
|
||||||
|
bLockAttempt: make(chan struct{}),
|
||||||
|
}
|
||||||
|
setObjectLayer(barrier)
|
||||||
|
defer setObjectLayer(previousObjectAPI)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
aCtx := context.WithValue(ctx, metadataRMWWriterKey{}, "A")
|
||||||
|
|
||||||
|
policyJSON := []byte(`{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::` + bucket + `/*"}]}`)
|
||||||
|
aReleased := sync.OnceFunc(func() { close(barrier.aRelease) })
|
||||||
|
defer aReleased()
|
||||||
|
aDone := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
_, err := globalBucketMetadataSys.Update(aCtx, bucket, bucketPolicyConfig, policyJSON)
|
||||||
|
aDone <- err
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-barrier.aReady:
|
||||||
|
case err := <-aDone:
|
||||||
|
t.Fatalf("%s: writer A finished before persisting: %v", instanceType, err)
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatalf("%s: writer A never reached metadata save: %v", instanceType, ctx.Err())
|
||||||
|
}
|
||||||
|
|
||||||
|
// A now holds metadata.lock mid-save. Observe DeleteBucket's ACTUAL
|
||||||
|
// metadata.lock attempt via the acquire hook, set only now so A's earlier
|
||||||
|
// acquisition does not trip it.
|
||||||
|
delAtLock := make(chan struct{})
|
||||||
|
var once sync.Once
|
||||||
|
hook := func(b string) {
|
||||||
|
if b == bucket {
|
||||||
|
once.Do(func() { close(delAtLock) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lockBucketMetadataAcquireHook.Store(&hook)
|
||||||
|
defer lockBucketMetadataAcquireHook.Store(nil)
|
||||||
|
|
||||||
|
delDone := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
delDone <- obj.DeleteBucket(ctx, bucket, DeleteBucketOptions{Force: true})
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-delAtLock:
|
||||||
|
// Fixed tree: DeleteBucket reached metadata.lock and blocks on A. Release
|
||||||
|
// A so it finishes its save and unlocks; the delete then acquires the
|
||||||
|
// lock and purges the record A wrote.
|
||||||
|
aReleased()
|
||||||
|
if err := <-aDone; err != nil {
|
||||||
|
t.Fatalf("%s: writer A save failed while holding metadata.lock: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
if err := <-delDone; err != nil {
|
||||||
|
t.Fatalf("%s: delete bucket: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
case err := <-delDone:
|
||||||
|
// Broken tree: DeleteBucket purged without taking metadata.lock. Release
|
||||||
|
// A so its mid-save PutObject recreates .metadata.bin (the ghost).
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s: delete bucket: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
aReleased()
|
||||||
|
if err := <-aDone; err != nil {
|
||||||
|
t.Fatalf("%s: writer A save failed: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// After DeleteBucket, no .metadata.bin record may remain on disk.
|
||||||
|
if meta, err := readBucketMetadata(ctx, obj, bucket); err == nil {
|
||||||
|
t.Fatalf("%s: ghost .metadata.bin resurrected after DeleteBucket: name=%q created=%s policyLen=%d",
|
||||||
|
instanceType, meta.Name, meta.Created, len(meta.PolicyConfigJSON))
|
||||||
|
} else if !errors.Is(err, errConfigNotFound) && !isErrBucketNotFound(err) && !errors.Is(err, errVolumeNotFound) {
|
||||||
|
t.Fatalf("%s: unexpected error reading deleted bucket metadata: %v", instanceType, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// Copyright 2026 PGSTY contributors.
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio/internal/auth"
|
||||||
|
"github.com/minio/minio/internal/grid"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPeerMetadataReloadWithEqualMaximumTimestamp(t *testing.T) {
|
||||||
|
defer DetectTestLeak(t)()
|
||||||
|
ExecObjectLayerAPITest(ExecObjectLayerAPITestArgs{t: t, objAPITest: testPeerMetadataReloadWithEqualMaximumTimestamp})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testPeerMetadataReloadWithEqualMaximumTimestamp(obj ObjectLayer, instanceType, bucket string, _ http.Handler, _ auth.Credentials, t *testing.T) {
|
||||||
|
disk, err := loadBucketMetadata(t.Context(), obj, bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
disk.TaggingConfigXML = []byte(`<Tagging><TagSet><Tag><Key>revision</Key><Value>new</Value></Tag></TagSet></Tagging>`)
|
||||||
|
disk.TaggingConfigUpdatedAt = UTCNow()
|
||||||
|
// An unrelated configuration has the greatest timestamp in both records.
|
||||||
|
disk.PolicyConfigUpdatedAt = disk.TaggingConfigUpdatedAt.Add(time.Hour)
|
||||||
|
if err := disk.Save(t.Context(), obj); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
resident := disk
|
||||||
|
resident.TaggingConfigXML = []byte(`<Tagging><TagSet><Tag><Key>revision</Key><Value>old</Value></Tag></TagSet></Tagging>`)
|
||||||
|
resident.TaggingConfigUpdatedAt = disk.TaggingConfigUpdatedAt.Add(-time.Minute)
|
||||||
|
if err := resident.parseAllConfigs(t.Context(), obj); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !resident.lastUpdate().Equal(disk.lastUpdate()) {
|
||||||
|
t.Fatal("fixture must have equal maximum timestamps")
|
||||||
|
}
|
||||||
|
globalBucketMetadataSys.Set(bucket, resident)
|
||||||
|
|
||||||
|
args := grid.MSS{peerRESTBucket: bucket}
|
||||||
|
if _, err := (&peerRESTServer{}).LoadBucketMetadataHandler(&args); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
tagging, _, err := globalBucketMetadataSys.GetTaggingConfig(bucket)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got := tagging.ToMap()["revision"]; got != "new" {
|
||||||
|
t.Errorf("%s: peer reload retained tag %q despite a newer tagging configuration", instanceType, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
// Copyright (c) 2015-2026 MinIO, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of MinIO Object Storage stack
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"sort"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio-go/v7/pkg/tags"
|
||||||
|
bucketsse "github.com/minio/minio/internal/bucket/encryption"
|
||||||
|
objectlock "github.com/minio/minio/internal/bucket/object/lock"
|
||||||
|
"github.com/minio/minio/internal/bucket/versioning"
|
||||||
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Only these fields share the site-replication source-time ordering contract.
|
||||||
|
// Bulk apply/import process Object Lock before Versioning, whose effective
|
||||||
|
// document depends on it. Periodic heal retains its existing type order.
|
||||||
|
var replicatedBucketConfigs = [...]string{
|
||||||
|
objectLockConfig, bucketVersioningConfig, bucketPolicyConfig,
|
||||||
|
bucketTaggingConfig, bucketSSEConfig, bucketQuotaConfigFile,
|
||||||
|
}
|
||||||
|
|
||||||
|
func replicatedBucketConfig(meta *BucketMetadata, file string) (*[]byte, *time.Time) {
|
||||||
|
switch file {
|
||||||
|
case bucketPolicyConfig:
|
||||||
|
return &meta.PolicyConfigJSON, &meta.PolicyConfigUpdatedAt
|
||||||
|
case bucketTaggingConfig:
|
||||||
|
return &meta.TaggingConfigXML, &meta.TaggingConfigUpdatedAt
|
||||||
|
case bucketSSEConfig:
|
||||||
|
return &meta.EncryptionConfigXML, &meta.EncryptionConfigUpdatedAt
|
||||||
|
case bucketQuotaConfigFile:
|
||||||
|
return &meta.QuotaConfigJSON, &meta.QuotaConfigUpdatedAt
|
||||||
|
case bucketVersioningConfig:
|
||||||
|
return &meta.VersioningConfigXML, &meta.VersioningConfigUpdatedAt
|
||||||
|
case objectLockConfig:
|
||||||
|
return &meta.ObjectLockConfigXML, &meta.ObjectLockConfigUpdatedAt
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callers that only need to know whether a file is under the contract must not
|
||||||
|
// probe replicatedBucketConfig with a throwaway BucketMetadata.
|
||||||
|
func isReplicatedBucketConfig(file string) bool {
|
||||||
|
for _, replicated := range replicatedBucketConfigs {
|
||||||
|
if replicated == file {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func bucketConfigUpdateOnly(file string) bool {
|
||||||
|
return file == bucketVersioningConfig || file == objectLockConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reuse the persistence rule before comparison, so an accepted Versioning
|
||||||
|
// event and the document Save actually writes have the same comparison key.
|
||||||
|
func effectiveBucketVersioning(data []byte, lockEnabled bool) []byte {
|
||||||
|
if lockEnabled {
|
||||||
|
config, err := versioning.ParseConfig(bytes.NewReader(data))
|
||||||
|
if err != nil || !config.Enabled() || config.PrefixesExcluded() {
|
||||||
|
return enabledBucketVersioningConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// A parsed policy still contains map-backed sets with nondeterministic Marshal
|
||||||
|
// order. Sort every set array recursively, including statements and conditions.
|
||||||
|
// RawMessage keeps integer values intact; decoding through float64 would not.
|
||||||
|
func canonicalBucketPolicyJSON(data json.RawMessage) (json.RawMessage, error) {
|
||||||
|
data = bytes.TrimSpace(data)
|
||||||
|
if len(data) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
switch data[0] {
|
||||||
|
case '{':
|
||||||
|
var obj map[string]json.RawMessage
|
||||||
|
if err := json.Unmarshal(data, &obj); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for key, value := range obj {
|
||||||
|
var err error
|
||||||
|
obj[key], err = canonicalBucketPolicyJSON(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return json.Marshal(obj)
|
||||||
|
case '[':
|
||||||
|
var arr []json.RawMessage
|
||||||
|
if err := json.Unmarshal(data, &arr); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for i := range arr {
|
||||||
|
var err error
|
||||||
|
arr[i], err = canonicalBucketPolicyJSON(arr[i])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Slice(arr, func(i, j int) bool { return bytes.Compare(arr[i], arr[j]) < 0 })
|
||||||
|
return json.Marshal(arr)
|
||||||
|
default:
|
||||||
|
var compact bytes.Buffer
|
||||||
|
if err := json.Compact(&compact, data); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return compact.Bytes(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode the validated policy fields explicitly: BPStatement's required
|
||||||
|
// Action/Resource tags otherwise try to marshal empty sets for the supported
|
||||||
|
// NotAction/NotResource alternatives. This stays within the existing schema.
|
||||||
|
func canonicalBucketPolicy(cfg *policy.BucketPolicy) ([]byte, error) {
|
||||||
|
if cfg.IsEmpty() {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
doc := map[string]any{"Version": cfg.Version}
|
||||||
|
if cfg.ID != "" {
|
||||||
|
doc["ID"] = cfg.ID
|
||||||
|
}
|
||||||
|
statements := make([]map[string]any, 0, len(cfg.Statements))
|
||||||
|
for _, st := range cfg.Statements {
|
||||||
|
statement := map[string]any{"Effect": st.Effect, "Principal": st.Principal}
|
||||||
|
if st.SID != "" {
|
||||||
|
statement["Sid"] = st.SID
|
||||||
|
}
|
||||||
|
if len(st.Actions) != 0 {
|
||||||
|
statement["Action"] = st.Actions
|
||||||
|
}
|
||||||
|
if len(st.NotActions) != 0 {
|
||||||
|
statement["NotAction"] = st.NotActions
|
||||||
|
}
|
||||||
|
if len(st.Resources) != 0 {
|
||||||
|
statement["Resource"] = st.Resources
|
||||||
|
}
|
||||||
|
if len(st.NotResources) != 0 {
|
||||||
|
statement["NotResource"] = st.NotResources
|
||||||
|
}
|
||||||
|
if len(st.Conditions) != 0 {
|
||||||
|
statement["Condition"] = st.Conditions
|
||||||
|
}
|
||||||
|
statements = append(statements, statement)
|
||||||
|
}
|
||||||
|
doc["Statement"] = statements
|
||||||
|
data, err := json.Marshal(doc)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return canonicalBucketPolicyJSON(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate with the same parsers as Save. Policy's established empty-policy
|
||||||
|
// semantics are deletion; a parsed zero quota is still a live document.
|
||||||
|
func bucketConfigPayload(bucket, file string, data []byte, lockEnabled bool) ([]byte, []byte, error) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
var err error
|
||||||
|
key := data
|
||||||
|
switch file {
|
||||||
|
case bucketPolicyConfig:
|
||||||
|
var cfg *policy.BucketPolicy
|
||||||
|
cfg, err = policy.ParseBucketPolicyConfig(bytes.NewReader(data), bucket)
|
||||||
|
if err == nil {
|
||||||
|
if cfg.IsEmpty() {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
key, err = canonicalBucketPolicy(cfg)
|
||||||
|
}
|
||||||
|
case bucketQuotaConfigFile:
|
||||||
|
cfg, parseErr := parseBucketQuota(bucket, data)
|
||||||
|
err = parseErr
|
||||||
|
if err == nil {
|
||||||
|
key, err = json.Marshal(cfg)
|
||||||
|
}
|
||||||
|
case bucketTaggingConfig:
|
||||||
|
_, err = tags.ParseBucketXML(bytes.NewReader(data))
|
||||||
|
case bucketSSEConfig:
|
||||||
|
_, err = bucketsse.ParseBucketSSEConfig(bytes.NewReader(data))
|
||||||
|
case objectLockConfig:
|
||||||
|
_, err = objectlock.ParseObjectLockConfig(bytes.NewReader(data))
|
||||||
|
case bucketVersioningConfig:
|
||||||
|
data = effectiveBucketVersioning(data, lockEnabled)
|
||||||
|
key = data
|
||||||
|
_, err = versioning.ParseConfig(bytes.NewReader(data))
|
||||||
|
}
|
||||||
|
return data, key, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type bucketConfigState struct {
|
||||||
|
data, key []byte
|
||||||
|
at time.Time
|
||||||
|
real, valid bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newBucketConfigState(bucket, file string, data []byte, at, created time.Time, lockEnabled bool) (bucketConfigState, error) {
|
||||||
|
data, key, err := bucketConfigPayload(bucket, file, data, lockEnabled)
|
||||||
|
if err != nil {
|
||||||
|
return bucketConfigState{}, err
|
||||||
|
}
|
||||||
|
if at.IsZero() {
|
||||||
|
at = created
|
||||||
|
}
|
||||||
|
valid := !created.IsZero() && !at.Before(created)
|
||||||
|
modified := valid && at.After(created)
|
||||||
|
if bucketConfigUpdateOnly(file) && len(data) == 0 {
|
||||||
|
modified = false
|
||||||
|
}
|
||||||
|
return bucketConfigState{data: data, key: key, at: at, real: modified, valid: valid}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s bucketConfigState) candidate() bool {
|
||||||
|
return s.valid && (s.real || len(s.data) != 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func compareBucketConfigStates(a, b bucketConfigState) int {
|
||||||
|
if a.valid != b.valid {
|
||||||
|
if a.valid {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
if a.real != b.real {
|
||||||
|
if a.real {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
if a.real {
|
||||||
|
if n := a.at.Compare(b.at); n != 0 {
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
// At equal source time a real deletion wins, preventing resurrection.
|
||||||
|
if (len(a.data) == 0) != (len(b.data) == 0) {
|
||||||
|
if len(a.data) == 0 {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bytes.Compare(a.key, b.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func localBucketConfigUpdatedAt(meta BucketMetadata, file string, now time.Time) time.Time {
|
||||||
|
_, at := replicatedBucketConfig(&meta, file)
|
||||||
|
for _, lower := range []time.Time{meta.Created, *at} {
|
||||||
|
if !now.After(lower) {
|
||||||
|
now = lower.Add(time.Nanosecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return now.UTC()
|
||||||
|
}
|
||||||
|
|
||||||
|
func ensureBucketMetadataCreated(ctx context.Context, obj ObjectLayer, meta *BucketMetadata) error {
|
||||||
|
if !meta.Created.IsZero() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
info, err := obj.GetBucketInfo(ctx, meta.Name, BucketOptions{NoMetadata: true})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if info.Created.IsZero() {
|
||||||
|
return errors.New("bucket metadata creation time is unknown")
|
||||||
|
}
|
||||||
|
meta.Created = info.Created.UTC()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// applyBucketConfig runs under metadata.lock, on freshly loaded metadata. It
|
||||||
|
// changes only the selected field; the caller persists once after all checks.
|
||||||
|
func applyBucketConfig(meta *BucketMetadata, file string, data []byte, at time.Time) (bool, error) {
|
||||||
|
if bucketConfigUpdateOnly(file) && len(data) == 0 {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
current, currentAt := replicatedBucketConfig(meta, file)
|
||||||
|
lockEnabled := len(meta.ObjectLockConfigXML) != 0
|
||||||
|
incoming, err := newBucketConfigState(meta.Name, file, data, at, meta.Created, lockEnabled)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if !incoming.candidate() {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
local, err := newBucketConfigState(meta.Name, file, *current, *currentAt, meta.Created, lockEnabled)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if compareBucketConfigStates(incoming, local) <= 0 {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
*current, *currentAt = bytes.Clone(incoming.data), incoming.at.UTC()
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func rebaseBucketConfigDefaults(meta *BucketMetadata, oldCreated time.Time) {
|
||||||
|
if meta.Created.Equal(oldCreated) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// These six fields alone use Created to distinguish a baseline from a
|
||||||
|
// tombstone. Preserve actual source times when adopting an existing bucket.
|
||||||
|
for _, file := range replicatedBucketConfigs {
|
||||||
|
_, at := replicatedBucketConfig(meta, file)
|
||||||
|
if at.IsZero() || at.Equal(oldCreated) {
|
||||||
|
*at = meta.Created
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+241
-131
@@ -24,6 +24,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
@@ -38,8 +39,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/event"
|
"github.com/minio/minio/internal/event"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/sync/errgroup"
|
"github.com/pgsty/silo-pkg/v3/sync/errgroup"
|
||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,16 +52,27 @@ type BucketMetadataSys struct {
|
|||||||
initialized bool
|
initialized bool
|
||||||
group *singleflight.Group
|
group *singleflight.Group
|
||||||
metadataMap map[string]BucketMetadata
|
metadataMap map[string]BucketMetadata
|
||||||
// loadFailed tracks real buckets whose metadata could not be loaded at
|
// loadFailed records real buckets whose metadata has never been loaded
|
||||||
// startup (concurrentLoad) or during a refresh. Such buckets are NOT
|
// successfully because the startup load or a refresh failed. They are
|
||||||
// resident in metadataMap even though the subsystem is Initialized, so a
|
// absent from metadataMap even though the subsystem is initialized, and
|
||||||
// plain map miss cannot distinguish "not a bucket" from "known bucket whose
|
// without this bit a resident-only lookup could not tell them apart from a
|
||||||
// config we could not read". Callers that must fail closed for a real but
|
// name that is not a bucket at all. It never holds a resident bucket, is
|
||||||
// unreadable bucket (e.g. per-bucket CORS) consult this set. It is bounded
|
// bounded by the number of failed loads, and is empty in normal operation.
|
||||||
// by the number of load failures and is empty in normal operation.
|
|
||||||
loadFailed map[string]struct{}
|
loadFailed map[string]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// noteLoadFailure and clearLoadFailure maintain loadFailed; both expect the
|
||||||
|
// caller to hold sys.Lock. A bucket that is resident keeps its last loaded
|
||||||
|
// metadata through a failed refresh, exactly like every other bucket
|
||||||
|
// configuration, so the set only ever holds non-resident buckets.
|
||||||
|
func (sys *BucketMetadataSys) noteLoadFailure(bucket string) {
|
||||||
|
if _, resident := sys.metadataMap[bucket]; !resident {
|
||||||
|
sys.loadFailed[bucket] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sys *BucketMetadataSys) clearLoadFailure(bucket string) { delete(sys.loadFailed, bucket) }
|
||||||
|
|
||||||
// Count returns number of bucket metadata map entries.
|
// Count returns number of bucket metadata map entries.
|
||||||
func (sys *BucketMetadataSys) Count() int {
|
func (sys *BucketMetadataSys) Count() int {
|
||||||
sys.RLock()
|
sys.RLock()
|
||||||
@@ -75,7 +87,7 @@ func (sys *BucketMetadataSys) Remove(buckets ...string) {
|
|||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
sys.group.Forget(bucket)
|
sys.group.Forget(bucket)
|
||||||
delete(sys.metadataMap, bucket)
|
delete(sys.metadataMap, bucket)
|
||||||
delete(sys.loadFailed, bucket)
|
sys.clearLoadFailure(bucket)
|
||||||
globalBucketMonitor.DeleteBucket(bucket)
|
globalBucketMonitor.DeleteBucket(bucket)
|
||||||
}
|
}
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
@@ -95,7 +107,7 @@ func (sys *BucketMetadataSys) RemoveStaleBuckets(diskBuckets set.StringSet) {
|
|||||||
}
|
}
|
||||||
for bucket := range sys.loadFailed {
|
for bucket := range sys.loadFailed {
|
||||||
if !diskBuckets.Contains(bucket) {
|
if !diskBuckets.Contains(bucket) {
|
||||||
delete(sys.loadFailed, bucket)
|
sys.clearLoadFailure(bucket)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,59 +121,103 @@ func (sys *BucketMetadataSys) Set(bucket string, meta BucketMetadata) {
|
|||||||
if !isMinioMetaBucketName(bucket) {
|
if !isMinioMetaBucketName(bucket) {
|
||||||
sys.Lock()
|
sys.Lock()
|
||||||
sys.metadataMap[bucket] = meta
|
sys.metadataMap[bucket] = meta
|
||||||
delete(sys.loadFailed, bucket)
|
sys.clearLoadFailure(bucket)
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sys *BucketMetadataSys) updateAndParse(ctx context.Context, bucket string, configFile string, configData []byte, parse bool) (updatedAt time.Time, err error) {
|
// bucketMetadataUpdate returns the committed snapshot to the caller. meta and
|
||||||
|
// updatedAt hold the saved state only when changed is true. Local writes always
|
||||||
|
// change state, because localBucketConfigUpdatedAt is strictly greater than the
|
||||||
|
// current field time, so their handlers can broadcast meta without rechecking.
|
||||||
|
type bucketMetadataUpdate struct {
|
||||||
|
meta BucketMetadata
|
||||||
|
updatedAt time.Time
|
||||||
|
changed bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sys *BucketMetadataSys) updateAndParse(ctx context.Context, bucket, configFile string, configData []byte, parse, lifecycleDelete bool) (time.Time, error) {
|
||||||
|
result, err := sys.updateAndParseMetadata(ctx, bucket, configFile, configData, parse, lifecycleDelete, nil)
|
||||||
|
return result.updatedAt, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sys *BucketMetadataSys) updateAndParseMetadata(ctx context.Context, bucket string, configFile string, configData []byte, parse, lifecycleDelete bool, sourceTime *time.Time) (result bucketMetadataUpdate, err error) {
|
||||||
objAPI := newObjectLayerFn()
|
objAPI := newObjectLayerFn()
|
||||||
if objAPI == nil {
|
if objAPI == nil {
|
||||||
return updatedAt, errServerNotInitialized
|
return result, errServerNotInitialized
|
||||||
}
|
}
|
||||||
|
|
||||||
if isMinioMetaBucketName(bucket) {
|
if isMinioMetaBucketName(bucket) {
|
||||||
return updatedAt, errInvalidArgument
|
return result, errInvalidArgument
|
||||||
|
}
|
||||||
|
// Load deletions without parsed caches (notably quota), and compare the
|
||||||
|
// six replicated fields against the raw document under the same lock.
|
||||||
|
if isReplicatedBucketConfig(configFile) {
|
||||||
|
parse = false
|
||||||
|
if bucketConfigUpdateOnly(configFile) && len(configData) == 0 {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notifyCtx := ctx
|
||||||
|
ctx, unlock, err := lockBucketMetadata(ctx, objAPI, bucket)
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = func() error {
|
||||||
|
defer unlock()
|
||||||
meta, err := loadBucketMetadataParse(ctx, objAPI, bucket, parse)
|
meta, err := loadBucketMetadataParse(ctx, objAPI, bucket, parse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !globalIsErasure && !globalIsDistErasure && errors.Is(err, errVolumeNotFound) {
|
if !globalIsErasure && !globalIsDistErasure && errors.Is(err, errVolumeNotFound) {
|
||||||
// Only single drive mode needs this fallback.
|
// Only single drive mode needs this fallback.
|
||||||
meta = newBucketMetadata(bucket)
|
meta = newBucketMetadata(bucket)
|
||||||
} else {
|
} else {
|
||||||
return updatedAt, err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updatedAt = UTCNow()
|
if lifecycleDelete {
|
||||||
|
configData, err = lifecycleDeleteConfig(meta.LifecycleConfigXML)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatedAt := UTCNow()
|
||||||
|
if isReplicatedBucketConfig(configFile) {
|
||||||
|
if err := ensureBucketMetadataCreated(ctx, objAPI, &meta); err != nil {
|
||||||
|
var at time.Time
|
||||||
|
if sourceTime != nil {
|
||||||
|
at = *sourceTime
|
||||||
|
}
|
||||||
|
logBucketConfigReplication(ctx, bucket, configFile, "indeterminate", at, meta.Created, err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if sourceTime == nil || sourceTime.IsZero() {
|
||||||
|
updatedAt = localBucketConfigUpdatedAt(meta, configFile, updatedAt)
|
||||||
|
if sourceTime != nil {
|
||||||
|
logBucketConfigReplication(ctx, bucket, configFile, "legacy-zero", *sourceTime, meta.Created, "assigned local source time")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updatedAt = sourceTime.UTC()
|
||||||
|
}
|
||||||
|
if updatedAt.Before(meta.Created) {
|
||||||
|
logBucketConfigReplication(ctx, bucket, configFile, "before-created", updatedAt, meta.Created, "peer event")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
changed, err := applyBucketConfig(&meta, configFile, configData, updatedAt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !changed {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
switch configFile {
|
switch configFile {
|
||||||
case bucketPolicyConfig:
|
|
||||||
meta.PolicyConfigJSON = configData
|
|
||||||
meta.PolicyConfigUpdatedAt = updatedAt
|
|
||||||
case bucketNotificationConfig:
|
case bucketNotificationConfig:
|
||||||
meta.NotificationConfigXML = configData
|
meta.NotificationConfigXML = configData
|
||||||
meta.NotificationConfigUpdatedAt = updatedAt
|
meta.NotificationConfigUpdatedAt = updatedAt
|
||||||
case bucketLifecycleConfig:
|
case bucketLifecycleConfig:
|
||||||
meta.LifecycleConfigXML = configData
|
meta.LifecycleConfigXML = configData
|
||||||
meta.LifecycleConfigUpdatedAt = updatedAt
|
meta.LifecycleConfigUpdatedAt = updatedAt
|
||||||
case bucketSSEConfig:
|
|
||||||
meta.EncryptionConfigXML = configData
|
|
||||||
meta.EncryptionConfigUpdatedAt = updatedAt
|
|
||||||
case bucketTaggingConfig:
|
|
||||||
meta.TaggingConfigXML = configData
|
|
||||||
meta.TaggingConfigUpdatedAt = updatedAt
|
|
||||||
case bucketCorsConfig:
|
|
||||||
meta.CorsConfigXML = configData
|
|
||||||
meta.CorsConfigUpdatedAt = updatedAt
|
|
||||||
case bucketQuotaConfigFile:
|
|
||||||
meta.QuotaConfigJSON = configData
|
|
||||||
meta.QuotaConfigUpdatedAt = updatedAt
|
|
||||||
case objectLockConfig:
|
|
||||||
meta.ObjectLockConfigXML = configData
|
|
||||||
meta.ObjectLockConfigUpdatedAt = updatedAt
|
|
||||||
case bucketVersioningConfig:
|
|
||||||
meta.VersioningConfigXML = configData
|
|
||||||
meta.VersioningConfigUpdatedAt = updatedAt
|
|
||||||
case bucketReplicationConfig:
|
case bucketReplicationConfig:
|
||||||
meta.ReplicationConfigXML = configData
|
meta.ReplicationConfigXML = configData
|
||||||
meta.ReplicationConfigUpdatedAt = updatedAt
|
meta.ReplicationConfigUpdatedAt = updatedAt
|
||||||
@@ -171,15 +227,27 @@ func (sys *BucketMetadataSys) updateAndParse(ctx context.Context, bucket string,
|
|||||||
bucketTargetsFile: bucketTargetsFile,
|
bucketTargetsFile: bucketTargetsFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return updatedAt, fmt.Errorf("Error encrypting bucket target metadata %w", err)
|
return fmt.Errorf("Error encrypting bucket target metadata %w", err)
|
||||||
}
|
}
|
||||||
meta.BucketTargetsConfigUpdatedAt = updatedAt
|
meta.BucketTargetsConfigUpdatedAt = updatedAt
|
||||||
meta.BucketTargetsConfigMetaUpdatedAt = updatedAt
|
meta.BucketTargetsConfigMetaUpdatedAt = updatedAt
|
||||||
default:
|
default:
|
||||||
return updatedAt, fmt.Errorf("Unknown bucket %s metadata update requested %s", bucket, configFile)
|
return fmt.Errorf("Unknown bucket %s metadata update requested %s", bucket, configFile)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return updatedAt, sys.save(ctx, meta)
|
if err := sys.saveMetadata(ctx, objAPI, &meta); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
result = bucketMetadataUpdate{meta: meta, updatedAt: updatedAt, changed: true}
|
||||||
|
return nil
|
||||||
|
}()
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
if result.changed {
|
||||||
|
globalNotificationSys.LoadBucketMetadata(bgContext(notifyCtx), bucket)
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sys *BucketMetadataSys) save(ctx context.Context, meta BucketMetadata) error {
|
func (sys *BucketMetadataSys) save(ctx context.Context, meta BucketMetadata) error {
|
||||||
@@ -192,31 +260,74 @@ func (sys *BucketMetadataSys) save(ctx context.Context, meta BucketMetadata) err
|
|||||||
return errInvalidArgument
|
return errInvalidArgument
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := meta.Save(ctx, objAPI); err != nil {
|
if err := sys.saveMetadata(ctx, objAPI, &meta); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sys.Set(meta.Name, meta)
|
|
||||||
globalNotificationSys.LoadBucketMetadata(bgContext(ctx), meta.Name) // Do not use caller context here
|
globalNotificationSys.LoadBucketMetadata(bgContext(ctx), meta.Name) // Do not use caller context here
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// saveMetadata persists and publishes metadata locally. Callers performing a
|
||||||
|
// read-modify-write must hold metadata.lock and release it before peer fan-out.
|
||||||
|
func (sys *BucketMetadataSys) saveMetadata(ctx context.Context, objAPI ObjectLayer, meta *BucketMetadata) error {
|
||||||
|
// A writer may have queued for metadata.lock before DeleteBucket completed.
|
||||||
|
// Recheck the physical bucket under that lock, before recreating metadata.
|
||||||
|
if _, err := objAPI.GetBucketInfo(ctx, meta.Name, BucketOptions{NoMetadata: true}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := meta.Save(ctx, objAPI); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sys.Set(meta.Name, *meta)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func lockBucketMetadata(ctx context.Context, objectAPI ObjectLayer, bucket string) (context.Context, func(), error) {
|
||||||
|
return lockBucketMetadataWithTimeout(ctx, objectAPI, bucket, globalOperationTimeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
// lockBucketMetadataAcquireHook, when set, is invoked at the start of every
|
||||||
|
// metadata.lock acquisition, immediately before the blocking Lock() call. It is
|
||||||
|
// nil in production (a single atomic load, no behavior change) and exists only
|
||||||
|
// so tests can deterministically observe a caller reaching the metadata lock —
|
||||||
|
// notably DeleteBucket, whose lock is taken through its erasureServerPools
|
||||||
|
// receiver and is therefore invisible to an injected object layer.
|
||||||
|
var lockBucketMetadataAcquireHook atomic.Pointer[func(bucket string)]
|
||||||
|
|
||||||
|
func lockBucketMetadataWithTimeout(ctx context.Context, objectAPI ObjectLayer, bucket string, timeout *dynamicTimeout) (context.Context, func(), error) {
|
||||||
|
lock := objectAPI.NewNSLock(minioMetaBucket, pathJoin(bucketMetaPrefix, bucket, "metadata.lock"))
|
||||||
|
if hook := lockBucketMetadataAcquireHook.Load(); hook != nil {
|
||||||
|
(*hook)(bucket)
|
||||||
|
}
|
||||||
|
lkctx, err := lock.GetLock(ctx, timeout)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
ctx = context.WithValue(lkctx.Context(), bucketMetadataLockContextKey{}, bucket)
|
||||||
|
return ctx, func() { lock.Unlock(lkctx) }, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type bucketMetadataLockContextKey struct{}
|
||||||
|
|
||||||
|
func bucketMetadataLockHeld(ctx context.Context, bucket string) bool {
|
||||||
|
lockedBucket, _ := ctx.Value(bucketMetadataLockContextKey{}).(string)
|
||||||
|
return lockedBucket == bucket
|
||||||
|
}
|
||||||
|
|
||||||
// Delete delete the bucket metadata for the specified bucket.
|
// Delete delete the bucket metadata for the specified bucket.
|
||||||
// must be used by all callers instead of using Update() with nil configData.
|
// must be used by all callers instead of using Update() with nil configData.
|
||||||
func (sys *BucketMetadataSys) Delete(ctx context.Context, bucket string, configFile string) (updatedAt time.Time, err error) {
|
func (sys *BucketMetadataSys) Delete(ctx context.Context, bucket string, configFile string) (updatedAt time.Time, err error) {
|
||||||
if configFile == bucketLifecycleConfig {
|
return sys.updateAndParse(ctx, bucket, configFile, nil, false, configFile == bucketLifecycleConfig)
|
||||||
// Get bucket config from current site
|
|
||||||
meta, e := globalBucketMetadataSys.GetConfigFromDisk(ctx, bucket)
|
|
||||||
if e != nil && !errors.Is(e, errConfigNotFound) {
|
|
||||||
return updatedAt, e
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func lifecycleDeleteConfig(current []byte) ([]byte, error) {
|
||||||
var expiryRuleRemoved bool
|
var expiryRuleRemoved bool
|
||||||
if len(meta.LifecycleConfigXML) > 0 {
|
if len(current) > 0 {
|
||||||
var lcCfg lifecycle.Lifecycle
|
var lcCfg lifecycle.Lifecycle
|
||||||
if err := xml.Unmarshal(meta.LifecycleConfigXML, &lcCfg); err != nil {
|
if err := xml.Unmarshal(current, &lcCfg); err != nil {
|
||||||
return updatedAt, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// find a single expiry rule set the flag
|
|
||||||
for _, rl := range lcCfg.Rules {
|
for _, rl := range lcCfg.Rules {
|
||||||
if !rl.Expiration.IsNull() || !rl.NoncurrentVersionExpiration.IsNull() {
|
if !rl.Expiration.IsNull() || !rl.NoncurrentVersionExpiration.IsNull() {
|
||||||
expiryRuleRemoved = true
|
expiryRuleRemoved = true
|
||||||
@@ -224,27 +335,70 @@ func (sys *BucketMetadataSys) Delete(ctx context.Context, bucket string, configF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !expiryRuleRemoved {
|
||||||
// Form empty ILM details with `ExpiryUpdatedAt` field and save
|
return nil, nil
|
||||||
var cfgData []byte
|
}
|
||||||
if expiryRuleRemoved {
|
|
||||||
var lcCfg lifecycle.Lifecycle
|
var lcCfg lifecycle.Lifecycle
|
||||||
currtime := time.Now()
|
currtime := time.Now()
|
||||||
lcCfg.ExpiryUpdatedAt = &currtime
|
lcCfg.ExpiryUpdatedAt = &currtime
|
||||||
cfgData, err = xml.Marshal(lcCfg)
|
return xml.Marshal(lcCfg)
|
||||||
if err != nil {
|
|
||||||
return updatedAt, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sys.updateAndParse(ctx, bucket, configFile, cfgData, false)
|
|
||||||
}
|
|
||||||
return sys.updateAndParse(ctx, bucket, configFile, nil, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update update bucket metadata for the specified bucket.
|
// Update update bucket metadata for the specified bucket.
|
||||||
// The configData data should not be modified after being sent here.
|
// The configData data should not be modified after being sent here.
|
||||||
func (sys *BucketMetadataSys) Update(ctx context.Context, bucket string, configFile string, configData []byte) (updatedAt time.Time, err error) {
|
func (sys *BucketMetadataSys) Update(ctx context.Context, bucket string, configFile string, configData []byte) (updatedAt time.Time, err error) {
|
||||||
return sys.updateAndParse(ctx, bucket, configFile, configData, true)
|
return sys.updateAndParse(ctx, bucket, configFile, configData, true, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateExpiryLCConfig merges a replicated ILM expiry configuration with the
|
||||||
|
// bucket's current lifecycle document and persists the merged result while
|
||||||
|
// holding metadata.lock across the read, merge, and save. The site-replication
|
||||||
|
// expiry heal and peer-apply paths must use this instead of computing the merge
|
||||||
|
// from an unlocked GetConfigFromDisk read and then writing it with Update: that
|
||||||
|
// two-step sequence drops any lifecycle transition change committed in between
|
||||||
|
// (issue #105). Lock order stays <bucket>.lck -> metadata.lock -> .metadata.bin;
|
||||||
|
// the merge and save run under metadata.lock and the peer fan-out runs after it
|
||||||
|
// is released.
|
||||||
|
func (sys *BucketMetadataSys) UpdateExpiryLCConfig(ctx context.Context, bucket string, expLCConfig *string, updatedAt time.Time) error {
|
||||||
|
objAPI := newObjectLayerFn()
|
||||||
|
if objAPI == nil {
|
||||||
|
return errServerNotInitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
if isMinioMetaBucketName(bucket) {
|
||||||
|
return errInvalidArgument
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyCtx := ctx
|
||||||
|
ctx, unlock, err := lockBucketMetadata(ctx, objAPI, bucket)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = func() error {
|
||||||
|
defer unlock()
|
||||||
|
meta, err := loadBucketMetadataParse(ctx, objAPI, bucket, true)
|
||||||
|
if err != nil {
|
||||||
|
if !globalIsErasure && !globalIsDistErasure && errors.Is(err, errVolumeNotFound) {
|
||||||
|
// Only single drive mode needs this fallback.
|
||||||
|
meta = newBucketMetadata(bucket)
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configData, err := mergeExpiryWithLCConfig(bucket, meta, expLCConfig, updatedAt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
meta.LifecycleConfigXML = configData
|
||||||
|
meta.LifecycleConfigUpdatedAt = UTCNow()
|
||||||
|
return sys.saveMetadata(ctx, objAPI, &meta)
|
||||||
|
}()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
globalNotificationSys.LoadBucketMetadata(bgContext(notifyCtx), bucket) // Do not use caller context here
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get metadata for a bucket.
|
// Get metadata for a bucket.
|
||||||
@@ -378,51 +532,17 @@ func (sys *BucketMetadataSys) GetSSEConfig(bucket string) (*bucketsse.BucketSSEC
|
|||||||
return meta.sseConfig, meta.EncryptionConfigUpdatedAt, nil
|
return meta.sseConfig, meta.EncryptionConfigUpdatedAt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCorsConfig returns the CORS configuration for the given bucket.
|
// GetResidentCorsConfig returns the CORS configuration of a bucket whose
|
||||||
// The returned object must not be modified.
|
// metadata is already resident in memory. It runs before authentication for
|
||||||
func (sys *BucketMetadataSys) GetCorsConfig(bucket string) (*cors.Config, time.Time, error) {
|
// every Origin-bearing request with a client-supplied path segment, so it
|
||||||
meta, _, err := sys.GetConfig(GlobalContext, bucket)
|
// never loads or caches metadata. A non-resident name gets no CORS answer
|
||||||
if err != nil {
|
// (errBucketMetadataNotInitialized) while startup loading is still running,
|
||||||
return nil, time.Time{}, err
|
// and afterwards when it is a real bucket whose metadata failed to load: a
|
||||||
}
|
// presigned URL is authenticated on its own, so the bucket's CORS document is
|
||||||
if meta.corsConfigErr != nil {
|
// the only origin boundary a browser enforces for it. Any other non-resident
|
||||||
return nil, meta.CorsConfigUpdatedAt, meta.corsConfigErr
|
// name reports errConfigNotFound and the caller applies the global CORS
|
||||||
}
|
// policy exactly as releases without per-bucket CORS did.
|
||||||
if meta.corsConfig == nil {
|
|
||||||
return nil, time.Time{}, errConfigNotFound
|
|
||||||
}
|
|
||||||
return meta.corsConfig, meta.CorsConfigUpdatedAt, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResidentCorsConfig returns the CORS configuration for the given bucket
|
|
||||||
// using only bucket metadata that is already resident in memory. Unlike
|
|
||||||
// GetCorsConfig it never loads metadata from disk and never caches a new
|
|
||||||
// entry.
|
|
||||||
//
|
|
||||||
// The per-request CORS middleware runs before authentication, for every
|
|
||||||
// Origin-bearing request, using the validated first path segment as the bucket
|
|
||||||
// name.
|
|
||||||
// Routing that through GetCorsConfig (which loads and caches) let an
|
|
||||||
// unauthenticated client grow metadataMap without bound and trigger an
|
|
||||||
// erasure metadata probe for every distinct, attacker-controlled,
|
|
||||||
// non-existent name it sent with an Origin header (e.g. /minio/... , /api/... ,
|
|
||||||
// or random buckets). Every bucket that can carry a CORS document is made
|
|
||||||
// resident when the document is written (Set) and when metadata is loaded at
|
|
||||||
// startup (Init/concurrentLoad), so a resident-only read is complete for real
|
|
||||||
// buckets while costing only an in-memory map lookup for everything else.
|
|
||||||
//
|
|
||||||
// While bucket metadata is still loading (not yet Initialized) a non-resident
|
|
||||||
// bucket returns errBucketMetadataNotInitialized so the caller fails closed
|
|
||||||
// rather than answering with the permissive global policy for a bucket whose
|
|
||||||
// restrictive CORS document may simply not be loaded yet.
|
|
||||||
func (sys *BucketMetadataSys) GetResidentCorsConfig(bucket string) (*cors.Config, time.Time, error) {
|
func (sys *BucketMetadataSys) GetResidentCorsConfig(bucket string) (*cors.Config, time.Time, error) {
|
||||||
if isMinioMetaBucketName(bucket) {
|
|
||||||
// Preserve GetConfig's semantics for the internal namespace: this is
|
|
||||||
// not a real bucket, and returning a non-errConfigNotFound error makes
|
|
||||||
// the CORS middleware fail closed rather than answer for .minio.sys
|
|
||||||
// with the permissive global policy.
|
|
||||||
return nil, time.Time{}, errInvalidArgument
|
|
||||||
}
|
|
||||||
if isReservedOrInvalidBucket(bucket, true) {
|
if isReservedOrInvalidBucket(bucket, true) {
|
||||||
return nil, time.Time{}, errConfigNotFound
|
return nil, time.Time{}, errConfigNotFound
|
||||||
}
|
}
|
||||||
@@ -431,7 +551,12 @@ func (sys *BucketMetadataSys) GetResidentCorsConfig(bucket string) (*cors.Config
|
|||||||
_, failed := sys.loadFailed[bucket]
|
_, failed := sys.loadFailed[bucket]
|
||||||
initialized := sys.initialized
|
initialized := sys.initialized
|
||||||
sys.RUnlock()
|
sys.RUnlock()
|
||||||
if ok {
|
if !ok {
|
||||||
|
if !initialized || failed {
|
||||||
|
return nil, time.Time{}, errBucketMetadataNotInitialized
|
||||||
|
}
|
||||||
|
return nil, time.Time{}, errConfigNotFound
|
||||||
|
}
|
||||||
if meta.corsConfigErr != nil {
|
if meta.corsConfigErr != nil {
|
||||||
return nil, meta.CorsConfigUpdatedAt, meta.corsConfigErr
|
return nil, meta.CorsConfigUpdatedAt, meta.corsConfigErr
|
||||||
}
|
}
|
||||||
@@ -440,18 +565,6 @@ func (sys *BucketMetadataSys) GetResidentCorsConfig(bucket string) (*cors.Config
|
|||||||
}
|
}
|
||||||
return meta.corsConfig, meta.CorsConfigUpdatedAt, nil
|
return meta.corsConfig, meta.CorsConfigUpdatedAt, nil
|
||||||
}
|
}
|
||||||
// Not resident. Two cases must not be conflated:
|
|
||||||
// - metadata is still loading (!initialized), or this is a real bucket
|
|
||||||
// whose metadata failed to load: we cannot rule out a restrictive CORS
|
|
||||||
// config, so fail closed rather than answer with the global policy.
|
|
||||||
// - a fully initialized subsystem with no record of the name: it is not a
|
|
||||||
// bucket that can carry CORS, so fall back to the global policy without
|
|
||||||
// loading or caching metadata for an arbitrary, client-supplied name.
|
|
||||||
if !initialized || failed {
|
|
||||||
return nil, time.Time{}, errBucketMetadataNotInitialized
|
|
||||||
}
|
|
||||||
return nil, time.Time{}, errConfigNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetCorsConfigXML returns the raw stored CORS configuration XML for the
|
// GetCorsConfigXML returns the raw stored CORS configuration XML for the
|
||||||
// given bucket, preserving the document exactly as it was PUT (including
|
// given bucket, preserving the document exactly as it was PUT (including
|
||||||
@@ -599,6 +712,7 @@ func (sys *BucketMetadataSys) GetConfig(ctx context.Context, bucket string) (met
|
|||||||
}
|
}
|
||||||
sys.Lock()
|
sys.Lock()
|
||||||
sys.metadataMap[bucket] = meta
|
sys.metadataMap[bucket] = meta
|
||||||
|
sys.clearLoadFailure(bucket)
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
|
|
||||||
return meta, true, nil
|
return meta, true, nil
|
||||||
@@ -650,13 +764,10 @@ func (sys *BucketMetadataSys) concurrentLoad(ctx context.Context, buckets []stri
|
|||||||
sys.Lock()
|
sys.Lock()
|
||||||
for i, meta := range bucketMetas {
|
for i, meta := range bucketMetas {
|
||||||
if errs[i] != nil {
|
if errs[i] != nil {
|
||||||
// Real bucket whose metadata could not be loaded: record it so
|
sys.noteLoadFailure(buckets[i])
|
||||||
// consumers that must fail closed (per-bucket CORS) can tell it
|
|
||||||
// apart from a name that is not a bucket at all.
|
|
||||||
sys.loadFailed[buckets[i]] = struct{}{}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
delete(sys.loadFailed, buckets[i])
|
sys.clearLoadFailure(buckets[i])
|
||||||
sys.metadataMap[buckets[i]] = meta
|
sys.metadataMap[buckets[i]] = meta
|
||||||
}
|
}
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
@@ -707,7 +818,7 @@ func (sys *BucketMetadataSys) refreshBucketsMetadataLoop(ctx context.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
internalLogIf(ctx, err, logger.WarningKind)
|
internalLogIf(ctx, err, logger.WarningKind)
|
||||||
sys.Lock()
|
sys.Lock()
|
||||||
sys.loadFailed[bucket] = struct{}{}
|
sys.noteLoadFailure(bucket)
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
wait() // wait to proceed to next entry.
|
wait() // wait to proceed to next entry.
|
||||||
continue
|
continue
|
||||||
@@ -719,8 +830,7 @@ func (sys *BucketMetadataSys) refreshBucketsMetadataLoop(ctx context.Context) {
|
|||||||
updated = true
|
updated = true
|
||||||
sys.metadataMap[bucket] = meta
|
sys.metadataMap[bucket] = meta
|
||||||
}
|
}
|
||||||
// A successful (re)load clears any earlier load failure.
|
sys.clearLoadFailure(bucket)
|
||||||
delete(sys.loadFailed, bucket)
|
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
|
|
||||||
if updated {
|
if updated {
|
||||||
|
|||||||
+46
-11
@@ -41,8 +41,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/event"
|
"github.com/minio/minio/internal/event"
|
||||||
"github.com/minio/minio/internal/kms"
|
"github.com/minio/minio/internal/kms"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
|
||||||
"github.com/minio/sio"
|
"github.com/minio/sio"
|
||||||
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -249,8 +249,17 @@ func loadBucketMetadataParse(ctx context.Context, objectAPI ObjectLayer, bucket
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(configs) > 0 {
|
if len(configs) > 0 {
|
||||||
// Old bucket without bucket metadata. Hence we migrate existing settings.
|
if !bucketMetadataLockHeld(ctx, bucket) {
|
||||||
if err = b.convertLegacyConfigs(ctx, objectAPI, configs); err != nil {
|
migrated, lockErr := loadBucketMetadataParseUnderLock(ctx, objectAPI, bucket, parse)
|
||||||
|
if lockErr == nil {
|
||||||
|
return migrated, nil
|
||||||
|
}
|
||||||
|
if !errors.Is(lockErr, errBucketMetadataMigrationLockUnavailable) {
|
||||||
|
return b, lockErr
|
||||||
|
}
|
||||||
|
internalLogOnceIf(ctx, fmt.Errorf("unable to persist bucket metadata migration for %s, using the legacy configuration in memory: %w", bucket, lockErr), "bucket-metadata-migration-lock-"+bucket)
|
||||||
|
b.applyLegacyConfigs(configs)
|
||||||
|
} else if err = b.convertLegacyConfigs(ctx, objectAPI, configs); err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,6 +279,17 @@ func loadBucketMetadataParse(ctx context.Context, objectAPI ObjectLayer, bucket
|
|||||||
}
|
}
|
||||||
|
|
||||||
// migrate unencrypted remote targets
|
// migrate unencrypted remote targets
|
||||||
|
if len(b.BucketTargetsConfigJSON) != 0 && GlobalKMS != nil && len(b.BucketTargetsConfigMetaJSON) == 0 && !bucketMetadataLockHeld(ctx, bucket) {
|
||||||
|
migrated, lockErr := loadBucketMetadataParseUnderLock(ctx, objectAPI, bucket, parse)
|
||||||
|
if lockErr == nil {
|
||||||
|
return migrated, nil
|
||||||
|
}
|
||||||
|
if !errors.Is(lockErr, errBucketMetadataMigrationLockUnavailable) {
|
||||||
|
return b, lockErr
|
||||||
|
}
|
||||||
|
internalLogOnceIf(ctx, fmt.Errorf("unable to persist encrypted bucket target metadata for %s, using the existing configuration in memory: %w", bucket, lockErr), "bucket-metadata-migration-lock-"+bucket)
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
if err = b.migrateTargetConfig(ctx, objectAPI); err != nil {
|
if err = b.migrateTargetConfig(ctx, objectAPI); err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
@@ -277,6 +297,23 @@ func loadBucketMetadataParse(ctx context.Context, objectAPI ObjectLayer, bucket
|
|||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func loadBucketMetadataParseUnderLock(ctx context.Context, objectAPI ObjectLayer, bucket string, parse bool) (BucketMetadata, error) {
|
||||||
|
ctx, unlock, err := lockBucketMetadataWithTimeout(ctx, objectAPI, bucket, bucketMetadataMigrationTimeout)
|
||||||
|
if err != nil {
|
||||||
|
return newBucketMetadata(bucket), fmt.Errorf("%w: %v", errBucketMetadataMigrationLockUnavailable, err)
|
||||||
|
}
|
||||||
|
defer unlock()
|
||||||
|
if _, err := objectAPI.GetBucketInfo(ctx, bucket, BucketOptions{NoMetadata: true}); err != nil {
|
||||||
|
return newBucketMetadata(bucket), err
|
||||||
|
}
|
||||||
|
return loadBucketMetadataParse(ctx, objectAPI, bucket, parse)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
bucketMetadataMigrationTimeout = newDynamicTimeout(5*time.Second, time.Second)
|
||||||
|
errBucketMetadataMigrationLockUnavailable = errors.New("bucket metadata migration lock unavailable")
|
||||||
|
)
|
||||||
|
|
||||||
// loadBucketMetadata loads and migrates to bucket metadata.
|
// loadBucketMetadata loads and migrates to bucket metadata.
|
||||||
func loadBucketMetadata(ctx context.Context, objectAPI ObjectLayer, bucket string) (BucketMetadata, error) {
|
func loadBucketMetadata(ctx context.Context, objectAPI ObjectLayer, bucket string) (BucketMetadata, error) {
|
||||||
return loadBucketMetadataParse(ctx, objectAPI, bucket, true)
|
return loadBucketMetadataParse(ctx, objectAPI, bucket, true)
|
||||||
@@ -343,13 +380,6 @@ func (b *BucketMetadata) parseAllConfigs(ctx context.Context, objectAPI ObjectLa
|
|||||||
b.corsConfig = nil
|
b.corsConfig = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Equal(b.ObjectLockConfigXML, enabledBucketObjectLockConfig) {
|
|
||||||
config, versioningErr := versioning.ParseConfig(bytes.NewReader(b.VersioningConfigXML))
|
|
||||||
if versioningErr != nil || !config.Enabled() {
|
|
||||||
b.VersioningConfigXML = enabledBucketVersioningConfig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(b.ObjectLockConfigXML) != 0 {
|
if len(b.ObjectLockConfigXML) != 0 {
|
||||||
b.objectLockConfig, err = objectlock.ParseObjectLockConfig(bytes.NewReader(b.ObjectLockConfigXML))
|
b.objectLockConfig, err = objectlock.ParseObjectLockConfig(bytes.NewReader(b.ObjectLockConfigXML))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -358,6 +388,7 @@ func (b *BucketMetadata) parseAllConfigs(ctx context.Context, objectAPI ObjectLa
|
|||||||
} else {
|
} else {
|
||||||
b.objectLockConfig = nil
|
b.objectLockConfig = nil
|
||||||
}
|
}
|
||||||
|
b.VersioningConfigXML = effectiveBucketVersioning(b.VersioningConfigXML, b.objectLockConfig != nil)
|
||||||
|
|
||||||
if len(b.VersioningConfigXML) != 0 {
|
if len(b.VersioningConfigXML) != 0 {
|
||||||
b.versioningConfig, err = versioning.ParseConfig(bytes.NewReader(b.VersioningConfigXML))
|
b.versioningConfig, err = versioning.ParseConfig(bytes.NewReader(b.VersioningConfigXML))
|
||||||
@@ -440,7 +471,7 @@ func (b *BucketMetadata) getAllLegacyConfigs(ctx context.Context, objectAPI Obje
|
|||||||
return configs, nil
|
return configs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BucketMetadata) convertLegacyConfigs(ctx context.Context, objectAPI ObjectLayer, configs map[string][]byte) error {
|
func (b *BucketMetadata) applyLegacyConfigs(configs map[string][]byte) {
|
||||||
for legacyFile, configData := range configs {
|
for legacyFile, configData := range configs {
|
||||||
switch legacyFile {
|
switch legacyFile {
|
||||||
case legacyBucketObjectLockEnabledConfigFile:
|
case legacyBucketObjectLockEnabledConfigFile:
|
||||||
@@ -472,6 +503,10 @@ func (b *BucketMetadata) convertLegacyConfigs(ctx context.Context, objectAPI Obj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.defaultTimestamps()
|
b.defaultTimestamps()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BucketMetadata) convertLegacyConfigs(ctx context.Context, objectAPI ObjectLayer, configs map[string][]byte) error {
|
||||||
|
b.applyLegacyConfigs(configs)
|
||||||
|
|
||||||
if err := b.Save(ctx, objectAPI); err != nil {
|
if err := b.Save(ctx, objectAPI); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -39,3 +39,28 @@ func TestBucketMetadataCorsRoundTrip(t *testing.T) {
|
|||||||
t.Fatalf("CorsConfigUpdatedAt not preserved")
|
t.Fatalf("CorsConfigUpdatedAt not preserved")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A persisted retired extension must not prevent the whole bucket's metadata
|
||||||
|
// from loading, including unrelated versioning and ordinary lifecycle rules.
|
||||||
|
func TestBucketMetadataRetiredAccessTiering(t *testing.T) {
|
||||||
|
meta := newBucketMetadata("retired-access")
|
||||||
|
meta.LifecycleConfigXML = []byte(`<LifecycleConfiguration><AccessTierQuota>500GiB</AccessTierQuota><Rule><ID>access</ID><Status>Enabled</Status><Filter><Prefix>logs/</Prefix></Filter><AccessTransition><Window>10m</Window><PromoteAfterAccesses>10</PromoteAfterAccesses></AccessTransition></Rule><Rule><ID>ordinary</ID><Status>Enabled</Status><Filter><Prefix>expired/</Prefix></Filter><Expiration><Days>30</Days></Expiration></Rule></LifecycleConfiguration>`)
|
||||||
|
meta.VersioningConfigXML = []byte(`<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Status>Enabled</Status></VersioningConfiguration>`)
|
||||||
|
data, err := meta.MarshalMsg(nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
got := newBucketMetadata(meta.Name)
|
||||||
|
if _, err := got.UnmarshalMsg(data); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := got.parseAllConfigs(t.Context(), nil); err != nil {
|
||||||
|
t.Fatalf("bucket metadata failed to load: %v", err)
|
||||||
|
}
|
||||||
|
if got.lifecycleConfig == nil || got.lifecycleConfig.HasActiveRules("logs/") || !got.lifecycleConfig.HasActiveRules("expired/") {
|
||||||
|
t.Fatal("unexpected lifecycle behavior")
|
||||||
|
}
|
||||||
|
if got.versioningConfig == nil || !got.versioningConfig.Enabled() {
|
||||||
|
t.Fatal("unrelated versioning lost")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/minio/minio/internal/event"
|
"github.com/minio/minio/internal/event"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+182
-5
@@ -22,11 +22,15 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/minio/internal/amztime"
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
objectlock "github.com/minio/minio/internal/bucket/object/lock"
|
objectlock "github.com/minio/minio/internal/bucket/object/lock"
|
||||||
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BucketObjectLockSys - map of bucket and retention configuration.
|
// BucketObjectLockSys - map of bucket and retention configuration.
|
||||||
@@ -330,12 +334,11 @@ func checkPutObjectLockAllowed(ctx context.Context, rq *http.Request, bucket, ob
|
|||||||
return mode, retainDate, legalHold, ErrObjectLocked
|
return mode, retainDate, legalHold, ErrObjectLocked
|
||||||
}
|
}
|
||||||
|
|
||||||
if !legalHoldRequested && retentionCfg.LockEnabled {
|
// Inherit retention from the bucket configuration. A legal-hold header
|
||||||
// inherit retention from bucket configuration
|
// on the same request, ON or OFF, is independent of retention and must
|
||||||
|
// not suppress the default (#165).
|
||||||
return retentionCfg.Mode, objectlock.RetentionDate{Time: t.Add(retentionCfg.Validity)}, legalHold, ErrNone
|
return retentionCfg.Mode, objectlock.RetentionDate{Time: t.Add(retentionCfg.Validity)}, legalHold, ErrNone
|
||||||
}
|
}
|
||||||
return "", objectlock.RetentionDate{}, legalHold, ErrNone
|
|
||||||
}
|
|
||||||
return mode, retainDate, legalHold, ErrNone
|
return mode, retainDate, legalHold, ErrNone
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,3 +346,177 @@ func checkPutObjectLockAllowed(ctx context.Context, rq *http.Request, bucket, ob
|
|||||||
func NewBucketObjectLockSys() *BucketObjectLockSys {
|
func NewBucketObjectLockSys() *BucketObjectLockSys {
|
||||||
return &BucketObjectLockSys{}
|
return &BucketObjectLockSys{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// objectLockState is the Object Lock metadata of a stored object version
|
||||||
|
// together with the replication timestamps that order updates to it.
|
||||||
|
type objectLockState struct {
|
||||||
|
mode, retainUntil, retentionTimestamp string
|
||||||
|
legalHold, legalHoldTimestamp string
|
||||||
|
}
|
||||||
|
|
||||||
|
func storedObjectLockState(metadata map[string]string) objectLockState {
|
||||||
|
return objectLockState{
|
||||||
|
mode: metadata[strings.ToLower(xhttp.AmzObjectLockMode)],
|
||||||
|
retainUntil: metadata[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)],
|
||||||
|
retentionTimestamp: metadata[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp],
|
||||||
|
legalHold: metadata[strings.ToLower(xhttp.AmzObjectLockLegalHold)],
|
||||||
|
legalHoldTimestamp: metadata[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// olderThan reports whether a stored replication timestamp is missing,
|
||||||
|
// unreadable, or earlier than the source timestamp, in which case the
|
||||||
|
// replica update wins. A zero source timestamp never wins.
|
||||||
|
func olderThan(stored string, src time.Time) bool {
|
||||||
|
if src.IsZero() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
ondisk, err := time.Parse(time.RFC3339Nano, stored)
|
||||||
|
return err != nil || ondisk.Before(src)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s objectLockState) retentionIsOlderThan(src time.Time) bool {
|
||||||
|
return olderThan(s.retentionTimestamp, src)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s objectLockState) legalHoldIsOlderThan(src time.Time) bool {
|
||||||
|
return olderThan(s.legalHoldTimestamp, src)
|
||||||
|
}
|
||||||
|
|
||||||
|
// restoreRetention and restoreLegalHold put the stored state back into
|
||||||
|
// metadata that was rebuilt from a request whose update was not applied.
|
||||||
|
func (s objectLockState) restoreRetention(metadata map[string]string) {
|
||||||
|
// The stored timestamp orders the next update and must survive even when
|
||||||
|
// the stored value is empty, which is how a removal is recorded.
|
||||||
|
if s.retentionTimestamp != "" {
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp] = s.retentionTimestamp
|
||||||
|
}
|
||||||
|
if s.mode == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockMode)] = s.mode
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = s.retainUntil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s objectLockState) restoreLegalHold(metadata map[string]string) {
|
||||||
|
if s.legalHoldTimestamp != "" {
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp] = s.legalHoldTimestamp
|
||||||
|
}
|
||||||
|
if s.legalHold == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockLegalHold)] = s.legalHold
|
||||||
|
}
|
||||||
|
|
||||||
|
// replicaStoredLock reads the Object Lock state stored on the addressed version
|
||||||
|
// so a trusted replica write can order its update against it. A missing object
|
||||||
|
// or version yields an empty state, which is correct for the first write of a
|
||||||
|
// version; any other read error is returned so the caller fails the write rather
|
||||||
|
// than ordering an incoming update against lock state it merely failed to read
|
||||||
|
// (an older incoming value must not win over a newer stored one just because the
|
||||||
|
// read timed out).
|
||||||
|
func replicaStoredLock(ctx context.Context, getObjectInfo GetObjectInfoFn, bucket, object, versionID string) (objectLockState, error) {
|
||||||
|
oi, err := getObjectInfo(ctx, bucket, object, ObjectOptions{VersionID: versionID})
|
||||||
|
switch {
|
||||||
|
case err == nil:
|
||||||
|
return storedObjectLockState(oi.UserDefined), nil
|
||||||
|
case isErrObjectNotFound(err) || isErrVersionNotFound(err):
|
||||||
|
return objectLockState{}, nil
|
||||||
|
default:
|
||||||
|
return objectLockState{}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// applyReplicatedObjectLock writes the retention and legal-hold decision into
|
||||||
|
// metadata for a PUT, CopyObject, or multipart-initiation request. A request
|
||||||
|
// that is not an actual trusted replica -- a normal user write, or a trusted
|
||||||
|
// peer that carried the replication marker without REPLICA status -- takes
|
||||||
|
// ordinary write semantics: a validated value is applied and stamped now, and a
|
||||||
|
// missing value is left as is. Only an actual replica update is ordered against
|
||||||
|
// the state already stored on the addressed version, so a stale value cannot
|
||||||
|
// overwrite a newer one and a full retransmit cannot roll a destination back.
|
||||||
|
// The stored argument is meaningful only for a replica; callers pass an empty
|
||||||
|
// state otherwise. Only the two Object Lock keys and their reserved ordering
|
||||||
|
// timestamps are touched; any encryption-metadata reconciliation stays with the
|
||||||
|
// caller.
|
||||||
|
func applyReplicatedObjectLock(metadata map[string]string, stored objectLockState,
|
||||||
|
replicaTrusted bool,
|
||||||
|
retentionMode objectlock.RetMode, retentionDate objectlock.RetentionDate,
|
||||||
|
legalHold objectlock.ObjectLegalHold, srcRetentionTimestamp, srcLegalholdTimestamp time.Time,
|
||||||
|
) {
|
||||||
|
switch {
|
||||||
|
case !replicaTrusted:
|
||||||
|
// Ordinary write semantics: apply a validated retention and stamp it now;
|
||||||
|
// a missing value carries no instruction, so leave the metadata as it is.
|
||||||
|
if retentionMode.Valid() {
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockMode)] = string(retentionMode)
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = amztime.ISO8601Format(retentionDate.UTC())
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp] = UTCNow().Format(time.RFC3339Nano)
|
||||||
|
}
|
||||||
|
case !stored.retentionIsOlderThan(srcRetentionTimestamp):
|
||||||
|
// The stored update is at least as new as this replica's, or the replica
|
||||||
|
// carries no ordering timestamp: keep what is stored. This is also how a
|
||||||
|
// stale retransmit is rejected.
|
||||||
|
stored.restoreRetention(metadata)
|
||||||
|
default:
|
||||||
|
// The replica update wins. A removal carries no value but still records
|
||||||
|
// the source timestamp that orders it.
|
||||||
|
if retentionMode.Valid() {
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockMode)] = string(retentionMode)
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockRetainUntilDate)] = amztime.ISO8601Format(retentionDate.UTC())
|
||||||
|
}
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp] = srcRetentionTimestamp.UTC().Format(time.RFC3339Nano)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legal hold has no removal in S3: an explicitly empty header is already
|
||||||
|
// rejected as an invalid status, so the only value-less shape that gets here
|
||||||
|
// is an absent one, which conveys no legal-hold change. Only a valid status
|
||||||
|
// can win.
|
||||||
|
switch {
|
||||||
|
case !replicaTrusted:
|
||||||
|
if legalHold.Status.Valid() {
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockLegalHold)] = string(legalHold.Status)
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp] = UTCNow().Format(time.RFC3339Nano)
|
||||||
|
}
|
||||||
|
case legalHold.Status.Valid() && stored.legalHoldIsOlderThan(srcLegalholdTimestamp):
|
||||||
|
metadata[strings.ToLower(xhttp.AmzObjectLockLegalHold)] = string(legalHold.Status)
|
||||||
|
metadata[ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp] = srcLegalholdTimestamp.UTC().Format(time.RFC3339Nano)
|
||||||
|
default:
|
||||||
|
stored.restoreLegalHold(metadata)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// reconcileStoredObjectLock re-orders the Object Lock already written into
|
||||||
|
// metadata against the state currently stored on the destination version, both
|
||||||
|
// compared by their reserved ordering timestamps. It runs inside the object
|
||||||
|
// layer under the namespace write lock that guards the version replacement,
|
||||||
|
// after the destination version is read and before the new one is committed, so
|
||||||
|
// a replica update whose ordering was decided at handler time (or, for multipart,
|
||||||
|
// at initiation) cannot overwrite a newer lock update that reached the version in
|
||||||
|
// between. metadata already carries the incoming update with its source
|
||||||
|
// timestamps; a stored value that is not older than the incoming one is put back,
|
||||||
|
// which for a stored removal means clearing the incoming value and keeping only
|
||||||
|
// the removal's timestamp. Only the two lock keys and their reserved timestamps
|
||||||
|
// move; a non-replica write never sets the flag that invokes this.
|
||||||
|
func reconcileStoredObjectLock(metadata map[string]string, stored objectLockState) {
|
||||||
|
incoming := storedObjectLockState(metadata)
|
||||||
|
|
||||||
|
incomingRetentionTS, _ := time.Parse(time.RFC3339Nano, incoming.retentionTimestamp)
|
||||||
|
if !stored.retentionIsOlderThan(incomingRetentionTS) {
|
||||||
|
// The stored retention is at least as new as the incoming one (or the
|
||||||
|
// incoming update is unordered): drop the incoming value and put the stored
|
||||||
|
// state back, which may itself be a removal (value keys absent, timestamp
|
||||||
|
// present).
|
||||||
|
delete(metadata, strings.ToLower(xhttp.AmzObjectLockMode))
|
||||||
|
delete(metadata, strings.ToLower(xhttp.AmzObjectLockRetainUntilDate))
|
||||||
|
delete(metadata, ReservedMetadataPrefixLower+ObjectLockRetentionTimestamp)
|
||||||
|
stored.restoreRetention(metadata)
|
||||||
|
}
|
||||||
|
|
||||||
|
incomingLegalHoldTS, _ := time.Parse(time.RFC3339Nano, incoming.legalHoldTimestamp)
|
||||||
|
if incoming.legalHold == "" || !stored.legalHoldIsOlderThan(incomingLegalHoldTS) {
|
||||||
|
delete(metadata, strings.ToLower(xhttp.AmzObjectLockLegalHold))
|
||||||
|
delete(metadata, ReservedMetadataPrefixLower+ObjectLockLegalHoldTimestamp)
|
||||||
|
stored.restoreLegalHold(metadata)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ import (
|
|||||||
"github.com/minio/madmin-go/v3"
|
"github.com/minio/madmin-go/v3"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -100,13 +99,13 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configData, err := json.Marshal(bucketPolicy)
|
configData, err := canonicalBucketPolicy(bucketPolicy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedAt, err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, configData)
|
result, err := globalBucketMetadataSys.updateAndParseMetadata(ctx, bucket, bucketPolicyConfig, configData, false, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
return
|
return
|
||||||
@@ -116,8 +115,8 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht
|
|||||||
replLogIf(ctx, globalSiteReplicationSys.BucketMetaHook(ctx, madmin.SRBucketMeta{
|
replLogIf(ctx, globalSiteReplicationSys.BucketMetaHook(ctx, madmin.SRBucketMeta{
|
||||||
Type: madmin.SRBucketMetaTypePolicy,
|
Type: madmin.SRBucketMetaTypePolicy,
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
Policy: bucketPolicyBytes,
|
Policy: result.meta.PolicyConfigJSON,
|
||||||
UpdatedAt: updatedAt,
|
UpdatedAt: result.updatedAt,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Success.
|
// Success.
|
||||||
@@ -200,7 +199,7 @@ func (api objectAPIHandlers) GetBucketPolicyHandler(w http.ResponseWriter, r *ht
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configData, err := json.Marshal(config)
|
configData, err := canonicalBucketPolicy(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/policy/condition"
|
"github.com/pgsty/silo-pkg/v3/policy/condition"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getAnonReadOnlyBucketPolicy(bucketName string) *policy.BucketPolicy {
|
func getAnonReadOnlyBucketPolicy(bucketName string) *policy.BucketPolicy {
|
||||||
|
|||||||
+28
-9
@@ -33,8 +33,8 @@ import (
|
|||||||
"github.com/minio/minio/internal/handlers"
|
"github.com/minio/minio/internal/handlers"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/policy/condition"
|
"github.com/pgsty/silo-pkg/v3/policy/condition"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PolicySys - policy subsystem.
|
// PolicySys - policy subsystem.
|
||||||
@@ -255,13 +255,32 @@ func getConditionValuesWithTags(r *http.Request, lc string, cred auth.Credential
|
|||||||
}
|
}
|
||||||
|
|
||||||
cloneHeader := r.Header.Clone()
|
cloneHeader := r.Header.Clone()
|
||||||
signatureAge := cloneHeader.Get("x-amz-signature-age")
|
|
||||||
cloneHeader.Del("x-amz-signature-age")
|
// s3:signatureAge is derived from the presigned X-Amz-Date rather than from
|
||||||
// The presigned V4 verifier overwrites this internal scratch header after
|
// anything the verifier writes back: PutObject and UploadPart authorize
|
||||||
// validating the signature. Ignore a value supplied on every other request
|
// before they verify the signature, so a post-verification value is not yet
|
||||||
// type, where it would otherwise synthesize s3:signatureAge.
|
// available on the first evaluation. The date is bound by the signature
|
||||||
if authType == authTypePresigned && signatureAge != "" {
|
// (doesPresignedSignatureMatch rebuilds and compares it), so a forged date
|
||||||
args["signatureAge"] = []string{signatureAge}
|
// only changes the authorization outcome of a request that then fails
|
||||||
|
// verification. A date that does not parse leaves the key absent; the
|
||||||
|
// verifier rejects the request as ErrMalformedPresignedDate.
|
||||||
|
if authType == authTypePresigned {
|
||||||
|
if signedDate, err := time.Parse(iso8601Format, r.Form.Get(xhttp.AmzDate)); err == nil {
|
||||||
|
args["signatureAge"] = []string{strconv.FormatInt(currTime.Sub(signedDate).Milliseconds(), 10)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// s3:x-amz-content-sha256 must name the payload hash the request is actually
|
||||||
|
// verified and enforced against, and only one such value. Presence of the
|
||||||
|
// header controls whether the key exists at all (AWS documents that the
|
||||||
|
// query-string form does not populate it), but the value comes from the same
|
||||||
|
// selection getContentSha256Cksum makes for verification: the presigned query
|
||||||
|
// value takes precedence over the header, and a repeated header contributes
|
||||||
|
// only its first value. Exposing every raw header value instead let a
|
||||||
|
// request satisfy a policy with a value the verifier never checked.
|
||||||
|
if _, ok := cloneHeader[xhttp.AmzContentSha256]; ok {
|
||||||
|
args[xhttp.AmzContentSha256] = []string{getContentSha256Cksum(r, serviceS3)}
|
||||||
|
cloneHeader.Del(xhttp.AmzContentSha256)
|
||||||
}
|
}
|
||||||
|
|
||||||
userTags := cloneHeader.Get(xhttp.AmzObjectTagging)
|
userTags := cloneHeader.Get(xhttp.AmzObjectTagging)
|
||||||
|
|||||||
@@ -23,14 +23,16 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/internal/auth"
|
"github.com/minio/minio/internal/auth"
|
||||||
"github.com/minio/minio/internal/handlers"
|
"github.com/minio/minio/internal/handlers"
|
||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
"github.com/minio/pkg/v3/policy/condition"
|
"github.com/pgsty/silo-pkg/v3/policy/condition"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -579,8 +581,20 @@ func TestGetConditionValuesRejectsAbsentInternalKeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// s3:signatureAge is derived from the presigned X-Amz-Date, which the signature
|
||||||
|
// binds. A client header under the former scratch name must never supply it on
|
||||||
|
// any auth type, and a presign whose date is missing or malformed leaves the
|
||||||
|
// key absent (the verifier then rejects the request).
|
||||||
func TestGetConditionValuesOnlyAcceptsPresignedSignatureAge(t *testing.T) {
|
func TestGetConditionValuesOnlyAcceptsPresignedSignatureAge(t *testing.T) {
|
||||||
const signatureAgeHeader = "x-amz-signature-age"
|
const signatureAgeHeader = "x-amz-signature-age"
|
||||||
|
signedDate := UTCNow().Add(-90 * time.Second)
|
||||||
|
presignQuery := func(date string) string {
|
||||||
|
q := url.Values{xhttp.AmzCredential: {"access/20260803/us-east-1/s3/aws4_request"}}
|
||||||
|
if date != "" {
|
||||||
|
q.Set(xhttp.AmzDate, date)
|
||||||
|
}
|
||||||
|
return "http://minio.local/bkt/obj?" + q.Encode()
|
||||||
|
}
|
||||||
|
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
name string
|
name string
|
||||||
@@ -602,19 +616,33 @@ func TestGetConditionValuesOnlyAcceptsPresignedSignatureAge(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "presigned verifier value",
|
name: "presigned client header without date",
|
||||||
target: "http://minio.local/bkt/obj?" + url.Values{
|
target: presignQuery(""),
|
||||||
xhttp.AmzCredential: {"access/20260803/us-east-1/s3/aws4_request"},
|
headers: map[string]string{signatureAgeHeader: "250"},
|
||||||
}.Encode(),
|
},
|
||||||
|
{
|
||||||
|
name: "presigned malformed date",
|
||||||
|
target: presignQuery("yesterday"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "presigned signed date",
|
||||||
|
target: presignQuery(signedDate.Format(iso8601Format)),
|
||||||
headers: map[string]string{signatureAgeHeader: "250"},
|
headers: map[string]string{signatureAgeHeader: "250"},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
got := condValuesForRequest(t, tc.target, tc.headers)
|
got := condValuesForRequest(t, tc.target, tc.headers)
|
||||||
_, ok := got["signatureAge"]
|
v, ok := got["signatureAge"]
|
||||||
if ok != tc.want {
|
if ok != tc.want {
|
||||||
t.Fatalf("signatureAge presence: expected %v, got %v", tc.want, got["signatureAge"])
|
t.Fatalf("signatureAge presence: expected %v, got %v", tc.want, v)
|
||||||
|
}
|
||||||
|
if !tc.want {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
age, err := strconv.ParseInt(strings.Join(v, ""), 10, 64)
|
||||||
|
if err != nil || age < (90*time.Second).Milliseconds() || age > (2*time.Minute).Milliseconds() {
|
||||||
|
t.Fatalf("signatureAge = %v, want about 90s derived from X-Amz-Date rather than the client header", v)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-8
@@ -43,6 +43,17 @@ func NewBucketQuotaSys() *BucketQuotaSys {
|
|||||||
return &BucketQuotaSys{}
|
return &BucketQuotaSys{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getBucketQuotaSize returns the effective enforced hard-quota size.
|
||||||
|
func getBucketQuotaSize(quota *madmin.BucketQuota) uint64 {
|
||||||
|
if quota == nil || quota.Type != madmin.HardQuota {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if quota.Size > 0 {
|
||||||
|
return quota.Size
|
||||||
|
}
|
||||||
|
return quota.Quota
|
||||||
|
}
|
||||||
|
|
||||||
var bucketStorageCache = cachevalue.New[DataUsageInfo]()
|
var bucketStorageCache = cachevalue.New[DataUsageInfo]()
|
||||||
|
|
||||||
// Init initialize bucket quota.
|
// Init initialize bucket quota.
|
||||||
@@ -110,14 +121,7 @@ func (sys *BucketQuotaSys) enforceQuotaHard(ctx context.Context, bucket string,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var quotaSize uint64
|
quotaSize := getBucketQuotaSize(q)
|
||||||
if q != nil && q.Type == madmin.HardQuota {
|
|
||||||
if q.Size > 0 {
|
|
||||||
quotaSize = q.Size
|
|
||||||
} else if q.Quota > 0 {
|
|
||||||
quotaSize = q.Quota
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if quotaSize > 0 {
|
if quotaSize > 0 {
|
||||||
if uint64(size) >= quotaSize { // check if file size already exceeds the quota
|
if uint64(size) >= quotaSize { // check if file size already exceeds the quota
|
||||||
return BucketQuotaExceeded{Bucket: bucket}
|
return BucketQuotaExceeded{Bucket: bucket}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
// Copyright (c) 2015-2025 MinIO, Inc.
|
||||||
|
// Copyright (c) 2025-2026 PGSTY
|
||||||
|
//
|
||||||
|
// This file is part of MinIO Object Storage stack
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/minio/madmin-go/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetBucketQuotaSize(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
quota *madmin.BucketQuota
|
||||||
|
want uint64
|
||||||
|
}{
|
||||||
|
{name: "nil"},
|
||||||
|
{name: "empty", quota: &madmin.BucketQuota{}},
|
||||||
|
{name: "current size", quota: &madmin.BucketQuota{Type: madmin.HardQuota, Size: 1024}, want: 1024},
|
||||||
|
{name: "legacy quota", quota: &madmin.BucketQuota{Type: madmin.HardQuota, Quota: 2048}, want: 2048},
|
||||||
|
{name: "size takes precedence", quota: &madmin.BucketQuota{Type: madmin.HardQuota, Size: 1024, Quota: 2048}, want: 1024},
|
||||||
|
{name: "missing type", quota: &madmin.BucketQuota{Size: 1024}},
|
||||||
|
{name: "unsupported type", quota: &madmin.BucketQuota{Type: "fifo", Size: 1024}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := getBucketQuotaSize(tt.quota); got != tt.want {
|
||||||
|
t.Fatalf("getBucketQuotaSize() = %d, want %d", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIsBktQuotaCfgReplicated(t *testing.T) {
|
||||||
|
hardQuota := func(size, legacy uint64) *madmin.BucketQuota {
|
||||||
|
return &madmin.BucketQuota{Type: madmin.HardQuota, Size: size, Quota: legacy}
|
||||||
|
}
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
quotas []*madmin.BucketQuota
|
||||||
|
want bool
|
||||||
|
}{
|
||||||
|
{name: "none configured", quotas: []*madmin.BucketQuota{nil, nil}, want: true},
|
||||||
|
{name: "missing from one site", quotas: []*madmin.BucketQuota{hardQuota(1024, 0), nil}},
|
||||||
|
{name: "matching size", quotas: []*madmin.BucketQuota{hardQuota(1024, 0), hardQuota(1024, 0)}, want: true},
|
||||||
|
{name: "different size", quotas: []*madmin.BucketQuota{hardQuota(1024, 0), hardQuota(2048, 0)}},
|
||||||
|
{name: "equivalent representations", quotas: []*madmin.BucketQuota{hardQuota(1024, 0), hardQuota(0, 1024)}, want: true},
|
||||||
|
{name: "different typeless size", quotas: []*madmin.BucketQuota{{Size: 1024}, {Size: 2048}}},
|
||||||
|
{name: "different type", quotas: []*madmin.BucketQuota{hardQuota(1024, 0), {Type: "fifo", Size: 1024}}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if got := isBktQuotaCfgReplicated(len(tt.quotas), tt.quotas); got != tt.want {
|
||||||
|
t.Fatalf("isBktQuotaCfgReplicated() = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ import (
|
|||||||
xhttp "github.com/minio/minio/internal/http"
|
xhttp "github.com/minio/minio/internal/http"
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/mux"
|
"github.com/minio/mux"
|
||||||
"github.com/minio/pkg/v3/policy"
|
"github.com/pgsty/silo-pkg/v3/policy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PutBucketReplicationConfigHandler - PUT Bucket replication configuration.
|
// PutBucketReplicationConfigHandler - PUT Bucket replication configuration.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user