Repository navigation
Description
Found while testing read quorum loss on MinIO RELEASE.2025-07-23T15-54-02Z. SILO main has the same code.
Expected Behavior
When reading an object fails with a server error, such as lost read quorum, a caller who may read the object gets that error, 503 SlowDownRead. Clients and SDKs retry it. A caller who may not read the object gets 403 AccessDenied.
Current Behavior
A caller whose read is allowed only by a statement with an s3:ExistingObjectTag condition gets 403 AccessDenied from GET, HEAD and PutObjectTagging while the object cannot be read. This holds for IAM users, service accounts and temporary credentials, and for anonymous callers allowed by such a bucket policy statement. At the same moment root, or any caller allowed without a tag condition, gets 503 SlowDownRead for the same object. SDKs and mc do not retry 403, so a short read quorum loss turns into a permission error in the application.
GetObjectAttributes shows the same symptom for a different reason. On any read error it answers 403 AccessDenied unless the caller also has s3:ListBucket, so a server error reaches only callers with s3:ListBucket. It checks s3:ListBucket on bucket/object rather than on the bucket, so the usual grant on arn:aws:s3:::bucket does not count. In practice every caller gets 403 for a server error, and 403 instead of 404 NoSuchKey for a missing key.
Possible Solution
Why the tags are missing. The handlers authorize again after a failed read so that a forbidden caller gets AccessDenied instead of the read error. That second check runs without the object's tags (main 69fcf50cd):
- GET (
cmd/object-handlers.go:448): theCheckPrecondFncallback authorizes with the stored tags (:403). IfgetObjectNInfofails, the fallback callsauthorizeRequest(ctx, r, policy.GetObjectAction), which passes empty tags. It does this even when the callback has already read the tags and allowed the request, so such a caller gets 403 instead of416 InvalidRangefor aRangepast the end of the object. - HEAD (
:926) authorizes withobjInfo.UserTags, which is empty whenGetObjectInfofailed. - PutObjectTagging (
:3737) setsexistingTags := ""whenGetObjectInfofailed.
Without tags, an Allow statement that tests s3:ExistingObjectTag cannot match.
Possible fix. Keep the current decision for client errors such as NoSuchKey, so a missing key is not told apart from a forbidden one. For a server error, the tags are unknown, so the answer should depend on whether some tags would allow the request:
- From the statements that apply to the action and resource, build candidate tag sets: the bucket policy for an anonymous caller, else the cached IAM policies and the session policy. The policy engine (
condition.Functions.Evaluate) checks each tag key's tests against a few candidate values: none, the values named in the condition with policy variables resolved, and""/_as fillers. This coversStringEquals,StringLike,Null, negations,ForAllValuesand${aws:username}alike. - Run the regular authorization with each candidate. If one passes, return the storage error; otherwise AccessDenied, as now.
The candidates are never used as the object's tags. They only choose between the storage error and AccessDenied, and the regular authorization makes that choice. In GET, the fallback should use the tags the callback read, when it read them.
For GetObjectAttributes, a server error says nothing about whether the object exists, so it can go out as is. For client errors, the S3 rule (no s3:ListBucket means AccessDenied instead of NoSuchKey) stays, but s3:ListBucket is checked on the bucket.
I have a patch with tests and will open a PR.
Steps to Reproduce (for bugs)
repro.sh (below) starts one native server with 4 drives. It sets up a bucket policy that lets anonymous callers read and tag obj while it carries k=v, and read attr/* with its attributes. It also gets temporary credentials from AssumeRole with a session policy that allows GET of objects tagged k=v. Then it moves 3 of the 4 drive directories away while the server runs.
bash repro.sh ./silo /tmp/silo-repro
On main 69fcf50cd:
silo-main version DEVELOPMENT.2026-11-03T01-01-54Z (commit-id=69fcf50cd2e0854af0150413df5fd66a5d74becc)
healthy:
root GET obj 200
anonymous GET obj (allowed by k=v) 200
anonymous HEAD obj (allowed by k=v) 200
anonymous PutObjectTagging obj (by k=v) 200
anonymous GET private (not allowed) 403 AccessDenied
session GET obj (allowed by k=v) 200
session GET private (allowed by k=v) 403 AccessDenied
anonymous GetObjectAttributes attr/obj 200
anonymous GetObjectAttributes attr/missing 403 AccessDenied
3 of 4 drives away:
root GET obj 503 SlowDownRead
anonymous GET obj (allowed by k=v) 403 AccessDenied
anonymous HEAD obj (allowed by k=v) 403
anonymous PutObjectTagging obj (by k=v) 403 AccessDenied
anonymous GET private (not allowed) 403 AccessDenied
session GET obj (allowed by k=v) 403 AccessDenied
session GET private (allowed by k=v) 403 AccessDenied
anonymous GetObjectAttributes attr/obj 403 AccessDenied
anonymous GetObjectAttributes attr/missing 403 AccessDenied
Root gets 503 SlowDownRead for obj while every caller allowed by the tag gets 403. GetObjectAttributes answers 403 for the server error, and also for the missing key while the drives are healthy, although the bucket policy grants s3:ListBucket on the bucket. private is the control: no statement lets anonymous callers read it.
The unit tests from the PR build the same state with 10 of 16 drives failing the object's metadata reads:
go test ./cmd -count=1 -run '^(TestExistingObjectTagAuthReadQuorumLost|TestGetObjectAttributesReadQuorumLost)$' -v
repro.sh
#!/usr/bin/env bash
# Repro for the SILO issue: while an object cannot be read, a caller allowed to read it only by an
# s3:ExistingObjectTag condition gets 403 AccessDenied instead of the server error. GetObjectAttributes answers
# the same server error with 403 too.
#
# One native server with 4 drives. The root user creates bucket bkt with:
# - obj, tagged k=v; a bucket policy lets anonymous callers GET, HEAD and tag it while it carries k=v;
# - attr/obj, untagged; the bucket policy lets anonymous callers read it and its attributes, and list the bucket;
# - private, untagged; nothing allows reading it (the control).
# A second caller gets temporary credentials from AssumeRole with a session policy that allows GET of objects
# tagged k=v. Every request is sent while the drives are healthy, then again after 3 of the 4 drive directories
# are moved away while the server runs, so that reads lose quorum. For reference, root reads obj too.
#
# Usage: repro.sh <silo-binary> <work-dir>
# PORT (default 9390) is the S3 port, PORT+1 the console. Needs curl with --aws-sigv4 (7.75+) and python3.
# The work dir is removed at the end.
set -u
BIN="${1:?silo binary}"; WORK="${2:?work dir}"
PORT="${PORT:-9390}"; EP="http://127.0.0.1:$PORT"
USER=minioadmin; PASS=minioadmin; B=bkt
PID=""
cleanup() {
[ -n "$PID" ] && kill "$PID" 2>/dev/null && wait "$PID" 2>/dev/null
rm -rf "$WORK"
}
trap cleanup EXIT
mkdir -p "$WORK"/d{1..4}
MINIO_CI_CD=1 MINIO_ROOT_USER=$USER MINIO_ROOT_PASSWORD=$PASS \
"$BIN" server --address "127.0.0.1:$PORT" --console-address "127.0.0.1:$((PORT + 1))" "$WORK/d{1...4}" >"$WORK/server.log" 2>&1 &
PID=$!
for _ in $(seq 1 60); do curl -sf -o /dev/null "$EP/minio/health/live" && break; sleep 1; done
"$BIN" --version | head -1
root() { curl -sS -o /dev/null --aws-sigv4 "aws:amz:us-east-1:s3" --user "$USER:$PASS" "$@"; }
root -X PUT "$EP/$B"
root -X PUT -H "x-amz-tagging: k=v" --data-binary data "$EP/$B/obj"
root -X PUT --data-binary data "$EP/$B/attr/obj"
root -X PUT --data-binary data "$EP/$B/private"
cat >"$WORK/policy.json" <<EOF
{"Version": "2012-10-17", "Statement": [
{"Effect": "Allow", "Principal": {"AWS": ["*"]}, "Action": ["s3:GetObject", "s3:PutObjectTagging"],
"Resource": ["arn:aws:s3:::$B/obj"], "Condition": {"StringEquals": {"s3:ExistingObjectTag/k": "v"}}},
{"Effect": "Allow", "Principal": {"AWS": ["*"]}, "Action": ["s3:GetObject", "s3:GetObjectAttributes"],
"Resource": ["arn:aws:s3:::$B/attr/*"]},
{"Effect": "Allow", "Principal": {"AWS": ["*"]}, "Action": ["s3:ListBucket"], "Resource": ["arn:aws:s3:::$B"]}]}
EOF
root -X PUT --data-binary @"$WORK/policy.json" "$EP/$B?policy"
# Temporary credentials whose session policy allows GET of objects tagged k=v.
SP='{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["s3:GetObject"], "Resource": ["arn:aws:s3:::'$B'/*"], "Condition": {"StringEquals": {"s3:ExistingObjectTag/k": "v"}}}]}'
curl -sS --aws-sigv4 "aws:amz:us-east-1:sts" --user "$USER:$PASS" -o "$WORK/sts.xml" "$EP/" \
--data-urlencode Action=AssumeRole --data-urlencode Version=2011-06-15 --data-urlencode DurationSeconds=3600 \
--data-urlencode "Policy=$SP"
read -r AK SK TK < <(python3 -I -c '
import re, sys
x = open(sys.argv[1]).read()
print(*(re.search("<%s>([^<]*)</%s>" % (t, t), x).group(1) for t in ("AccessKeyId", "SecretAccessKey", "SessionToken")))' "$WORK/sts.xml")
code() { # label curl-args...
local label=$1 c e; shift
c=$(curl -sS -o "$WORK/.body" -w '%{http_code}' "$@")
e=$(grep -o '<Code>[^<]*</Code>' "$WORK/.body" | sed 's/<[^>]*>//g')
printf ' %-44s %s %s\n' "$label" "$c" "$e"
}
tagging='<Tagging><TagSet><Tag><Key>k</Key><Value>v</Value></Tag></TagSet></Tagging>'
probe() {
code "root GET obj" --aws-sigv4 "aws:amz:us-east-1:s3" --user "$USER:$PASS" "$EP/$B/obj"
code "anonymous GET obj (allowed by k=v)" "$EP/$B/obj"
code "anonymous HEAD obj (allowed by k=v)" -I "$EP/$B/obj"
code "anonymous PutObjectTagging obj (by k=v)" -X PUT --data-binary "$tagging" "$EP/$B/obj?tagging"
code "anonymous GET private (not allowed)" "$EP/$B/private"
code "session GET obj (allowed by k=v)" --aws-sigv4 "aws:amz:us-east-1:s3" --user "$AK:$SK" \
-H "x-amz-security-token: $TK" "$EP/$B/obj"
code "session GET private (allowed by k=v)" --aws-sigv4 "aws:amz:us-east-1:s3" --user "$AK:$SK" \
-H "x-amz-security-token: $TK" "$EP/$B/private"
code "anonymous GetObjectAttributes attr/obj" -H "x-amz-object-attributes: ETag" "$EP/$B/attr/obj?attributes"
code "anonymous GetObjectAttributes attr/missing" -H "x-amz-object-attributes: ETag" "$EP/$B/attr/missing?attributes"
}
echo "healthy:"
probe
for d in 2 3 4; do mv "$WORK/d$d" "$WORK/d$d.away"; done
sleep 2
echo "3 of 4 drives away:"
probe
for d in 2 3 4; do mv "$WORK/d$d.away" "$WORK/d$d"; doneContext
Granting reads by object tag (s3:ExistingObjectTag) is one way to share part of a bucket. During a partial outage those readers see 403 and stop, while everyone else retries and recovers. Applications tend to treat 403 as a configuration error rather than an outage.
Regression
No. The same code is in MinIO RELEASE.2025-07-23T15-54-02Z.
Your Environment
- Version used (
silo --version):mainat69fcf50cd - Server setup and configuration: one native server with 4 drives (
MINIO_CI_CD=1); unit tests in./cmdwith one set of 16 drives - Operating System and version (
uname -a): macOS (Darwin 27.0.0, arm64), Go 1.27.3
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(auth): scope unread tag candidates to effective policies
fix(auth): scope unread tag candidates to effective policies
Vonng commentedon Nov 11, 2026
Follow-up acceptance record: the original read-error repair is on main via #294. c3340ec7f scoped unread-tag candidates to the caller's effective policies, and 293ab78b4 completed the GET/DELETE tagging error paths.
When tags cannot be read, bounded candidate evaluation decides whether the caller may receive the retryable backend error. It never supplies substitute object tags or grants access to object data. Known tags still receive ordinary authorization, and callers with no possible permission remain denied.
This preserves retry behavior for tag-conditioned callers while keeping the fallback conservative and bounded. The storage failure remains visible as a storage failure when the policy permits that disclosure.
The lost-quorum regression, tagging regressions and focused race checks passed, along with the full server suite. Retaining the completed state. Successful GetObjectAttributes and archive-read authorization has separate acceptance work in #342.