Uploaded image for project: 'Policy Framework'
  1. Policy Framework
  2. POLICY-3929

Race condition in apex-editor model upload

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Medium
    • Resolution: Done
    • Guilin Release, Honolulu Release, Istanbul Release, Jakarta Release
    • Jakarta Release
    • gui
    • None

    Description

      This bug was previously documented in POLICY-2853, but never fixed.

      The code takes in a request parameter and stores it in a global variable:

      public ApexApiResult uploadModel(@QueryParam("userId") final String userid) {
          if (!StringUtils.isBlank(userid)) {
              ApexEditorMain.getParameters().setUploadUserid(userid);
          }
          return processRestCommand(RestCommandType.MODEL, RestCommand.UPLOAD);
      }
      

      Thus if two users upload at the same time, one userId may overwrite the other.

      An appropriate fix would be to use userId param only for this request if specified, otherwise use the upload-userid command line param specified at apex-editor startup. This will work as ApexFiles.js sets the userId param for each upload request:

      function files_fileUpload() {
          let requestURL = window.restRootURL + "/Model/Upload";
          const userId = new URLSearchParams(window.location.search).get('userId');
          if (userId) {
              requestURL = requestURL + "?userId=" + userId;
          }
          // ...
      }
      

      Attachments

        Issue Links

          # Subject Branch Project Status CR V

          Activity

            People

              danielhanrahan Daniel Hanrahan
              danielhanrahan Daniel Hanrahan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: