Repository navigation
Closed
Labels
Description
Sometimes the request to list the account gives a forbidden response after the user tries to list their own account
Note this issue only occurs randomly, not every time
❯ curl https://localhost:9200/ocs/v1.php/cloud/users/einstein -u einstein:relativity -k | xmllint --format -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 296 100 296 0 0 4417 0 --:--:-- --:--:-- --:--:-- 4417
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
<meta>
<status>error</status>
<statuscode>996</statuscode>
<message>{"id":"com.owncloud.api.accounts","code":403,"detail":"no permission for ListAccounts","status":"Forbidden"}</message>
</meta>
</ocs>
This issue gets fixed after restarting the server
❯ curl https://localhost:9200/ocs/v1.php/cloud/users/einstein -u einstein:relativity -k | xmllint --format -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 538 100 538 0 0 1368 0 --:--:-- --:--:-- --:--:-- 1365
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message>OK</message>
</meta>
<data>
<enabled>true</enabled>
<id>4c510ada-c86b-4815-8820-42cdf82c3d51</id>
<display-name>Albert Einstein</display-name>
<displayname>Albert Einstein</displayname>
<email>[email protected]</email>
<quota>
<free>2840756224000</free>
<used>5059416668</used>
<total>2845815640668</total>
<relative>0.18</relative>
<definition>default</definition>
</quota>
<uidnumber>20000</uidnumber>
<gidnumber>30000</gidnumber>
</data>
</ocs>
Server logs when failing
2020-11-09T13:41:32+05:45 WRN basic auth enabled, use only for testing or development service=proxy
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=de4e04e8664044e753bee810fc080393
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=36 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=291798 traceid=de4e04e8664044e753bee810fc080393 uri=/data/index.cs3/unique.github.com.owncloud.ocis.accounts.pkg.proto.v0.Account.OnPremisesSamAccountName/einstein url=/data/index.cs3/unique.github.com.owncloud.ocis.accounts.pkg.proto.v0.Account.OnPremisesSamAccountName/einstein
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=67f8e54f88924577399187af3c9395f0
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=584 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=245901 traceid=67f8e54f88924577399187af3c9395f0 uri=/data/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51 url=/data/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=feb094445c9ecf0ad92fa9d0333a9a7b
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=584 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=177808 traceid=feb094445c9ecf0ad92fa9d0333a9a7b uri=/data/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51 url=/data/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=4107ad4b69f385429b7001bd60b0bdf2
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=326 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=134727 traceid=4107ad4b69f385429b7001bd60b0bdf2 uri=/data/groups/509a9dcd-bb37-4f4f-a01a-19dca27d9cfa url=/data/groups/509a9dcd-bb37-4f4f-a01a-19dca27d9cfa
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=da7a9eaf3b178a1c7ad61e699322f175
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=198 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=130543 traceid=da7a9eaf3b178a1c7ad61e699322f175 uri=/data/groups/6040aa17-9c64-4fef-9bd0-77234d71bad0 url=/data/groups/6040aa17-9c64-4fef-9bd0-77234d71bad0
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=e3e779806cc68141507c2e6217ccc1cf
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=196 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=116235 traceid=e3e779806cc68141507c2e6217ccc1cf uri=/data/groups/dd58e5ec-842e-498b-8800-61f2ec6f911f url=/data/groups/dd58e5ec-842e-498b-8800-61f2ec6f911f
2020-11-09T13:41:32+05:45 INF access token is already provided pkg=rhttp service=storage traceid=c73f3a4da9404d323ec053e074343a19
2020-11-09T13:41:32+05:45 INF http end="09/Nov/2020:13:41:32 +0545" host=127.0.0.1 method=GET pkg=rhttp proto=HTTP/1.1 service=storage size=290 start="09/Nov/2020:13:41:32 +0545" status=200 time_ns=96626 traceid=c73f3a4da9404d323ec053e074343a19 uri=/data/groups/262982c1-2362-4afa-bfdf-8cbfef64a06e url=/data/groups/262982c1-2362-4afa-bfdf-8cbfef64a06e
2020-11-09T13:41:32+05:45 INF unary code=OK end="09/Nov/2020:13:41:32 +0545" from=tcp://127.0.0.1:51340 pkg=rgrpc service=storage start="09/Nov/2020:13:41:32 +0545" time_ns=92323 traceid=78ee20a0d00932bd65162c4b26f35a5f uri=/cs3.storage.registry.v1beta1.RegistryAPI/GetStorageProvider user-agent=grpc-go/1.26.0
2020-11-09T13:41:32+05:45 INF unary code=OK end="09/Nov/2020:13:41:32 +0545" from=tcp://127.0.0.1:35158 pkg=rgrpc service=storage start="09/Nov/2020:13:41:32 +0545" time_ns=532972 traceid=78ee20a0d00932bd65162c4b26f35a5f uri=/cs3.storage.provider.v1beta1.ProviderAPI/CreateHome user-agent=grpc-go/1.26.0
2020-11-09T13:41:32+05:45 INF unary code=OK end="09/Nov/2020:13:41:32 +0545" from=tcp://127.0.0.1:51322 pkg=rgrpc service=storage start="09/Nov/2020:13:41:32 +0545" time_ns=1760565 traceid=78ee20a0d00932bd65162c4b26f35a5f uri=/cs3.gateway.v1beta1.GatewayAPI/CreateHome user-agent=grpc-go/1.26.0
2020-11-09T13:41:32+05:45 ERR could not get account for user error="{\"id\":\"com.owncloud.api.accounts\",\"code\":403,\"detail\":\"no permission for ListAccounts\",\"status\":\"Forbidden\"}" service=ocs userid=einstein
Activity
refs commentedon Nov 9, 2020
In order to reproduce it correctly the proxy needs to have basic auth enabled. I was not able to reproduce it until I read the logs. Starting the server with the following command:
Without
PROXY_ENABLE_BASIC_AUTHset I just keep getting a997response back. So I'm guessing this is related to the basic auth + proxy combination. Will dig further into it.butonic commentedon Nov 9, 2020
correct.
no permission for ListAccountsis a log line from the role / permissions checks that is now in effect.refs commentedon Nov 9, 2020
@dpakach is there any extra step you're doing? By running the
curlcommand multiple times I am not able to reproduce itdpakach commentedon Nov 9, 2020
@refs We first noticed this issue when running in CI. like in
https://drone.owncloud.com/owncloud/ocis/1273/22/7
As you see all tests fail in some pipeline because of this. So rather than running curl multiple times, I think you should restart the server and try each time. When it's failing it fails every time.
I just ran ocis with
STORAGE_HOME_DRIVER=owncloud STORAGE_USERS_DRIVER=owncloud PROXY_ENABLE_BASIC_AUTH=true bin/ocis serverBut it happens very rarely (like once every 20 times) but it's an annoying thing when running in CI.
Also I deleted the contents of
/var/tmp/ocis-*every time but that may not be relevant here.refs commentedon Nov 9, 2020
So @butonic and I were able to reproduce it by doing:
STORAGE_HOME_DRIVER=owncloud STORAGE_USERS_DRIVER=owncloud PROXY_ENABLE_BASIC_AUTH=true ./ocis servercurl https://localhost:9200/ocs/v1.php/cloud/users/einstein -u einstein:relativity -k | xmllint --format -/var/tmp/ocis-*which only wipes the settings (which includes roles and permissions), but it does NOT wipe the account, which lives in/var/tmp/ocis/metadata/nodesWe got to jump in the sprint planning and will continue afterwards.
dpakach commentedon Nov 9, 2020
@refs, I did delete both
/var/tmp/ocisand/var/tmp/ocis-*directories. Sorry, I should have made it clear in the first comment.But since you reproduced it may be the real issue.
refs commentedon Nov 9, 2020
ha, interesting. Do you happen to know in which step are the directories removed?
dpakach commentedon Nov 9, 2020
@refs This is the exact steps I followed
a. If the issue is reproduced - 👍
b. If the issue is not reproduced- Goto step 1
butonic commentedon Nov 9, 2020
In Line 5284 of https://drone.owncloud.com/owncloud/ocis/1308/19/5 we have a winner ...
butonic commentedon Nov 9, 2020
🤔 The only suspicious thing I see is an account ID
Alicewith capital a... Just summons bad memories. Should work though...refs commentedon Nov 9, 2020
No I think we're good on that front, the users endpoint is case insensitive
refs commentedon Nov 9, 2020
I was looking earlier to the usage of
go-micro/metadatato store the roles @butonicrefs commentedon Nov 9, 2020
next idea:
Hunt down the first occurrence of this issue on CI and read the diff
dpakach commentedon Nov 10, 2020
@butonic @refs I ran git bisect and I think I found the commit that actually broke it
8e39d8b
hope this helps
refs commentedon Nov 10, 2020
Thanks!
fix: [stable-8.0][OCISDEV-1714] keep the role of a user when settings…
fix: [OCISDEV-1714] keep the role of a user when settings cannot read it
fix: [OCISDEV-1714] keep the role of a user when settings cannot read it
fix: [OCISDEV-1714] keep the role of a user when settings cannot read…