Code Monkey home page Code Monkey logo

Comments (4)

muatik avatar muatik commented on May 24, 2024

At this moment there is not any securing feature. However, I am going to make a basicauth implementation for securing flask-profiler's API and interface. There will be a setting parameter to enable or disable the basic authentication. I think I can complete it within two weeks, because I have a very tight schedule these days. Of course, pull requests will be welcomed :)

from flask-profiler.

WhiteHatArpit avatar WhiteHatArpit commented on May 24, 2024

I can work on it if you can tell me the complete flow that you have in mind.
Also, it is needed to put in custom decorators for routes or some other mechanism for eg if I am to use flask-limiter, I am not able to limit exempt these admin/flask-profiler routes.

from flask-profiler.

muatik avatar muatik commented on May 24, 2024

I propose the following flow:

  • there must be a setting parameter to enable or disable security feature.
app.config["flask_profiler"] = {
    "enabled": app.config["DEBUG"],
    "storage": {
        "engine": "sqlite"
    },
    "basicAuth": {
        "enabled": True,
        "user": "mustafa",
        "password": "mypassword"
    }
}
  • If the basicAuth.enabled is False, flask-profiler's routers should be accessible by everyone. No authentication will be asked.
  • if the basicAuth.enabled is True, then flask-profiler's routers must be secured and should serve only to authenticated users.

To protect routers, a decorator which implements basicauth could be used. This is a straightforward approach but sufficient for our purpose. For example; every router definition of flask-profiler's will be decorated by @requires_auth as follows:

   @fp.route("/api/measurements/".format(urlPath))
   @requires_auth
    def filtermeasurements():
        args = dict(request.args.items())
        measurements = collection.filter(args)
        return jsonify({"measurements": list(measurements)})

reference for implementation of basicAuth: http://flask.pocoo.org/snippets/8/

This decorator has to ask authentication if basicauth.enabled is True.

Any comment?

from flask-profiler.

WhiteHatArpit avatar WhiteHatArpit commented on May 24, 2024

That would do the back-end but I think there will be more to security. At front-end, it would need a login screen and then js service accordingly to save and plug in the auth values into each subsequent request.
That would do it.

from flask-profiler.

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.