rule.ip does not respect http-proxy

Open
#3,107 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
erlang
Domain
api, backend, security

Research direction

Start by inspecting the ejabberd_http handling of X-Real-IP and the rule.ip checks used by api_permissions. Reproduce the setup behind an HTTP reverse proxy using the shown nginx headers, then verify that an internal-only permission is not exposed and that the client IP is interpreted correctly.

Written by the indexing model from the issue text.

Description

Kind:Enhancement

Environment

  • ejabberd version: 19.09.1
  • Erlang version: Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.5
  • OS: Archlinux
  • Installed from: distro package

Bug description

If there is a http reverse proxy in front of ejabberd module: ejabberd_http it does not handle the HTTP Header-Field X-Real-IP.

(eg. nginx):

		proxy_set_header    Host            $host;
		proxy_set_header    X-Real-IP       $remote_addr;
		proxy_set_header    X-Forwarded-for $proxy_add_x_forwarded_for;

So api_permissions would be leaked public:

api_permissions:
  "onlyinternal":
    who:
       ip: ::1/128
Dominant language
Erlang
Stars
6.7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

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.

More from processone/ejabberd

All issues in processone/ejabberd

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.