Opened 4 years ago

Closed 4 years ago

#17378 closed defect (fixed)

Stem HiddenServiceOptions does not reflect reality

Reported by: infinity0 Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by infinity0)

Suppose I have in my torrc:

HiddenServiceDir x
HiddenServicePort a
HiddenServicePort b

HiddenServiceDir y
HiddenServicePort c

This means run service x on port a,b and a different (hopefully unlinkable) service y on port c.

However stem's HiddenServiceOptions gives output like

{'HiddenServicePort': [a, b, c], 'HiddenServiceDir': [x, y]}

This loses information from the original config and there is no way for stem's client to reconstruct the original meaning of the torrc.

Child Tickets

Change History (6)

comment:1 Changed 4 years ago by infinity0

Description: modified (diff)

comment:2 Changed 4 years ago by atagar

Hi infinity0, seems you're calling get_conf(). Might I suggest get_hidden_service_conf()?

https://stem.torproject.org/api/control.html#stem.control.Controller.get_hidden_service_conf

comment:3 Changed 4 years ago by infinity0

Thanks, I have forwarded it: https://github.com/micahflee/onionshare/issues/216

Might I suggest deprecating HiddenServiceOptions in case future people misuse it like here?

comment:4 Changed 4 years ago by atagar

Might I suggest deprecating HiddenServiceOptions in case future people misuse it like here?

Would you mind clarifying what you mean? Methods like get_conf() are generic methods to get a tor configuration option. The hidden service options are uniquely convoluted, but those methods are meant for any tor option (not just hidden services).

comment:5 in reply to:  4 Changed 4 years ago by infinity0

Replying to atagar:

Might I suggest deprecating HiddenServiceOptions in case future people misuse it like here?

Would you mind clarifying what you mean?

Log a python DeprecationWarning [1] when the client accesses that option, and mark it as deprecated both in the code comments and the generated documentation to advise people to use get_hidden_service_conf() instead.

[1] Using warnings.warn https://docs.python.org/2/library/warnings.html

comment:6 Changed 4 years ago by atagar

Resolution: fixed
Status: newclosed

Log a python DeprecationWarning [1] when the client accesses that option

Interesting, didn't know about that module. Unwise though. It's inappropriate for a library to spew stuff on stderr. Nothing about using that method is wrong - there's just a better option for hidden service options. ;)

generated documentation to advise people to use get_hidden_service_conf() instead.

Added a note to get_conf_map() advising the other method...

https://gitweb.torproject.org/stem.git/commit/?id=72fe9ff

Note: See TracTickets for help on using tickets.