Skip to content

JAMES-4207 Do not announce capabilities after authentication#3049

Merged
Arsnael merged 1 commit into
apache:masterfrom
giz-berlin:fix-managesieve-capabilities
May 27, 2026
Merged

JAMES-4207 Do not announce capabilities after authentication#3049
Arsnael merged 1 commit into
apache:masterfrom
giz-berlin:fix-managesieve-capabilities

Conversation

@felixauringer
Copy link
Copy Markdown
Contributor

RFC 5804 states that capabilities must be sent after a SASL security layer was negotiated. This is not the case for any of the authentication mechanisms offered by James.

This reverts parts of this commit and fixes JAMES-4207.

Copy link
Copy Markdown
Contributor

@chibenwa chibenwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific objection.

Do we need to backport this fix in 3.9.x and 3.8.x ?

@felixauringer
Copy link
Copy Markdown
Contributor Author

The additional announcement has been introduced this year and is not included in any release, I think.

Do you still remember what the initial reason was for announcing capabilities after authentication? Was there some client that expected James to do so?
Regardless, the ABNF in the RFC is quite clear that it should only happen if a SASL security layer has been negotiated.

@chibenwa
Copy link
Copy Markdown
Contributor

The additional announcement has been introduced this year and is not included in any release, I think.

It was backported to previous release branches I presume, not yet released

Do you still remember what the initial reason was for announcing capabilities after authentication? Was there some client that expected James to do so?

A security report originating from a large mailing company (this is PMC private so I cannot disclose it)

This was not a security issue but more the fact we do not re-advertize capability after STARTTLS

Regardless, the ABNF in the RFC is quite clear that it should only happen if a SASL security layer has been negotiated.

Then fair sorry I may have misunderstood the ABNF or read the RFC too quickly.

@chibenwa
Copy link
Copy Markdown
Contributor

Once a SASL security layer is established, the server MUST re-issue the capability results, followed by an OK response. 

My interpretation was SASL = AUTH hence the code. I disregarded "security layer"

But it is immediatly followed by

This is necessary to protect against man-in-the-middle attacks that alter the capabilities list prior to SASL negotiation. The capability results MUST include all SASL mechanisms the server was capable of negotiating with that client.

So understanding this as Once a *STARTTLS* security layer is established, the server MUST re-issue the capability results, followed by an OK response. is indeed a better call.

Thanks for catching it.

@felixauringer
Copy link
Copy Markdown
Contributor Author

My interpretation was SASL = AUTH hence the code. I disregarded "security layer"

That was mine too, at first. However, the real SASL security layers seem to be very rarely used nowadays. If you search for security layer in SASL RFCs, you'll find that most do not provide a security layer.

RFC 4616 (SASL PLAIN):

The PLAIN SASL mechanism does not provide a security layer.

RFC 7628 (SASL OAUTHBEARER):

SASL mechanisms using this document as their definition do not provide a data security layer; that is, they cannot provide integrity or confidentiality protection for application messages after the initial authentication.

@felixauringer
Copy link
Copy Markdown
Contributor Author

It was backported to previous release branches I presume, not yet released

Hm, then it should maybe be backported. My webmail client (Roundcube) couldn't use Managesieve with the master branch. Luckily, it's a really small change.

This was not a security issue but more the fact we do not re-advertize capability after STARTTLS

Makes sense, after STARTTLS, re-advertizing is indeed necessary.

Then fair sorry I may have misunderstood the ABNF or read the RFC too quickly.

No worries, I also overlooked it when first reading it and searched for the error in the Roundcube codebase for a while because I was convinced that your patch fulfilled the RFC.

@felixauringer felixauringer marked this pull request as ready for review May 26, 2026 14:44
@chibenwa
Copy link
Copy Markdown
Contributor

Backports shall be trivial. Are you ok taking a look at it?

@felixauringer
Copy link
Copy Markdown
Contributor Author

Backports shall be trivial. Are you ok taking a look at it?

As far as I can see, your original commit was never backported. The branches 3.8.x and 3.9.x do not send managesieve capabilities after STARTTLS.

RFC 5804 states that capabilities must be sent after a SASL security
layer was negotiated. This is not the case for any of the
authentication mechanisms offered by James.
@felixauringer felixauringer force-pushed the fix-managesieve-capabilities branch from 957fcc1 to 4b769f3 Compare May 26, 2026 15:26
@felixauringer
Copy link
Copy Markdown
Contributor Author

As far as I can see, your original commit was never backported. The branches 3.8.x and 3.9.x do not send managesieve capabilities after STARTTLS.

At least found out during the cherry-pick that you adapted some tests. I have reverted those now, too.

@Arsnael Arsnael merged commit 00cad5e into apache:master May 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants