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

getRepoBuildLogs API with super user token doesn't work when enable FEATURE_SUPERUSERS_FULL_ACCESS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • quay-v3.11.0
    • quay

      Description of problem:

      When enable FEATURE_SUPERUSERS_FULL_ACCESS, getRepoBuildLogs API with super user token doesn't work against build 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
      FEATURE_BUILD_SUPPORT: true
      FEATURE_GITHUB_BUILD: true
      GITHUB_TRIGGER_CONFIG:
        API_ENDPOINT: https://api.github.com/
        CLIENT_ID: ........
        CLIENT_SECRET:  .............
        GITHUB_ENDPOINT: https://github.com/
      BUILDMAN_HOSTNAME: quayregistry-quay-builder-quay-enterprise.apps.whu415aw17.qe.devcluster.openshift.com:443 
      BUILD_MANAGER:
      - ephemeral
      - ALLOWED_WORKER_COUNT: 20 
        ORCHESTRATOR_PREFIX: buildman/production/
        ORCHESTRATOR:
          REDIS_HOST: quayregistry-quay-redis
          REDIS_PASSWORD: ""
          REDIS_SSL: false
          REDIS_SKIP_KEYSPACE_EVENT_SETUP: false
        EXECUTORS:
        - EXECUTOR: kubernetesPodman
          DEBUG: true
          NAME: openshift
          BUILDER_NAMESPACE: virtual-builds 
          SETUP_TIME: 180
          QUAY_USERNAME: '........'
          QUAY_PASSWORD: e........8 
          BUILDER_CONTAINER_IMAGE: brew.registry.redhat.io/rh-osbs/quay-quay-builder-rhel8:v3.11.1-3 
          # Kubernetes resource options
          K8S_API_SERVER: api.whu415aw17.qe.devcluster.openshift.com:6443 
          K8S_API_TLS_CA: /conf/stack/extra_ca_certs/build_cluster.crt
          VOLUME_SIZE: 8G
          KUBERNETES_DISTRIBUTION: openshift
          CONTAINER_MEMORY_LIMITS: 1G 
          CONTAINER_CPU_LIMITS: 1000m
          CONTAINER_MEMORY_REQUEST: 1G 
          CONTAINER_CPU_REQUEST: 500m
          NODE_SELECTOR_LABEL_KEY: ""
          NODE_SELECTOR_LABEL_VALUE: ""
          SERVICE_ACCOUNT_NAME: quay-builder 
          SERVICE_ACCOUNT_TOKEN: e........c 
      USERFILES_LOCATION: default
      USERFILES_PATH: userfiles

      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_repo2"

      4 create a build trigger and start a build process

      5. call getRepoBuildLogs API with super user token to get  build logs.

      Actual results:

      Super user can't get build logs generated by normal user by calling API "GET /api/v1/repository/{repository}/build/{build_uuid}/logs"  when enable FEATURE_SUPERUSERS_FULL_ACCESS

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : SvnVd3cYch41TYvWgyTcpehuQxWjkUihpLy4N2ZX
      -> normal user token: 5eWACBpojJYUnWd8gfOH3a9lWBMthwAIye2vcSSj
      ->
      -> get the specific build logs by super user
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      ------------------------------ 
      $ curl -k -X GET -H "Content-Type: application/json" -H "Authorization: Bearer SvnVd3cYch41TYvWgyTcpehuQxWjkUihpLy4N2ZX" https://quayregistry-quay-quay-enterprise.apps.whu415aw17.qe.devcluster.openshift.com/api/v1/repository/user1_org/user1_repo1/build/dab6d976-bb05-4be9-affb-406d54d44845/logs
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   271  100   271    0     0    146      0  0:00:01  0:00:01 --:--:--   146
      {
        "detail": "Unauthorized",
        "error_message": "Unauthorized",
        "error_type": "insufficient_scope",
        "title": "insufficient_scope",
        "type": "https://quayregistry-quay-quay-enterprise.apps.whu415aw17.qe.devcluster.openshift.com/api/v1/error/insufficient_scope",
        "status": 403
      } 

      Expected results

      Super user can get build logs generated by normal user by calling API "GET /api/v1/repository/{repository}/build/{build_uuid}/logs"  when enable FEATURE_SUPERUSERS_FULL_ACCESS

      Additional Information:

      Normal user "user1" can get build logs by calling API "GET /api/v1/repository/{repository}/build/{build_uuid}/logs"  successfully.

      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      -> super user token : SvnVd3cYch41TYvWgyTcpehuQxWjkUihpLy4N2ZX
      -> normal user token: 5eWACBpojJYUnWd8gfOH3a9lWBMthwAIye2vcSSj
      ->
      -> get the specific build logs by normal user
      =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=
      
      
      ------------------------------
      % curl -k -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 5eWACBpojJYUnWd8gfOH3a9lWBMthwAIye2vcSSj" https://quayregistry-quay-quay-enterprise.apps.whu415aw17.qe.devcluster.openshift.com/api/v1/repository/user1_org/user1_repo1/build/dab6d976-bb05-4be9-affb-406d54d44845/logs|jq .
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   502  100   502    0     0    496      0  0:00:01  0:00:01 --:--:--   497
      {
        "start": 0,
        "total": 3,
        "logs": [
          {
            "message": "build-scheduled",
            "type": "phase",
            "data": {
              "datetime": "2024-05-09 06:41:07.584079"
            }
          },
          {
            "message": "unpacking",
            "type": "phase",
            "data": {
              "datetime": "2024-05-09 06:41:11.175274"
            }
          },
          {
            "message": "pulling",
            "type": "phase",
            "data": {
              "registry_url": "quayregistry-quay-quay-enterprise.apps.whu415aw17.qe.devcluster.openshift.com",
              "base_image": "registry.access.redhat.com/ubi7/ubi",
              "base_image_tag": "latest",
              "datetime": "2024-05-09 06:41:11.704787"
            }
          }
        ]
      } 

       

       

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

                Created:
                Updated:
                Resolved: