[ 
https://issues.apache.org/jira/browse/PROTON-2970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115330#comment-18115330
 ] 

ASF subversion and git services commented on PROTON-2970:
---------------------------------------------------------

Commit 0ec4d39707285d12608e6597671747c541ba245d in qpid-proton's branch 
refs/heads/main from Andrew Stitcher
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=0ec4d3970 ]

PROTON-2970: Validate the SASL state before handling a frame

Each SASL body handler checked that the frame was one its role could receive - 
but not that it was one it was expecting at this point in the protocol exchange.

Check the state of the exchange as well. A server takes an init only once it
has posted its mechanisms, and a response only once it has posted a
challenge. A client takes a mechanisms frame only before it has posted
anything, and a challenge or an outcome only once it has posted an init or a
response. Anything else is PN_ERR, as a frame arriving at the wrong role
already was.

The state tested is desired_state rather than last_state. A pipelining peer
can legitimately send its next frame before we have actually written our own,
so last_state can still be lagging behind the frame we have already committed
to sending.

Assisted-By: Claude Opus 5 <[email protected]>


> SASL frames are handled without checking the state of the protocol exchange
> ---------------------------------------------------------------------------
>
>                 Key: PROTON-2970
>                 URL: https://issues.apache.org/jira/browse/PROTON-2970
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>            Reporter: Andrew Stitcher
>            Assignee: Andrew Stitcher
>            Priority: Major
>             Fix For: proton-c-0.41.0
>
>
> Each SASL body handler checks that the frame is one its role can receive - a
> server does not expect a mechanisms frame, a client does not expect an init 
> etc.
> But it does not check that the frame is one it is expecting at this point in 
> the protocol exchange.
> The handlers should check the state of the exchange as well. A server should 
> take an init only once it has posted its mechanisms, and a response only once 
> it has posted a challenge. A client should take a mechanisms frame only 
> before it has posted anything, and a challenge or an outcome only once it has 
> posted an init or a response.
> Anything else should be PN_ERR, as a frame arriving at the wrong role already 
> is.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to