Uploaded image for project: 'Red Hat Developer Hub Bugs'
  1. Red Hat Developer Hub Bugs
  2. RHDHBUGS-1757

[RBAC Plugin]: showcase throws an error when retrieving dynamic plugin policies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • None
    • RBAC Plugin
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      Describe the bug

      Showcase is returning the following error whenever a user attempts to retrieve the plugin permission policies of a dynamic plugin. 

       

      {
          "error": {
              "name": "SyntaxError",
              "message": "Unexpected token < in JSON at position 0", 
              "stack": ...
          }
      }

      It seems like the problem has to do with line 55 of rbacDynamicPluginsModule.ts in the showcase repo. What is happening is the suffix -backend-dynamic is to be removed from the plugin id so that the rbac plugin can consume it during the well known permissions api calls. However, it seems like this does not always work for dynamic plugins that do not have the suffix -backend-dynamic.

       

      In the reproduction below, I am adding the Kubernetes backend plugin as a dynamic plugin. The name of the plugin ends up being 'backstage-plugin-kubernetes-backend'. After the removals, it will end up being 'kubernetes-backend'.

      Expected Behavior

      The RBAC plugin should be able to return the permission policies of dynamic plugins.

      What are the steps to reproduce this bug?

      1. Enable the RBAC backend
      2. Give yourself admin access
      3. Enable the Kubernetes backend plugin as a dynamic plugin
      4. Start backstage-showcase
      5. Retrieve your token
      6. Attempt to make the following call
        curl --location 'http://localhost:7007/api/permission/plugins/policies' \ --header 'Authorization: Bearer XXX' 
      1. Notice the above error

       

              Unassigned Unassigned
              rh-ee-pknight Patrick Knight
              RHIDP - Dynamic Plugins
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: