GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MQTT 5 CONNECT with password but no username is rejected by MqttEncoder · Issue #16828 · netty/netty

MQTT 5 CONNECT with password but no username is rejected by MqttEncoder #16828

New issue
Copy link
New issue
Copy link
Closed
#16833
Closed
MQTT 5 CONNECT with password but no username is rejected by MqttEncoder#16828
#16833
Copy link
Milestone
4.2.14.Final

Description

@shblue21
shblue21
opened on May 19, 2026
Issue body actions

Expected behavior

Encoding an MQTT 5 CONNECT message with hasUserName=false and hasPassword=true should succeed.

MQTT 5 allows sending a Password with no User Name, while MQTT 3.1.1 did not:
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901044

This version of the protocol allows the sending of a Password with no User Name, where MQTT v3.1.1 did not.### Actual behavior

Actual behavior

MqttDecoder accepts this CONNECT message for MQTT 5, but encoding the same message fails.

EncoderException: Without a username, the password MUST be not set

Steps to reproduce

Encode an MQTT 5 CONNECT message with a password set and username unset.

Minimal yet complete reproducer code (or URL to code)

MqttConnectMessage message = MqttMessageBuilders.connect()
    .clientId("client")
    .protocolVersion(MqttVersion.MQTT_5)
    .username(null)
    .password("secret".getBytes(CharsetUtil.UTF_8))
    .build();

EmbeddedChannel channel = new EmbeddedChannel(MqttEncoder.INSTANCE);
channel.writeOutbound(message);

Activity

  1. normanmaurer commented on May 19, 2026

    @normanmaurer
    normanmaurer
    on May 19, 2026
    Member
    More actions

    @shblue21 do you want to provide a PR ?

  2. shblue21 commented on May 19, 2026

    @shblue21
    shblue21
    on May 19, 2026
    ContributorAuthor
    More actions

    @normanmaurer Sure, I’ll send a PR.

    Reacted by Norman Maurer
  3. shblue21
    added a commit that references this issue on May 19, 2026

    MQTT: Allow MQTT 5 CONNECT with password only

    This issue will close once commit 706d742 is merged into the '4.2' branch.
    706d742
  4. normanmaurer
    added a commit that references this issue on May 20, 2026

    MQTT: Allow MQTT 5 CONNECT with password only (#16833)

    This issue will close once commit 7125dba is merged into the '4.2' branch.
    7125dba
  5. normanmaurer
    closed this as completedin #16833on May 20, 2026
  6. normanmaurer
    added this to the 4.2.14.Final milestone on May 20, 2026
  7. normanmaurer
    added 2 commits that reference this issue on May 21, 2026

    Auto-port 5.0: MQTT: Allow MQTT 5 CONNECT with password only (#16835)

    This issue will close once commit 01c012d is merged into the '4.2' branch.
    01c012d

    Auto-port 4.1: MQTT: Allow MQTT 5 CONNECT with password only (#16834)

    This issue will close once commit 4b7b834 is merged into the '4.2' branch.
    4b7b834
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • 4.2.14.Final

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.