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

Python3: morty settings create hmac error #1871

Open
cy8aer opened this issue Feb 27, 2020 · 10 comments · May be fixed by #1872
Open

Python3: morty settings create hmac error #1871

cy8aer opened this issue Feb 27, 2020 · 10 comments · May be fixed by #1872
Labels
doc

Comments

@cy8aer
Copy link
Contributor

@cy8aer cy8aer commented Feb 27, 2020

With python3 and morty proxy settings every query crashes:

  File "/usr/share/searx/searx/webapp.py", line 339, in image_proxify
    return proxify(url)
  File "/usr/share/searx/searx/webapp.py", line 321, in proxify
    hashlib.sha256).hexdigest()
  File "/usr/lib/python3.7/hmac.py", line 153, in new
    return HMAC(key, msg, digestmod)
  File "/usr/lib/python3.7/hmac.py", line 49, in __init__
    raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)

and this looks like #968. Allready fixed it: patch follows.

@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

seems to be a cloning problem. close

@cy8aer cy8aer closed this Feb 27, 2020
@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

hm, looked at the wron point: problem exists!

@cy8aer cy8aer reopened this Feb 27, 2020
@cy8aer cy8aer linked a pull request that will close this issue Feb 27, 2020
@dalf

This comment has been minimized.

Copy link
Collaborator

@dalf dalf commented Feb 27, 2020

Just to be sure, what you have in settings.yml is something like:

result_proxy:
   url : https://something/
   key : "The$hared$ecretBetween$earxAndMorty"

Without the PR #1872, does it work with:

result_proxy:
   url : https://something/
   key : !!binary "The$hared$ecretBetween$earxAndMorty"

?

@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

the first one - and ahem, I did not know the second version sorry...
Documentation (https://asciimoo.github.io/searx/admin/morty.html) says version 1...

@dalf

This comment has been minimized.

Copy link
Collaborator

@dalf dalf commented Feb 27, 2020

It is written here loud and clear: https://github.com/asciimoo/searx/blob/master/searx/settings.yml#L30
... in the middle of other comments and out of sync with the documentation.

It makes sense to support a string.

@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

aargh. Sorry. This is the problem with growing configurations for years. Probably my first installation is too old.

Ok with this comment line this makes sense but this cries for changes in the documentation...

@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

... and - of course - now it is up to you ;-)

@cy8aer

This comment has been minimized.

Copy link
Contributor Author

@cy8aer cy8aer commented Feb 27, 2020

Hm I am indifferent: !!binary makes sense when running the stuff in docker and fill it with environment variables.

@return42 return42 added the doc label Feb 28, 2020
@return42

This comment has been minimized.

Copy link
Collaborator

@return42 return42 commented Feb 28, 2020

I never used the key (leaved it commented out) .. can't imagine what kind of service abuse could happen .. does anyone know abuse scenarios?

@dalf

This comment has been minimized.

Copy link
Collaborator

@dalf dalf commented Feb 28, 2020

@return42 : it creates an open proxy, so a lot of thing can be done. Send query to search engine.

About !!binary: it is mandatory only in this place, so a string would be consistent with the other settings. In other words the documentation is up to date, the code is not :-)

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

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.