hackerschoice/gsocket

Setting a user supplied secret with X= does not work

snemes opened this issue · 3 comments

Using the "X" environment variable does not seem to work and this snippet below will generate a new secret every time it is run:

# Pre-set a secret:
#   $ X=MySecret bash -c "$(curl -fsSL gsocket.io/x)"
  1. The user supplied secret is saved here:

    [[ -n "$X" ]] && GS_SECRET="$X"

  2. Then it gets overwritten in the test_bin() function, here:

    GS_SECRET=$("$bin" -g 2>/dev/null)

Thanks for reporting. I can not re-produce this problem.
test_bin() is called before line 665 (GS_SECRET="$X") and the GS_SECRET variable is correctly set to the value of X after the call to test_bin(). Thus whatever happens in test_bin() is overwritten correctly with $X.
Screenshot 2021-11-15 at 06 58 01

Please send me a screenshot

I tried to reproduce this again, but I could not. Looks like it might have been a failed uninstall of a previous gs-bd instance, and the X= variable is (obviously) disregarded when when trying to install on top of an existing installation.

Thanks for looking into this anyway. Closing issue.

Thanks for checking. While investigating this I found a bug in the description on the wepbpage instead.

X=ExampleSecretChangeMe && (command -v curl >/dev/null && bash -c "$(curl -fsSL gsocket.io/x)" || bash -c "$(wget -qO- gsocket.io/x)")

did not work but this one does (X is forwarded into the sub-shell)

X=ExampleSecretChangeMe && (command -v curl >/dev/null && X=$X bash -c "$(curl -fsSL gsocket.io/x)" || X=$X bash -c "$(wget -qO- gsocket.io/x)")