cli icon indicating copy to clipboard operation
cli copied to clipboard

"cf services" is throwing "You are not authorized to perform the requested action"

Open sivabalans opened this issue 8 years ago • 13 comments

Command

"cf services"

What occurred

Returns "You are not authorized to perform the requested action" error

What you expected to occur

List the services in my space.

CLI Version

cf version 6.35.0+5c7de3e32.2018-03-08

CC API Endpoint Version

api version: 2.75.0

CF Trace

"cf services -v" returns the following towards the end: REQUEST: [2018-03-14T13:48:50-07:00] GET /v2/service_plans/92fd5910-eefb-4f4f-947f-4d90f098f659 HTTP/1.1 Host: api.system.aws-usw02-dev.ice.predix.io Accept: application/json Authorization: [PRIVATE DATA HIDDEN] User-Agent: cf/6.35.0+5c7de3e32.2018-03-08 (go1.10; amd64 darwin)

RESPONSE: [2018-03-14T13:48:50-07:00] HTTP/1.1 403 Forbidden Content-Length: 131 Content-Type: application/json;charset=utf-8 Date: Wed, 14 Mar 2018 20:48:50 GMT Server: nginx X-Content-Type-Options: nosniff X-Vcap-Request-Id: 977c16e5-16fd-4f12-68d9-ffa95dfa1203 X-Vcap-Request-Id: 977c16e5-16fd-4f12-68d9-ffa95dfa1203::84ccb9a8-556c-4891-a6c3-6326349107e5 { "code": 10003, "description": "You are not authorized to perform the requested action", "error_code": "CF-NotAuthorized" }

Platform & Shell Details

Mac OS X 10.13.3 iTerm2 3.0.15

Any other relevant information

It works fine with CF CLI 6.34 for the same API endpoint.

sivabalans avatar Mar 14 '18 20:03 sivabalans

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/155992614

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Mar 14 '18 20:03 cf-gitbot

Hi @sivabalans, which user roles do you have for this logged in user on this org and space?

You can run the following commands to retrieve this information: cf org-users ORG cf space-users ORG SPACE

anyu avatar Mar 14 '18 22:03 anyu

Below are the output:

$cf org-users predix-acs-perf Getting users in org predix-acs-perf as predix-platform-perf...

ORG MANAGER admin predix-platform-perf

BILLING MANAGER No BILLING MANAGER found

ORG AUDITOR No ORG AUDITOR found

$cf space-users predix-acs-perf predix-acs-perf Getting users in org predix-acs-perf / space predix-acs-perf as predix-platform-perf

SPACE MANAGER admin predix-platform-perf

SPACE DEVELOPER admin predix-platform-perf predix-uom-deployer

SPACE AUDITOR No SPACE AUDITOR found

On Wed, Mar 14, 2018 at 3:12 PM, An Yu [email protected] wrote:

Hi @sivabalans https://github.com/sivabalans, which user roles do you have for this logged in user on this org and space?

You can run the following commands to retrieve this information: cf org-users ORG cf space-users ORG SPACE

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/cli/issues/1344#issuecomment-373192279, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-Cirhae1KlrK0yvgvgQRx7fCovzH3kks5teZW4gaJpZM4SrKHa .

-- http://www.twitter.com/sivabalans

sivabalans avatar Mar 14 '18 22:03 sivabalans

We aren't able to reproduce this bug. Can you post the whole -v output for the services command?

anyu avatar Mar 14 '18 22:03 anyu

@anyu - There is too much sensitive information in the output of -v. I need to find a way to scrub it before I post it here. But from what I can see, the difference seem to be in the /v2/service_plans/ call. This call is made from v6.35 CLI but the v6.34 CLI does not make this call. And this call is throwing the above error for me.

sivabalans avatar Mar 14 '18 22:03 sivabalans

@sivabalans we were able to reproduce the problem, we're currently looking into solutions right now.

The reason this is happening is because this org/space has an instance of a service that has been disabled for this particular org/space (or the system) that it previously had access to.

A temporary solution (using the newer CLI) is to enable-service-access back to this org. Another option is just to keep using the previously working CLI.

anyu avatar Mar 14 '18 23:03 anyu

Hi @sivabalans, we may have fixed this issue. Can you please try to reproduce it with a latest edge build of the CF CLI from here?

We will await your feedback before publishing a fix to the community.

n4wei avatar Mar 16 '18 17:03 n4wei

I tried it with the edge binary. Below are my observations:

  1. It still throws a bunch of errors before it returns the results for "cf services". But this time I do see the results eventually unlike before.
  2. Below are the errors:

GC02PW2WZG8WME:Downloads 212356793$ cf-cli_edge_osx/cf services Getting services in org predix-acs-perf / space predix-acs-perf as predix-platform-perf...

This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 92fd5910-eefb-4f4f-947f-4d90f098f659. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 92fd5910-eefb-4f4f-947f-4d90f098f659. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 8d55195f-df82-4de2-8a96-6793eed41bad. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 8d55195f-df82-4de2-8a96-6793eed41bad. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID b7ff68be-81d4-425a-ae0f-75a26ce35d91. This org is not authorized to view necessary data about this service. Contact your administrator regarding service GUID 17b034a7-fe03-4b12-a6ea-b24626b40ea6.

name service plan bound apps

                                          last operation

acs-asset-uaa predix-uaa

                                           create succeeded

acs-asset predix-asset Tiered acs-asset-adapter

                                           create succeeded
  1. Also, "cf services" command now takes 20 seconds to return the results:

real 0m19.742s user 0m0.346s sys 0m0.187s

  1. When I run the same "cf services" command with the 6.34 version of CLI, it returns no errors and the results come back in 2 seconds:

real 0m2.289s user 0m0.156s sys 0m0.042s

Hope this helps.

Thanks, Siva

On Fri, Mar 16, 2018 at 10:25 AM, Nick Wei [email protected] wrote:

Hi @sivabalans https://github.com/sivabalans, we may have fixed this issue. Can you please try to reproduce it with a latest edge build of the CF CLI from here https://github.com/cloudfoundry/cli#edge-binaries?

We will await your feedback before publishing a fix to the community.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/cli/issues/1344#issuecomment-373785898, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-CivtjITtpRudA9Wk_pFUiIFf3Zj4Mks5te_V2gaJpZM4SrKHa .

-- http://www.twitter.com/sivabalans

sivabalans avatar Mar 16 '18 17:03 sivabalans

Just a quick update. The edge CLI takes 20 seconds to return the results and not 1min and 6 sec as stated originally in the previous comment. I udpated the comment.

sivabalans avatar Mar 16 '18 17:03 sivabalans

@sivabalans thank you for verifying this. What you are seeing above is the new expected behavior. Please read on for the explanation.

  1. The services command used to make a single request to a summary endpoint to retrieve information displayed in the service and plan columns. However, the summary endpoint on the API side has a pagination bug that does not allow it to return beyond 50 results. As a result, we are individually getting service and plan information for each service instance and this inherently takes longer.
  2. As a result of individually getting service and plan information, you helped us discover a bug in the API where it returns 403s. After weighing different solutions and tradeoffs, we decided to display the warnings you see above for resources we do not have access to; and display what information we are able to retrieve from the API and still exit 0.

Please feel free to voice any concerns you may have.

n4wei avatar Mar 16 '18 18:03 n4wei

@nickwei84 thanks for the explanation. I presume until the pagination bug for the summary endpoint API is fixed, we have to live with those warnings. That should be fine for now.

sivabalans avatar Mar 16 '18 18:03 sivabalans

how to solve this problem?

sunqb avatar Sep 26 '20 09:09 sunqb

how to solve this problem?

Magomed-R avatar Dec 04 '25 16:12 Magomed-R