Flowminder / FlowKit

FlowKit: Flowminder CDR analytics toolkit
https://flowminder.github.io/FlowKit/
Mozilla Public License 2.0
86 stars 21 forks source link

Flowapi attempts to decompress uncompressed scopes #6399

Open Thingus opened 10 months ago

Thingus commented 10 months ago

Describe the bug When passed a token generated with jwt.generate_token(...compress = False...), flowapi attempts to decompress roles as a bytestream, causing a 500 error.

Product Flowapi

Version Latest

To Reproduce With the flowapi, flowmachine and flowdb services running:

from flowkit_jwt_generator import jwt
from base64 import b64decode
import datetime

priv_key = b64decode(os.getenv("PRIVATE_JWT_SIGNING_KEY")).decode()
token = jwt.generate_token(
        username="TEST_USER",
        private_key=priv_key,
        lifetime=datetime.timedelta(days=1),
        roles={"viewer": ["get_available_dates"]},
        compress=False,
        flowapi_identifier=os.get_env("FLOWAPI_IDENTIFIER"),
    )

import flowclient as fc
import os
fc_conn = fc.connect(
    url=os.get_env("FLOWAPI_URL"),
    token=token
)
print(fc.get_available_dates(connection=fc_conn))

Expected behavior fc.get_available_dates should return {} or a response containing dates.

greenape commented 6 months ago

I think it should be a 400 error really.