apache / apache/shenyu

[BUG] SUBACK always grants QoS 0, ignoring the requested QoS

Open
#6,848 2 comments 0 reactions 1 assignee Claimed by @wy471x View on GitHub
plugin: mqtt priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
The SUBACK grant list is built by hard-coding `MqttQoS.AT_MOST_ONCE.value()` for every topic, never reading `topicSub.qualityOfService()`.

## Location
- `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Subscribe.java:90-94` (line 93 hard-codes `AT_MOST_ONCE.value()`)

## Impact
A client subscribing at QoS 1 or 2 is told it was granted QoS 0 and (see H-27) will only ever receive QoS 0 delivery. Violates MQTT-3.8.4/3.9.

## Suggested fix
`qos.add(topicSub.qualityOfService().value())` (after the FAILURE filter).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.