"Forwarded for headers" setup check trusts a client-sent Remote-Addr header and ignores CIDR proxies
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza por apps/settings/lib/SetupChecks/ForwardedForHeaders.php y compara la búsqueda de direcciones y la comprobación de proxies de confianza con Request::getRemoteAddress() e IpUtils::checkIp(). Lee apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php y añade cobertura para una cabecera Remote-Addr enviada por el cliente y un proxy de confianza en formato CIDR. La tarea estará terminada cuando la comprobación de configuración use la dirección del servidor, gestione rangos CIDR y las pruebas pasen.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug description
The ForwardedForHeaders setup check reads the connecting address with getHeader('REMOTE_ADDR'):
Request::getHeader() first looks at HTTP_REMOTE_ADDR, i.e. a Remote-Addr: request header sent by the client, and only falls back to the real REMOTE_ADDR server variable afterwards:
So the check result depends on a client-controlled header (or on a proxy forwarding such a header). Furthermore the trusted proxy comparison is an exact in_array():
so for proxies configured in CIDR notation (e.g. 172.16.0.0/12), which Request::getRemoteAddress() supports, the check never reports the resolved address nor the misconfiguration warning.
This only affects the setup check, not Request::getRemoteAddress() itself.
Steps to reproduce
Found by code reading.
- Configure
trusted_proxieswith a CIDR range, e.g.['172.16.0.0/12'], behind a reverse proxy in that range. - Open Administration settings → Overview: the "Your IP address was resolved as …" success / warning is never shown.
- Send the setup check request with an additional
Remote-Addr: 1.2.3.4header: the check evaluates1.2.3.4as the connecting address.
Expected behavior
The check uses the real REMOTE_ADDR server variable (not a client header with the same name) and matches it against trusted_proxies the same way Request::getRemoteAddress() does (CIDR aware, IpUtils::checkIp()), covered by tests in apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php.
Nextcloud version
master
- Lenguaje dominante
- PHP
- Estrellas
- 37.6k
- Forks
- 5.4k
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 605
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nextcloud/server
-
Document lexicon.default.userconfig and lexicon.default.userconfig.enforced in config.sample.phpAbiertoenhancement feature: settings good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
bug feature: previews and thumbnails performance 🚀
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug feature: TaskProcessing good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
files_external occ commands crash with InvalidArgumentException for SMB mounts without credentialsAbiertobug feature: external storage feature: occ good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
occ config:app:set --value ignores --no-sensitive (and drops --sensitive for boolean values)Abiertobug feature: occ
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
Todos los issues de nextcloud/server
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
nextcloud/integration_openai#480 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
a11y
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
omeka/plugin-Contribution#84 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
recca0120/vscode-phpunit#620 ·
Los mantenedores suelen responder en 1 día
-
Validation rule generation for recursive Data objects is unbounded (O(payload depth))Posiblemente ocupada @irfanm96 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
spatie/laravel-data#1226 ·