Sadanand Shenoy created HDFS-17980:
--------------------------------------

             Summary: Propagate Rename.TO_TRASH in authorization context for 
external enforcers
                 Key: HDFS-17980
                 URL: https://issues.apache.org/jira/browse/HDFS-17980
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Sadanand Shenoy
            Assignee: Sadanand Shenoy


When HDFS Trash is enabled, {{rm}} is executed as an internal {{rename}} to 
{{.Trash}} using {{{}Options.Rename.TO_TRASH{}}}.
 Today, external authorization plugins (for example Ranger via 
{{{}checkPermissionWithContext{}}}) receive {{{}operationName=rename{}}}, but 
do not get an explicit trash-intent signal. As a result, {{rm}} (to trash) and 
{{mv}} appear identical from authorization/audit context.

This JIRA proposes adding and propagating a dedicated context flag (for example 
{{{}renameToTrash{}}}) in {{INodeAttributeProvider.AuthorizationContext}} so 
external enforcers can distinguish:
 * {{rm}} with trash enabled -> {{{}operationName=rename{}}}, 
{{renameToTrash=true}}
 * {{mv}} -> {{{}operationName=rename{}}}, {{renameToTrash=false}}
 * {{rm -skipTrash}} -> {{operationName=delete}}

Scope (HDFS side)
 * Add {{renameToTrash}} field to {{AuthorizationContext}} and its 
builder/accessors.
 * Propagate the flag through {{FSPermissionChecker}} when building context for 
{{{}checkPermissionWithContext{}}}.
 * In {{{}FSNamesystem.renameTo(..., Options.Rename... options){}}}, set the 
flag based on presence of {{{}Options.Rename.TO_TRASH{}}}, and clear it in 
{{finally}} to avoid ThreadLocal leakage.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to