crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 275 forks source link

HTTP-Bridge Publisher does not support all possible options #1829

Closed yankos closed 2 years ago

yankos commented 3 years ago

Crossbar version:

    :::::::::::::::::
          :::::          _____                      __
    :::::   :   :::::   / ___/____ ___   ___  ___  / /  ___ _ ____
    :::::::   :::::::  / /__ / __// _ \ (_-< (_-< / _ \/ _ `// __/
    :::::   :   :::::  \___//_/   \___//___//___//_.__/\_,_//_/
          :::::
    :::::::::::::::::   Crossbar v20.8.1

    Copyright (c) 2013-2020 Crossbar.io Technologies GmbH, licensed under AGPL 3.0.

 Crossbar.io        : 20.8.1
   txaio            : 20.4.1
   Autobahn         : 20.7.1
     UTF8 Validator : autobahn
     XOR Masker     : autobahn
     JSON Codec     : stdlib
     MsgPack Codec  : umsgpack-2.7.1
     CBOR Codec     : cbor-1.0.0
     UBJSON Codec   : ubjson-0.16.1
     FlatBuffers    : flatbuffers-?.?.?
   Twisted          : 20.3.0-EPollReactor
   LMDB             : 1.0.0/lmdb-0.9.24
   Python           : 3.6.9/PyPy-7.3.1
 Frozen executable  : no
 Operating system   : Linux-5.4.0-53-generic-x86_64-with-debian-bullseye-sid
 Host machine       : x86_64
 Release key        : RWQ4VrXXmZuEsP4YXlhRfRu+ZqVwNC1qmyJaWCXX/sv4Dqiy4SiPa0Yy

Output:

Output of HTTP publish request.

{"id":6490054205456194}

Steps to reproduce:

  1. Configure crossbar with one realm and full access for any user (anonymous role);
  2. Add HTTP-Bridge Publisher into same realm;
  3. Add several clients (two or more) with different authid. Clients must to subscribe to the on.test topic;
  4. Send HTTP request with curl to HTTP-Bridge:
    curl --location --request POST 'http://<router host>:<router bridge port>/publish' \
    --header 'Content-Type: application/json; charset=UTF-8' \
    --data-raw '{
    "topic": "on.test",
    "args": [
        2,
        "160648123123220"
    ],
    "options": {
        "eligible_authid": [
            "<authid some of clients>",
        ]
    }
    }'

    Only clients, whith authid which are used in HTTP request, must received the topic, but all client will receive the topic.

oberstet commented 2 years ago

currently, only exclude and eligible are forwarded

https://github.com/crossbario/crossbar/blob/ecc8b4e0d9f8fa3efa7d59755cb2e16151055870/crossbar/bridge/rest/publisher.py#L33

not eligible_authid and similar https://github.com/crossbario/autobahn-python/blob/5890ca3cfcd1ee3dbe830add0e2a73ad82043ae9/autobahn/wamp/types.py#L768

oberstet commented 2 years ago

the fix looks like https://github.com/yankos/crossbar/commit/72bb38ccc03bd0c047db90ad266ed7a4662c22e8

yankos commented 2 years ago

the fix looks like yankos@72bb38c

Yep! I updated the branch and created a PR. #2031