Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-7136

exportOrgLogs api with super user token doesn't work when enable FEATURE_SUPERUSERS_FULL_ACCESS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • quay-v3.11.2
    • quay-v3.11.0
    • quay

      Description of problem:

      When enable FEATURE_SUPERUSERS_FULL_ACCESS, exportOrgLogs api with super user token doesn't work  against organization created by normal user. 

      Version-Release number of selected component (if applicable):

      quay-operator-bundle-container-v3.11.1-18)
      ------------------------------ 
      registry.redhat.io/quay/quay-operator-rhel8@sha256:a3a2171448b30385700e6f64633016abfb5dc331849a91cdc354405a32eb444c
      ------------------------------
      registry.redhat.io/quay/quay-rhel8@sha256:bca647c67c7ece7fb427498db44af850ca05b4cba2f55b78d90fb9d7059883e7

      How reproducible:

      1. enable FEATURE_SUPERUSERS_FULL_ACCESS in quay config.yaml

      FEATURE_SUPERUSERS_FULL_ACCESS: true 
      SUPER_USERS:
        - whuquay

      2. Create a normal user "user1" and a super user "whuquay".

      3. log in quay by normal user "user1" and create a repository "user1_org/user1_repo"

      4. push a image to repository "user1_org/user1_repo"

      5. call  exportOrgLogs API with super user token against organization "user1_org". 

      Actual results:

      Super user can't  export logs of organization created by normal user by calling api "POST /api/v1/organization/{orgname}/exportlogs" when enable FEATURE_SUPERUSERS_FULL_ACCESS.

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : XZre7yUiq7F4DLzGsFAT60NuxOTuiKdkICmuwKaG
      -> normal user token: KSN96FEMn02FrpCsYNjRQrLG3Ps8aWIdSnmSDqan
      ->
      -> exportOrgLogs
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=  
      
      $ curl -k -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer XZre7yUiq7F4DLzGsFAT60NuxOTuiKdkICmuwKaG"  --data '{"callback_url": "https://webhook.site/ffd85e96-d5d9-4a80-a40b-342ae3308119"}' https://quayregistry-quay-quay-enterprise.apps.whu415aw12.qe.devcluster.openshift.com/api/v1/organization/user1_org/exportlogs
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   348  100   271  100    77    270     76  0:00:01  0:00:01 --:--:--   348
      {
        "detail": "Unauthorized",
        "error_message": "Unauthorized",
        "error_type": "insufficient_scope",
        "title": "insufficient_scope",
        "type": "https://quayregistry-quay-quay-enterprise.apps.whu415aw12.qe.devcluster.openshift.com/api/v1/error/insufficient_scope",
        "status": 403
      }

       

      Expected results

      Super user can  export logs of organization created by normal user by calling api "POST /api/v1/organization/{orgname}/exportlogs" when enable FEATURE_SUPERUSERS_FULL_ACCESS

      Additional Information:

      Normal user "user1" can export logs by api "POST /api/v1/organization/{orgname}/exportlogs" successfully.

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : XZre7yUiq7F4DLzGsFAT60NuxOTuiKdkICmuwKaG
      -> normal user token: KSN96FEMn02FrpCsYNjRQrLG3Ps8aWIdSnmSDqan
      ->
      -> exportOrgLogs
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      % curl -k -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer KSN96FEMn02FrpCsYNjRQrLG3Ps8aWIdSnmSDqan"  --data '{"callback_url": "https://webhook.site/ffd85e96-d5d9-4a80-a40b-342ae3308119"}' https://quayregistry-quay-quay-enterprise.apps.whu415aw12.qe.devcluster.openshift.com/api/v1/organization/user1_org/exportlogs |jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   131  100    54  100    77     60     85 --:--:-- --:--:-- --:--:--   146
      {
        "export_id": "9272630d-9851-48bf-8fc6-8fe5246e461f"
      }

              bcaton@redhat.com Brandon Caton
              rhwhu Weihua Hu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: