-
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
Upgrade to sdk rc10 #807
Upgrade to sdk rc10 #807
Conversation
Codecov Report
@@ Coverage Diff @@
## master #807 +/- ##
==========================================
- Coverage 34.35% 34.33% -0.02%
==========================================
Files 61 61
Lines 10483 10485 +2
==========================================
- Hits 3601 3600 -1
- Misses 6481 6484 +3
Partials 401 401
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
250ad55
to
518fd38
Compare
@@ -85,7 +85,7 @@ func prepareHandlerContext(t *testing.T) *handlerContext { | |||
|
|||
layerCfg := &layer.Config{ | |||
Caches: layer.DefaultCachesConfigs(zap.NewExample()), | |||
AnonKey: layer.AnonymousKey{Key: key}, | |||
GateKey: key, |
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's supposed to be a feature, see #271. Although I don't quite understand it.
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.
On current master
it doesn't work:
$ aws s3api create-bucket --bucket $BUCKET --endpoint http://localhost:9080 --no-sign-request
An error occurred (InternalError) when calling the CreateBucket operation (reached max retries: 0): We encountered an internal error, please try again.
In the gate logs:
2023-08-04T07:42:20.324+0400 error handler/util.go:29 call method {"status": 500, "request_id": "dc3da4ba-b5b0-42aa-800f-2dbb71b80ddc", "method": "CreateBucket", "bucket": "heh3", "object": "", "description": "couldn't get bearer token signature key", "error": "couldn't get box data from context"}
In any case, we have to sign requests. Many client calls requires Signer
as an explicit parameter. I tend to think it doesn't matter what key it should be either a gate key or an anonymous one.
But the gate key we have to have because all our sessions were created for the gate key. And we need to sign requests by it
I also agreed with comment in #271 because we can't create container with random key, because containerPut is not a free operation. Signer is required and must not be nil. The account corresponding to the specified Signer will be charged for the operation.
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 can be used for reads, I guess.
8cf4903
to
3778430
Compare
3778430
to
96e0d66
Compare
Added anonymous key using for the |
36d2d04
to
b777c3c
Compare
Updated to the latest RC-10 SDK and neofs-contract versions |
api/layer/container.go
Outdated
@@ -84,6 +84,11 @@ func (n *layer) containerList(ctx context.Context) ([]*data.BucketInfo, error) { | |||
res []cid.ID | |||
rid = api.GetRequestID(ctx) | |||
) | |||
|
|||
if api.IsAnonymousRequest(ctx) { |
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.
Why only this request? I think we can have the same in other ones like object get.
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.
Moved this check to the old place, inside Owner
func. After that it will work like previous implementation
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.
But what about keys? I suppose we should use a different key when we're doing anonymous requests. Maybe layer
should return user.Signer
now to provide both at the same time (gw normally and anon if no auth)?
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 revised the code one more time.
We have the next component chain (gate component names):
- layer -> neofs -> pool
layer
- handles API requests, calls neofs
component to prepare data and then it call pool
to execute request in neofs node.
In fact, the layer even doesn't need to know something about a key or signer. We will drop the key from it.
The neofs component stores the same key (pool also stores it) and it is a good place to make magic with anonymous keys. We just need to pass isAnonymous flag to neofs component and anonymous signer will be used
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.
Made changes in separate commits. At first look, I replaced all places when we cat override the signer. In other places, random keys are already in use by SDK client.
If these changes ok, even after few iterations, I will squash them to proper commit, if required
5deac8b
to
5934df7
Compare
api/layer/container.go
Outdated
@@ -84,6 +84,11 @@ func (n *layer) containerList(ctx context.Context) ([]*data.BucketInfo, error) { | |||
res []cid.ID | |||
rid = api.GetRequestID(ctx) | |||
) | |||
|
|||
if api.IsAnonymousRequest(ctx) { |
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.
But what about keys? I suppose we should use a different key when we're doing anonymous requests. Maybe layer
should return user.Signer
now to provide both at the same time (gw normally and anon if no auth)?
6c1b743
to
db8db45
Compare
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
closes #806 Signed-off-by: Evgenii Baidakov <[email protected]>
db8db45
to
4b865a4
Compare
4b865a4
to
fe4f585
Compare
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
The removing changes was made in 70957d7#diff-efcc85eef482b2cb183da5fd07ad20378963ee903b8876f59ae2b957ee684f67L393. The bug leads to almost infinite waiting for the waiting the result of setEACL operation. Fixing the bug may improve/fix #800 and nspcc-dev/neofs-testcases#591. Signed-off-by: Evgenii Baidakov <[email protected]>
In some cases in may be useful. To take data from public bucket or check the access rules for object Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
Signed-off-by: Evgenii Baidakov <[email protected]>
fe4f585
to
cb7d1e5
Compare
closes #806