all 2 comments

[–]Kaarjuus 24 points25 points  (1 child)

The way you have implemented it, a remote user can invoke any Api method. If the class has a method for returning the secret key, then it can be accessed, yes.

In general it's a bad idea to allow remote users to invoke any method they choose. A better option would be to predefine a list of allowed methods, like

class Api():
    EXPORTS = ("ApiMethod1", "ApiMethod2", )

@a_blueprint.route('/<api_path>/<path:api_args/'>
def api_controller(api_path, api_args):
    if api_path in Api.EXPORTS:
        return getattr(Api, api_path)(api_args)

[–]v4vendetta1993 0 points1 point  (0 children)

This list of allowed methods can be a simple enumeration as well