Coder Social home page Coder Social logo

Comments (11)

prologic avatar prologic commented on June 6, 2024

@spaceone I dare say though that is is almost by design :) 😆

However; I believe we should address this! Any ideas?

from circuits.

spaceone avatar spaceone commented on June 6, 2024

Maybe whitelist for allowed events?

from circuits.

spaceone avatar spaceone commented on June 6, 2024

Is there any real life example where it is used?

from circuits.

prologic avatar prologic commented on June 6, 2024

Yeah I've used the JSONRPC Dispatcher in https://github.com/prologic/autodock

In terms of fixing this though; perhaps we need to think about a redesign for JSONRPC/XMLRPC in general where it doesn't blindly translate RPC methods into events.

from circuits.

prologic avatar prologic commented on June 6, 2024

Retracted last comment; I'm not sure how to solve this. @spaceone: thoughts?

from circuits.

prologic avatar prologic commented on June 6, 2024

@spaceone: Actually now that I think about the particular use-cases; I think we should just remove the ability to target "channels" via RPC and instead let the user/developer do this if they so desire in their own "dispatchers" that listen to "rpc" events. This would be the simplest way and most secure as incoming "rpc" payloads would only ever hit the component/channel you specify in JSONRPC("/path", "encoding", "rpcchannel").

from circuits.

spaceone avatar spaceone commented on June 6, 2024

This looks way better. There is still no validation of the event name. Now everybody can fire arbitrary events into self.rpc_channel.

from circuits.

spaceone avatar spaceone commented on June 6, 2024

We could prefix the event name with 'rpc.' or/and call a method which can be overridden which dies a mapping from method → event name.

from circuits.

prologic avatar prologic commented on June 6, 2024

I don't think we should do this; primarily because it completely breaks the API and the notion that you can loosely couple and cooperate with components that listen to events on the rpc_channel. This would also completely break for example kdb and it's various plugins that listen to "rpc" events.

I believe the kind of "whitelist/blacklist" you're talking about can in fact be implemented by a user application (which I could demo in this issue?); otherwise let's close this and move on :)

from circuits.

spaceone avatar spaceone commented on June 6, 2024

With the fix you can still call the init() method of Component-inherited classes.

from circuits.

prologic avatar prologic commented on June 6, 2024

That would be because of:

from circuits import Component


class App(Component):

    def init(self):
        pass

I suspect if you @handler(None) it won't get exposed?

from circuits.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.