Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-872 Uber jira for HMS HA + Sentry HA redesign
  3. SENTRY-1807

NotificationProcessor may put the wrong path in the update

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 2.0.0
    • 2.0.0
    • Sentry

    Description

      Looking at NotificationProcessor we see the following:

        private void addPaths(String authzObj, Collection<String> locations, long seqNum)
              throws Exception {
          // AuthzObj is case insensitive
          authzObj = authzObj.toLowerCase();
      
          PathsUpdate update = new PathsUpdate(seqNum, false);
          Collection<String> paths = new HashSet<>(locations.size());
          // addPath and persist into Sentry DB.
          // Skip update if encounter malformed path.
          for (String location : locations) {
            String pathTree = getPath(location);
              update.newPathChange(authzObj).addToAddPaths(splitPath(pathTree)); // --> Here
              paths.add(pathTree);
            }
          }
          sentryStore.addAuthzPathsMapping(authzObj, paths, update);
        }
      

      Here each path is added to the update. The problem is that splitPath doesn't remove the prefix (hdfs://) from the path so the update is incorrect.

      Original code did this:

        public void addPath(String authzObj, String path) {
          List<String> pathTree = null;
          pathTree = PathsUpdate.parsePath(path);
          PathsUpdate update = createHMSUpdate();
          update.newPathChange(authzObj.toLowerCase()).addToAddPaths(pathTree);
          notifySentryAndApplyLocal(update);
        }
      

      here parsePath removed the prefix before the split on "/". This was changed as part of SENTRY-1687. The change was ok for the full update but it seems that it is wrong for delta update.

      Attachments

        Activity

          People

            akolb Alex Kolbasov
            akolb Alex Kolbasov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 72h
                72h
                Remaining:
                Remaining Estimate - 72h
                72h
                Logged:
                Time Spent - Not Specified
                Not Specified