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

Tornado websockets event Handlers registration are incorrect #22605

Closed
mavenAtHouzz opened this issue Apr 13, 2015 · 2 comments
Closed

Tornado websockets event Handlers registration are incorrect #22605

mavenAtHouzz opened this issue Apr 13, 2015 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior help-wanted Community help is needed to resolve this P3 Priority 3 Salt-API severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@mavenAtHouzz
Copy link

Target module: netapi/rest_tornado/__init__.py

The token pattern at line 60 is incorrect. The {0} format will just put the used hashing length after the \w regex which is actually should be meant for \w length.

Intended pattern (for md5 32bit example): [0-9A-Fa-f]{32}
Actual pattern after format: [0-9A-Fa-f]32

And following is a tested patch:

--- netapi/rest_tornado/__init__.py     2015-02-12 09:55:39.000000000 -0800
+++ netapi/rest_tornado/__init__.new.py    2015-04-09 14:06:47.482869347 -0700
@@ -56,7 +56,8 @@
     if mod_opts.get('websockets', False):
         from . import saltnado_websockets

-        token_pattern = r"([0-9A-Fa-f]{0})".format(len(getattr(hashlib, __opts__.get('hash_type', 'md5'))().hexdigest()))
+        token_pattern = r"([0-9A-Fa-f]{{{0}}})".format(len(getattr(hashlib, __opts__.get('hash_type', 'md5'))().hexdigest()))
         all_events_pattern = r"/all_events/{0}".format(token_pattern)
         formatted_events_pattern = r"/formatted_events/{0}".format(token_pattern)
         logger.debug("All events URL pattern is {0}".format(all_events_pattern))
@basepi
Copy link
Contributor

basepi commented Apr 17, 2015

Good catch! Would you mind submitting a pull request?

@basepi basepi added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P2 Priority 2 Salt-API P3 Priority 3 and removed P2 Priority 2 labels Apr 17, 2015
@basepi basepi added this to the Approved milestone Apr 17, 2015
@basepi basepi added the help-wanted Community help is needed to resolve this label Apr 17, 2015
rallytime pushed a commit to rallytime/salt that referenced this issue May 1, 2015
@rallytime
Copy link
Contributor

Fixed in #23261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior help-wanted Community help is needed to resolve this P3 Priority 3 Salt-API severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants