Repository navigation
Conversation
|
From the specification document:
We claim support for STOMP 1.0, 1.1 and 1.2, so we should address this. I'll try to take a look this week. |
|
Hi! |
|
Looks like there are some conflicts, probably due to #154. Can you resolve them? |
|
Oh, definitely, I'l review conflicts today after working hours |
# Conflicts: # frame/writer_test.go
|
Resolved conflicts in the tests |
Zerpet
left a comment
There was a problem hiding this comment.
Looking good. I just have a question on escaping the value of a header. See below.
|
|
||
| for i := 0; i < header.Len(); i++ { | ||
| key, value := header.GetAt(i) | ||
| if key == "" || strings.ContainsAny(key, ":\r\n\x00") || strings.ContainsAny(value, "\r\n\x00") { |
There was a problem hiding this comment.
I'm wondering why the character : was not included in the check for the value? 🤔
I re-read the spec and I understand that both header keys and values must be escaped. Therefore, unescaped headers must not contain the colon character IIUC.
|
Thanks for the contribution. Your commit was included in #158. |
Hi
I recently tried to use you lib, and after our automatic passwords rotation mentioned an issue while connecting to the Artemis
I found out that you lib doesn't always follows the STOMP spec (described below)
Summary
Fix STOMP 1.2 header serialization for
CONNECTandCONNECTEDframes.The frame writer currently applies STOMP header escaping to every frame.
For example, a password containing colons:
xxx-test:password:xxxis currently sent as:
xxx-test\cpassword\cxxxBrokers following the STOMP specification (e.g. ArtemisMQ) interpret that as a different
password, causing authentication to fail.
Specification
The STOMP 1.2 specification explicitly excludes CONNECT and CONNECTED
frames from header escaping:
Source: STOMP 1.2 — Value Encoding (https://stomp.github.io/stomp-specification-1.2.html#Value_Encoding)
Accordingly, credentials and other headers in these frames must be written
literally. Header escaping remains applicable to STOMP, SEND, and all
other frame commands.
Changes
Write CONNECT and CONNECTED header names and values without STOMP
escaping.
Preserve the existing escaping behavior for every other frame command.
Validate unescaped headers before writing:
Return ErrInvalidFrameFormat before writing any partial frame when an
invalid unescaped header is encountered.
Leave frame parsing behavior unchanged.
Tests
Added coverage verifying that:
CONNECT credentials containing colons and backslashes are sent
literally.
CONNECTED headers are sent literally.
STOMP and SEND headers continue to be escaped.
Invalid unescaped header names and values are rejected.
Validation failures do not write a partial frame.
Validation performed:
go test ./...
go test -race ./...
go vet ./...
The change was also verified against Apache ActiveMQ Artemis 2.44 using a
password containing =, /, :, -, and +.