-
Notifications
You must be signed in to change notification settings - Fork 47
object/acl: check session token verb #1203
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1203 +/- ##
==========================================
+ Coverage 35.64% 35.68% +0.03%
==========================================
Files 288 288
Lines 18131 18144 +13
==========================================
+ Hits 6463 6474 +11
- Misses 11177 11179 +2
Partials 491 491
Continue to review full report at Codecov.
|
pkg/services/object/acl/acl.go
Outdated
| // Check if session token verb is equal to the current operation. | ||
| // Unknown means everything is allowed. | ||
| verb := sourceVerbOfRequest(req.token, op) | ||
| if verb != op { |
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.
Unfortunately, we can't simply compare op and value from token. One request type can produce requests of other type. During the tests, I logged such errors:
token: DELETE op: PUT
token: DELETE op: HEAD
token: GETRANGEHASH op: GETRANGE
We also have this table in spec of produced request types.
| Base/Gen | PUT | DELETE | HEAD | RANGE | GET | HASH | SEARCH |
|---|---|---|---|---|---|---|---|
| PUT | + | - | - | - | - | - | - |
| DELETE | + | - | + | - | - | - | + |
| HEAD | - | - | + | - | - | - | - |
| RANGE | - | - | + | + | - | - | - |
| GET | - | - | + | - | + | - | - |
| HASH | - | - | + | + | - | - | - |
| SEARCH | - | - | - | - | - | - | + |
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.
Fixed.
pkg/services/object/acl/acl.go
Outdated
| // find verb from token if it is present | ||
| verb := sourceVerbOfRequest(req, op) | ||
| // Check if session token verb is equal to the current operation. | ||
| // Unknown means everything is allowed. |
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.
Also, can you fix API spec and mention such behavior there?
Signed-off-by: Evgenii Stratonikov <[email protected]>
Close #1191 .
Signed-off-by: Evgenii Stratonikov [email protected]