Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
1.8.0, 2.0.0
-
None
-
None
Description
The SentryStore.toSentryPrivilege() function:
private TSentryPrivilege toSentryPrivilege(TSentryAuthorizable tAuthorizable) throws SentryInvalidInputException { TSentryPrivilege tSentryPrivilege = new TSentryPrivilege(); tSentryPrivilege.setDbName(fromNULLCol(tAuthorizable.getDb())); tSentryPrivilege.setServerName(fromNULLCol(tAuthorizable.getServer())); tSentryPrivilege.setTableName(fromNULLCol(tAuthorizable.getTable())); tSentryPrivilege.setColumnName(fromNULLCol(tAuthorizable.getColumn())); tSentryPrivilege.setURI(fromNULLCol(tAuthorizable.getUri())); PrivilegeScope scope; if (!isNULL(tSentryPrivilege.getColumnName())) { scope = PrivilegeScope.COLUMN; } else if (!isNULL(tSentryPrivilege.getTableName())) { scope = PrivilegeScope.TABLE; } else if (!isNULL(tSentryPrivilege.getDbName())) { scope = PrivilegeScope.DATABASE; } else if (!isNULL(tSentryPrivilege.getURI())) { scope = PrivilegeScope.URI; } else { scope = PrivilegeScope.SERVER; } tSentryPrivilege.setPrivilegeScope(scope.name()); tSentryPrivilege.setAction(AccessConstants.ALL); return tSentryPrivilege; }
Note that it blindly copies all fields from the source, replacing null with empty strings and both itself and other consumers downstream do not know which fields were actually set and which were not. Instead it should just clone fields that were set.
Attachments
Attachments
Issue Links
- is cloned by
-
SENTRY-1582 Comments to clarify the intent of string manipulation methods in SentryStore.java
- Resolved
- is related to
-
SENTRY-1540 SentryStore.isMultiActionsSupported() is always true
- Patch Available
- links to