Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-12032

REST API allows for creation of invalid virtual repositories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.9.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The REST API for repository creation allows the user to add any type of repository under a virtual repository of a specific type, thus creating invalid mixed-type virtual repos. The UI prevents this by limiting the repositories that can be included in a non-generic virtual repo.

      To duplicate:

      1. Create repositories of different types in the UI, or via REST:

      $ curl -u admin:password -XPUT "http://10.60.1.124:8088/artifactory/api/repositories/generic" -d '{"rclass":"local","packageType":"generic"}' --header "Content-Type: application/json"
      Successfully created repository 'generic' 
      $ curl -u admin:password -XPUT "http://10.60.1.124:8088/artifactory/api/repositories/maven" -d '{"rclass":"local","packageType":"maven"}' --header "Content-Type: application/json"
      Successfully created repository 'maven' 
      $ curl -u admin:password -XPUT "http://10.60.1.124:8088/artifactory/api/repositories/gitlfs" -d '{"rclass":"local","packageType":"gitlfs"}' --header "Content-Type: application/json"
      Successfully created repository 'gitlfs' 
      

      2. In the UI, attempt to create a virtual repository of type "maven." The UI will only allow you to add local and remote "maven" repositories.

      3. Create a "maven" virtual repository via REST. It will allow you to add any type of repo:

      $ curl -u admin:password -XPUT "http://10.60.1.124:8088/artifactory/api/repositories/v" -d '{"rclass" : "virtual","packageType" : "maven","repositories" : ["generic", "maven", "gitlfs"]}' --header "Content-Type: application/json"
      Successfully created repository 'v' 
      

      4. Verify in the UI that all repos were added under the virtual.

      5. Hit "save" on the virtual repo in the UI. UI throws an error: "Failed to update the repository." (See screenshot.)

      Users expect to get an http 4xx error response back when attempting something invalid via REST.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            mikem Mike Mitchell (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: