thoughtspot / cs_tools

Scale your ThoughtSpot adoption with tools created by the ThoughtSpot Solutions Consulting organization.
https://thoughtspot.github.io/cs_tools/
Other
8 stars 6 forks source link

error on cs_tools config creation [zlib.error: Error -3 while decompressing data: incorrect header check] #124

Closed felipemm closed 4 months ago

felipemm commented 5 months ago

First Stop

Platform Configuration

│ │ │ Info snapshot taken on 2024-04-12 │ │ │ │ CS Tools: 1.5.1 │ │ Python Version: Python 3.10.8 (main, Dec 8 2022, 10:52:18) [Clang 14.0.0 (clang-1400.0.29.202)] │ │ System Info: Darwin (detail: macOS-12.7.1-x86_64-i386-64bit) │ │ Configs Directory: /Users/ {anonymous} /Library/Application Support/cs_tools │ │ Activate VirtualEnv: source "/Users/ {anonymous} /Library/Application Support/cs_tools/.cs_tools/bin/activate" │ │ Platform Tags: macosx-12.6-x86_64 │ │

Description

cs_tools config create --config test --url test.thoughtspot.cloud --username teste@test.com --password test123 --verbose

gives the following error:

Traceback (most recent call last):
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/cs_tools/cli/commands/main.py", line 101, in run
    return_code = app(standalone_mode=False)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/typer/main.py", line 326, in __call__
    raise e
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/typer/main.py", line 309, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/typer/core.py", line 723, in main
    return _main(
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/typer/core.py", line 193, in _main
    rv = self.invoke(ctx)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/cs_tools/cli/ux.py", line 38, in invoke
    r = ctx.invoke(self.callback, **ctx.params)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/typer/main.py", line 692, in wrapper
    return callback(**use_params)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/cs_tools/cli/commands/config.py", line 86, in create
    conf = CSToolsConfig.model_validate(data)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/pydantic/main.py", line 532, in model_validate
    return cls.__pydantic_validator__.validate_python(
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/pydantic_settings/main.py", line 84, in __init__
    super().__init__(
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/pydantic/main.py", line 175, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/pydantic_settings/main.py", line 84, in __init__
    super().__init__(
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/pydantic/main.py", line 175, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/cs_tools/settings.py", line 251, in encode_password
    utils.reveal(data.encode()).decode()
  File "/Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.10/site-packages/cs_tools/utils.py", line 71, in reveal
    return zlib.decompress(b64d(obscured))
zlib.error: Error -3 while decompressing data: incorrect header check
boonhapus commented 5 months ago

Hey @felipemm , I'm having a tough time tracking down what value would cause this error.

I was able to reproduce this by providing only special characters as a password. Does that sound about like what you're doing?

felipemm commented 5 months ago

Hi @boonhapus, password is only letters. Perhaps this has something to do with the username? cause I am using my email (with @)

felipemm commented 5 months ago

just tested with another user, no good. Maybe something related to python/lib version? Which version you're testing with?

boonhapus commented 5 months ago

I tried to recreate it with the same architecture you have @felipemm

│ Python Version: Python 3.10.8 (main, Dec 8 2022, 10:52:18) [Clang 14.0.0 (clang-1400.0.29.202)] │
│ System Info: Darwin (detail: macOS-12.7.1-x86_64-i386-64bit) │

A username with an @ should be no problem, this is actually how my own config is set up.

It's possible that I've accidentally fixed this in 1.5.2 (this is the only difference between our setups.. and of course I don't have your password) , which I should be releasing before Monday. 😅

felipemm commented 5 months ago

I upgrade to the 1.5.2 beta release, same error.

boonhapus commented 4 months ago

@felipemm can you shoot me an email? Let's schedule some live time to look into this if you don't mind.

nicholas.cooper@thoughtspot.com

felipemm commented 4 months ago

@boonhapus sure let's do it. FYI I thought this was something on my environment, I used another windows machine with python 3.10.4, same error

felipemm commented 4 months ago

odd. when limiting the size of password to 7 or less characters it works (it fails to connect, but do not generate exceptions)

felipemm commented 4 months ago

changed to 7 char the password and it worked. Weird

boonhapus commented 4 months ago

Thanks for investigating @felipemm !

😩 It's probably something with base64 encoding that I'm not understanding. I'm not sure why we're just now seeing this issue, but a couple customers reported it. It's been the same implementation for years now, hah.

Can you share some examples of the fake passwords values that worked or didn't work?

boonhapus commented 4 months ago

Actually, I think I'm able to pin this down. I have no idea why it's suddenly causing us issues now..... but at least I know how to fix it.

boonhapus commented 4 months ago

@felipemm can you try bootstrapping again, and then try the password?

curl -sSL https://raw.githubusercontent.com/thoughtspot/cs_tools/master/cs_tools/updater/_bootstrapper.py | python3 - --reinstall
felipemm commented 4 months ago

you nailed it! it is working now. What was the problem?

boonhapus commented 4 months ago

For some reason, we're just now reaching this error. I'm actually not sure exactly why though @felipemm , but I am catching the new zlib error and handling it appropriately.