Skip to content
  • Marcelo Vanzin's avatar
    17d83e1e
    [SPARK-19652][UI] Do auth checks for REST API access. · 17d83e1e
    Marcelo Vanzin authored
    The REST API has a security filter that performs auth checks
    based on the UI root's security manager. That works fine when
    the UI root is the app's UI, but not when it's the history server.
    
    In the SHS case, all users would be allowed to see all applications
    through the REST API, even if the UI itself wouldn't be available
    to them.
    
    This change adds auth checks for each app access through the API
    too, so that only authorized users can see the app's data.
    
    The change also modifies the existing security filter to use
    `HttpServletRequest.getRemoteUser()`, which is used in other
    places. That is not necessarily the same as the principal's
    name; for example, when using Hadoop's SPNEGO auth filter,
    the remote user strips the realm information, which then matches
    the user name registered as the owner of the application.
    
    I also renamed the UIRootFromServletContext trait to a more generic
    name since I'm using it to store more context information now.
    
    Tested manually with an authentication filter enabled.
    
    Author: Marcelo Vanzin <vanzin@cloudera.com>
    
    Closes #16978 from vanzin/SPARK-19652.
    17d83e1e
    [SPARK-19652][UI] Do auth checks for REST API access.
    Marcelo Vanzin authored
    The REST API has a security filter that performs auth checks
    based on the UI root's security manager. That works fine when
    the UI root is the app's UI, but not when it's the history server.
    
    In the SHS case, all users would be allowed to see all applications
    through the REST API, even if the UI itself wouldn't be available
    to them.
    
    This change adds auth checks for each app access through the API
    too, so that only authorized users can see the app's data.
    
    The change also modifies the existing security filter to use
    `HttpServletRequest.getRemoteUser()`, which is used in other
    places. That is not necessarily the same as the principal's
    name; for example, when using Hadoop's SPNEGO auth filter,
    the remote user strips the realm information, which then matches
    the user name registered as the owner of the application.
    
    I also renamed the UIRootFromServletContext trait to a more generic
    name since I'm using it to store more context information now.
    
    Tested manually with an authentication filter enabled.
    
    Author: Marcelo Vanzin <vanzin@cloudera.com>
    
    Closes #16978 from vanzin/SPARK-19652.
Loading