The informational web page for the Jenkins CLI is reached via the URL [jenkins server URL]/cli in a web browser. Any attempt to actually use the CLI goes through the same URL. This presents a serious problem in the following case:
our organization provides authentication through a corporate servlet filter which must be enabled by adding a filter to web.xml:
Originally, this filter came with instructions to use the commented-out line
But this provides a back door that allows non-authenticated users to access the web interface without going through the filter.
Changing it as we did above to
stops this access but causes the cli not to work - attempts to access it by command such as
java -jar /path/to/jenkins-cli.jar -s http://[JENKINS_URL]/jenkins -http -auth @[HOME]/.jenkins-cli help
as described on the Jenkins CLI Http Connection doc gets transformed into
and gives a 401 error.
Is there any reason WHY the URL accessing the cli itself has to be the same as the URL for accessing the information page about the CLI? If the latter was accessible via a URL such as
then the two cases could be differentiated and a filter such as described above could work correctly in both cases - preventing access to the info page just like the rest of the UI without authentication, but allowing actual command line access with the -auth mechanism.