Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flowapi attempts to decompress uncompressed scopes #6399

Open
Thingus opened this issue Nov 9, 2023 · 1 comment
Open

Flowapi attempts to decompress uncompressed scopes #6399

Thingus opened this issue Nov 9, 2023 · 1 comment

Comments

@Thingus
Copy link
Contributor

Thingus commented Nov 9, 2023

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
Copy link
Member

greenape commented Mar 7, 2024

I think it should be a 400 error really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants