Skip to content

Add expose-version-header setting to control X-Puppet-Version disclosure - #534

Open
slauger wants to merge 1 commit into
OpenVoxProject:mainfrom
slauger:fix/expose-version-header
Open

Add expose-version-header setting to control X-Puppet-Version disclosure#534
slauger wants to merge 1 commit into
OpenVoxProject:mainfrom
slauger:fix/expose-version-header

Conversation

@slauger

@slauger slauger commented Jul 24, 2026

Copy link
Copy Markdown
Member

Adds a new expose-version-header setting (default true) so operators can stop the server from sending the X-Puppet-Version header.

Right now that header goes out on every response — including 401/403 to unauthenticated clients — so anyone who can reach the API can read the exact server version.

Usage (nothing changes unless you set it):

# puppetserver.conf
expose-version-header: false

When false, the header is stripped from all responses.

Tested: unit test for the middleware, an integration test that boots the server and checks the header on/off over HTTP, plus a manual check against a running container.

The X-Puppet-Version response header is emitted from two places: the outermost wrap-with-puppet-version-header middleware (present on every response, including 401/403 to unauthenticated clients) and the JRuby request handler, which copies it from the Ruby master response. Either way the exact server version is disclosed to anyone able to reach the API.

Add a top-level expose-version-header setting (default true, so behaviour is unchanged). When set to false, the master and CA services pass an empty version to wrap-with-puppet-version-header, which then strips any X-Puppet-Version header from the response - covering the JRuby-handled endpoints as well.

The setting is deliberately top-level rather than under [:puppetserver ...]: that config section is assembled from core Puppet settings at runtime, and a HOCON puppetserver{} block would clobber it (breaking CA settings at boot). It is documented, commented out with its default, in the shipped puppetserver.conf.

Covered by a unit test for the middleware (add/strip/nil cases) and an integration test that boots the server and asserts the header over HTTP with the setting unset and false.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Simon Lauger <simon@lauger.de>
@bastelfreak bastelfreak added the enhancement New feature or request label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants