Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not save plain-text ETag when encryption is requested #17427

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

harshavardhana
Copy link
Member

@harshavardhana harshavardhana commented Jun 14, 2023

Description

do not save plain-text ETag when encryption is requested

Motivation and Context

fixes an issue under bucket replication could cause
ETags for replicated SSE-S3 single-part PUT objects,
to fail as we would attempt a decryption while listing,
or stat() operation.

How to test this PR?

set -x

export CI=1

make || exit -1

killall -9 minio

rm -rf /tmp/xl/
mkdir -p /tmp/xl/1/ /tmp/xl/2/

export MINIO_KMS_SECRET_KEY="my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw="

NODES=4

args1=()
args2=()
for i in $(seq 1 $NODES); do
        args1+=("http://localhost:$((9000 + $i))/tmp/xl/1/$i ")
        args2+=("http://localhost:$((9100 + $i))/tmp/xl/2/$i ")
done

for i in $(seq 1 $NODES); do
        ./minio server --address "127.0.0.1:$((9000 + $i))" ${args1[@]} & # | tee /tmp/minio/node.$i &
        ./minio server --address "127.0.0.1:$((9100 + $i))" ${args2[@]} & # | tee /tmp/minio/node.$i &
done

sleep 10

./mc alias set myminio1 http://localhost:9001 minioadmin minioadmin
./mc alias set myminio2 http://localhost:9101 minioadmin minioadmin

sleep 1

./mc mb myminio1/testbucket/ --with-lock
./mc mb myminio2/testbucket/ --with-lock
./mc encrypt set sse-s3 my-minio-key myminio1/testbucket/
./mc encrypt set sse-s3 my-minio-key myminio2/testbucket/

./mc replicate add myminio1/testbucket --remote-bucket http://minioadmin:minioadmin@localhost:9101/testbucket --priority 1

sleep 1

./mc cp internal.tar myminio1/testbucket/dir/1.tar
./mc cp internal.tar myminio2/testbucket/dir/2.tar

sleep 1

./mc ls myminio1/testbucket/dir/

./mc ls myminio2/testbucket/dir/

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

cmd/erasure-object.go Outdated Show resolved Hide resolved
Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/minio/minio/blob/master/cmd/object-handlers-common.go#L193
etagMatch should be considered true if it is sse-s3 and etag is empty to avoid re-replicating if there are timing issues

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fixes an issue under bucket replication could cause
ETags for replicated SSE-S3 single part PUT objects,
to fail as we would attempt a decryption while listing,
or stat() operation.
@harshavardhana harshavardhana merged commit ad4e511 into minio:master Jun 15, 2023
18 checks passed
@harshavardhana harshavardhana deleted the sse-s3 branch June 15, 2023 19:43
@bh4t bh4t added the bugfix label Jun 19, 2023
vadmeste pushed a commit to vadmeste/minio that referenced this pull request Jul 13, 2023
fixes an issue under bucket replication could cause
ETags for replicated SSE-S3 single part PUT objects,
to fail as we would attempt a decryption while listing,
or stat() operation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants