eclipse-paho / eclipse-paho/paho.mqtt.python

insecure key from tls dict automatically removed after single() or multiple()

Open
#609 3 comments 1 reaction 0 assignees View on GitHub
Status: Available Type: Bug
Dominant language
Python
Stars
2.4k
Forks
742
Avg merge
12d 48m
Merged PRs (30d)
1

Description

Publishing to with tls `{ 'insecure' = True }` set to true when using `single()` or `multiple()` results in the dict 'insecure' key being removed after the publish automatically.

This is on multiple machines with **paho-mqtt 1.5.1**

With the following code:
```
import paho.mqtt.publish as mqttpub

mqtt_host = ""
mqtt_port = 8883
mqtt_username = ""
mqtt_password = ""
mqtt_cacert = "/home/castle/myca.crt"
mqtt_tls_insecure = True

mqtt_auth_obj = { 'username': mqtt_username, 'password': mqtt_password }
mqtt_tls_obj = { 'ca_certs': mqtt_cacert, 'insecure': mqtt_tls_insecure }

multiple = []
multiple.append(("test/topic", "testpayload", 0, False))

print ("MQTT Single Publish Test:")
print(f"Insecure TLS Key Pre publish single(): {str(mqtt_tls_obj)}")

mqttpub.single(multiple[0][0], multiple[0][1], multiple[0][2], multiple[0][3],
hostname=mqtt_host, port=mqtt_port, auth=mqtt_auth_obj, tls=mqtt_tls_obj)
print(f"Insecure TLS Key POST publish single(): {str(mqtt_tls_obj)}")

mqtt_tls_obj = { 'ca_certs': mqtt_cacert, 'insecure': mqtt_tls_insecure }
print("TLS Dict Object Reset")

print ("MQTT Multiple Publish Test:")
print(f"Insecure TLS Key Pre publish multiple(): {str(mqtt_tls_obj)}")

mqttpub.multiple(multiple, hostname=mqtt_host, port=mqtt_port, auth=mqtt_auth_obj, tls=mqtt_tls_obj)
print(f"Insecure TLS Key POST publish multiple(): {str(mqtt_tls_obj)}")

```
The resulting output is:

```
MQTT Single Publish Test:
Insecure TLS Key Pre publish single(): {'ca_certs': '/home/castle/myca.crt', 'insecure': True}
Insecure TLS Key POST publish single(): {'ca_certs': '/home/castle/myca.crt'}
TLS Dict Object Reset
MQTT Multiple Publish Test:
Insecure TLS Key Pre publish multiple(): {'ca_certs': '/home/castle/myca.crt', 'insecure': True}
Insecure TLS Key POST publish multiple(): {'ca_certs': '/home/castle/myca.crt'}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.