Skip to content

webhook engine byte string handling issue #52359

Closed

Description

@rf-vivanovs

Description of Issue/Question

If you try to JSON serialize anything that comes from webhook engine it will error out because of bytes string parsing error.

Looks to be Python3/2 inconsistency

Setup

Engine configured by default:

# file: /etc/salt/master.d/engines.conf
engines:
  - webhook:
      port: 8000
      ssl_crt: /etc/pki/tls/certs/localhost.crt
      ssl_key: /etc/pki/tls/certs/localhost.key

# file: /etc/salt/master.d/reactor.conf
reactor:
  - 'salt/engines/hook/test-hook':
    - salt://reactor/reactor.sls

Steps to Reproduce Issue

Start salt-master and the engine and execute:

curl -sS localhost:8000/hook \
    -H 'Content-type: application/json' \
    -d '{"foo": "Foo!", "bar": "Bar!"}'

Reactor that will handle the event, if there is JSON parsing will error out:

b'{"event": "updated", "timestamp": ... "last_updated": "2019-03-29T16:00:35.221076Z"}}' is not JSON serializable

Versions Report

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: 1.12.2
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.11
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.4.9 (default, Feb 5 2019, 14:36:09)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.4.2
ZMQ: 4.1.4

System Versions:
dist: centos 7.6.1810 Core
locale: ANSI_X3.4-1968
machine: x86_64
release: 3.10.0-957.1.3.el7.x86_64
system: Linux
version: CentOS Linux 7.6.1810 Core

Activity

  1. added this to the Approved milestone on Mar 29, 2019
  2. added
    bug
    severity-medium
    P3
    P4
    fixed-pls-verify
    and removed
    P3
    on Mar 29, 2019
  3. stale commented on Jan 8, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4bugfixed-pls-verifyseverity-mediumstale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions