nextcloud / nextcloud/server

[Bug]: OpenMetrics endpoint do not have to be a trusted_domain

Open
#58,614 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 33-feedback bug
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Metrics Endpoint should not be evaluted to be in trusted_domains (metrics are scraped internal and the nextcloud could have changing ip address -> changing trusted_domains).

Steps to reproduce
  1. setup nextcloud (behind-nginx)
  2. setup openmetrics_allowed_clients
  3. query /metrics

respone: HTTP/1.1 400 Bad Request

Expected behavior

response metrics

Nextcloud Server version

33

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs
{"reqId":"ZZw8YpYRIhxl2Frsp2xR","level":1,"time":"2026-02-27T15:13:25+00:00","remoteAddr":"10.42.0.188","user":"--","app":"core","method":"GET","url":"/metrics","scriptName":"/index.php","message":"Trusted domain error. \"10.42.0.188\" tried to access using \"10.42.0.150\" as host.","userAgent":"Wget","version":"33.0.0.16","data":{"app":"core"}}
Additional info

Config contains:

  ["openmetrics_allowed_clients"]=>
  array(1) {
    [0]=>
    string(12) "10.42.0.0/15"
  }
    <?php
    $CONFIG = array (
      'allow_local_remote_servers' => true,
      'trusted_proxies' => array(
        0 => '127.0.0.1',
        1 => '10.0.0.0/8',
      ),
      'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'),
    );

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Nextcloud /metrics request and the openmetrics_allowed_clients check, then inspect where trusted_domains validation rejects the request. Reproduce the reported setup with a client in 10.42.0.0/15 and verify that the endpoint returns metrics without requiring the client or host to be in trusted_domains.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.