-
Notifications
You must be signed in to change notification settings - Fork 15
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
Remove attach of bearer token when bucket owner is not an issuer of the bearer token #487
Conversation
When bucket owner is not an issuer of the bearer token Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
cd8f113
to
82921e0
Compare
@@ -168,7 +168,6 @@ func (h *handler) GetObjectHandler(w http.ResponseWriter, r *http.Request) { | |||
ObjectInfo: info, | |||
Writer: w, | |||
Range: params, | |||
VersionID: p.VersionID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the field is not used, also we have versionID
in ObjectInfo
field
if bd, ok := ctx.Value(api.BoxData).(*accessbox.Box); ok && bd != nil && bd.Gate != nil { | ||
prm.BearerToken = bd.Gate.BearerToken | ||
return | ||
if issuer, ok := bd.Gate.BearerToken.Issuer(); ok && bktOwner.Equals(issuer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we can adopt #485
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to rebase tree-service
branch after this PR. Adopt it in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed up with the branches. Both SDK update and this PR were into master
branch, so we could adopt it. For some reason I thought this PR has tree-service
target.
I pushed 4ed9397 into master branch.
params.oid = p.ObjectInfo.ID | ||
params.cid = p.ObjectInfo.CID | ||
params.objInfo = p.ObjectInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we can keep the old getParams
fields. And extend GetObjectParams
by bktInfo
and pass it (bktInfo
) as the second parameter to n.initObjectPayloadReader
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see huge difference between these solutions.
I suggested to make getParams
keeping *data.ObjectInfo
because in all usages (in both master
and tree-service
) we extract oid
and cid
from objectInfo
anyway, so we can easily put objectInfo
into getParams
and pass all necessary information inside getParams
what looks a little clearer than passing getParams
with cid
and bktInfo
to n.initObjectPayloadReader
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's extend getParams
.
The main point was using bktinfo
somehow to avoid:
// should be taken from cache
bktInfo, err := n.GetBucketInfo(ctx, p.objInfo.Bucket)
if err != nil {
return nil, err
}
in n.initObjectPayloadReader
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this with dragging of bktInfo
through params. Added a separated commit to make it easier to view changes, will squash it later
Please fix tests |
When bucket owner is not an issuer of the bearer token Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
82921e0
to
eaff566
Compare
It's more like new S3 issue to fix object ACLs, isn't it?
|
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
Codecov Report
@@ Coverage Diff @@
## master #487 +/- ##
=========================================
Coverage ? 27.92%
=========================================
Files ? 46
Lines ? 5454
Branches ? 0
=========================================
Hits ? 1523
Misses ? 3729
Partials ? 202 Continue to review full report at Codecov.
|
As @masterSplinter01 mentioned, we got access deny error because of |
The
test_object_copy_canned_acl
test still not passing becausemain_wallet
creates a private container in tests andalt_wallet
can'tget-object
from private container, even the object was put withpublic-read
acl.I tried to make
main-wallet
createpublic-read
container and the test began to pass.I suggest to fix the test and place it in
test_s3_neofs.py
.Closes #459