onaio / superset-patchup

Superset-patchup is a python package that "patches" Superset to add custom functionality that we find to be useful
https://canopyinsights.com
Apache License 2.0
8 stars 7 forks source link

Wrong OAuth anti-forgery unique session token generation #66

Open pwargulak opened 1 year ago

pwargulak commented 1 year ago

Hello,

there is this generate_state method in oauth.py:

def generate_state(self):
        """
        Generates a state which is required during the OAuth sign-in process
        """
        return jwt.encode(
            request.args.to_dict(flat=False),
            self.appbuilder.app.config["SECRET_KEY"],
            algorithm="HS256",
        )

It generates 'static' values for all sessions, meaning if you got one you will know values for all sessions for a server.

It seems the intention for this 'state' parameter is to be a CRSF protection, so it should be random.