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

fix: ensure requestTimeout and maxRetries are integers #394

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tgarciaalv
Copy link

This is failing when environment variables are used for configuration. Env vars are strings but are never converted to int before using them in arithmetic operations.

My configuration:

              "OKTA_CLIENT_CONNECTIONTIMEOUT": "30",
               "OKTA_CLIENT_ORGURL": "https://dev-89428916.okta.com",
               "OKTA_CLIENT_AUTHORIZATIONMODE": "PrivateKey",
               "OKTA_CLIENT_CLIENTID": "${env:OKTA_CLIENT_CLIENTID}",
               "OKTA_CLIENT_SCOPES": "okta.users.read,okta.groups.read",
               "OKTA_CLIENT_PRIVATEKEY": "${env:OKTA_CLIENT_PRIVATEKEY}",
               "OKTA_CLIENT_REQUESTTIMEOUT": "0",
               "OKTA_CLIENT_RATELIMIT_MAXRETRIES": "4",
               "OKTA_CLIENT_LOGGING_ENABLED": "true",
               "OKTA_CLIENT_LOGGING_LEVEL": "INFO",

My error:

        # Raise Value Error if numerical inputs are invalid (< 0)
        self._request_timeout = config["client"].get('requestTimeout', 0)
>       if self._request_timeout < 0:
E       TypeError: '<' not supported between instances of 'str' and 'int'

/opt/homebrew/lib/python3.11/site-packages/okta/request_executor.py:35: TypeError

The os.environ dictionary in Python expects its values to be strings.

This is failing when environment variables are used for configuration. Env vars are strings but are never converted to int before using them in arithmetic operations.

        # Raise Value Error if numerical inputs are invalid (< 0)
        self._request_timeout = config["client"].get('requestTimeout', 0)
>       if self._request_timeout < 0:
E       TypeError: '<' not supported between instances of 'str' and 'int'

/opt/homebrew/lib/python3.11/site-packages/okta/request_executor.py:35: TypeError
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

Successfully merging this pull request may close these issues.

None yet

1 participant