A possible security concern when managing a public-facing GitLab instance is the ability to steal a user’s IP address by referencing images in issues and comments.
For example, adding
![Example image](http://example.com/example.png) to
an issue description causes the image to be loaded from the external
server in order to be displayed. However, this also allows the external server
to log the IP address of the user.
One way to mitigate this is by proxying any external images to a server you control.
GitLab can be configured to use an asset proxy server when requesting external images/videos/audio in issues and comments. This helps ensure that malicious images do not expose the user’s IP address when they are fetched.
We currently recommend using cactus/go-camo as it supports proxying video, audio, and is more configurable.
A Camo server is used to act as the proxy.
To install a Camo server as an asset proxy:
go-camoserver. Helpful instructions can be found in building cactus/go-camo.
Make sure your instance of GitLab is running, and that you have created a private API token. Using the API, configure the asset proxy settings on your GitLab instance. For example:
curl --request "PUT" "https://gitlab.example.com/api/v4/application/settings?\ asset_proxy_enabled=true&\ asset_proxy_url=https://proxy.gitlab.example.com&\ asset_proxy_secret_key=<somekey>" \ --header 'PRIVATE-TOKEN: <my_private_token>'
The following settings are supported:
Enable proxying of assets. If enabled, requires:
Shared secret with the asset proxy server.
URL of the asset proxy server.
asset_proxy_allowlistinstead) Assets that match these domain(s) are NOT proxied. Wildcards allowed. Your GitLab installation URL is automatically allowed.
Assets that match these domain(s) are NOT proxied. Wildcards allowed. Your GitLab installation URL is automatically allowed.
Restart the server for the changes to take effect. Each time you change any values for the asset proxy, you need to restart the server.
Once the Camo server is running and you’ve enabled the GitLab settings, any image, video, or audio that references an external source are proxied to the Camo server.
For example, the following is a link to an image in Markdown:
The following is an example of a source link that could result: