Skip to content

Tomcat security and API #2872

@unhipzippo

Description

@unhipzippo

(Testing on OpenGrok 1.2.24, AdoptOpenJDK 11.0.3, Tomcat 9.0.21 on Oracle Linux 7.6)

If OpenGrok is running inside a Tomcat instance which uses Tomcat security to protect the entire OpenGrok webapp (rather than using the OpenGrok-specific authorization framework), the Tomcat security defaults to extending to the OpenGrok API as well. Since the OpenGrok indexer's call to the configuration API endpoint doesn't expect/include authorization, this results in indexer completion never informing the webapp of the new configuration.

Somewhat related issues:

#2352
#2635

In order to permit the indexer to update the webapp with new configuration, https://github.com/oracle/opengrok/wiki/Authorization recommends exempting API calls from security entirely:

   <security-constraint>
       <web-resource-collection>                                               
           <web-resource-name>API endpoints are checked separately by the web app</web-resource-name>
           <url-pattern>/api/*</url-pattern>                                   
       </web-resource-collection>                                              
   </security-constraint>

However, since the API search endpoint can return data which may be considered privileged (e.g. lines of source code), permitting completely public access to the search / suggest endpoints might not be ideal. (@tulinkry alludes to this in #2635 (comment))

Is there a recommended alternative configuration if we want to apply security to API calls?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions