Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-6851

Race condition in TableAuthManager.updateGlobalCache()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.94.1, 0.95.2
    • 0.94.2
    • security
    • None

    Description

      When new global permissions are assigned, there is a race condition, during which further authorization checks relying on global permissions may fail.

      In TableAuthManager.updateGlobalCache(), we have:

          USER_CACHE.clear();
          GROUP_CACHE.clear();
          try {
            initGlobal(conf);
          } catch (IOException e) {
            // Never happens
            LOG.error("Error occured while updating the user cache", e);
          }
          for (Map.Entry<String,TablePermission> entry : userPerms.entries()) {
            if (AccessControlLists.isGroupPrincipal(entry.getKey())) {
              GROUP_CACHE.put(AccessControlLists.getGroupName(entry.getKey()),
                              new Permission(entry.getValue().getActions()));
            } else {
              USER_CACHE.put(entry.getKey(), new Permission(entry.getValue().getActions()));
            }
          }
      

      If authorization checks come in following the .clear() but before repopulating, they will fail.

      We should have some synchronization here to serialize multiple updates and use a COW type rebuild and reassign of the new maps.

      This particular issue crept in with the fix in HBASE-6157, so I'm flagging for 0.94 and 0.96.

      Attachments

        1. HBASE-6851_3.patch
          18 kB
          Gary Helmling
        2. HBASE-6851_2.patch
          18 kB
          Gary Helmling
        3. HBASE-6851.patch
          18 kB
          Gary Helmling

        Activity

          People

            ghelmling Gary Helmling
            ghelmling Gary Helmling
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: