We're updating the issue view to help you get more done. 

Presence probe for local user allowed when probee not subscribed

Description

Hi,

in my opinion there is a bug (at least an inconsistency) in presence probes code for local users in OF.
I am using my custom integration scenario. I populate users' rosters via userservice plugin.

Let's have a following setting:
OpenFire server 3.9.3.
Two local users, Alice, Eve.
User Alice has empty roster.
User Eve has 1 item in roster, Alice, presence type=BOTH.
PrivacyLists are empty (not used here).

When presence session is created for Eve (she sends initial presence), she receives Alice's presence state from the OF even if she is not allowed to. Any subsequent Alice's status updates are not routed to Eve (what is correct), but initial status probe is performed and succeeds.

RFC 6121 specifies behavior for presence probes in section "4.3.2. Server Processing of Inbound Presence Probe".
In particular: "If the contact account does not exist or the user's bare JID is
in the contact's roster with a subscription state other than
"From", "From + Pending Out", or "Both" (as explained under
Appendix A), then the contact's server SHOULD return a presence
stanza of type "unsubscribed" in response to the presence probe".

So in order to be consistent in both local and remote user scenarios, OF (in my opinion) should follow this RFC specification and Eve should not be able to obtain presence information of Alice.

In my opinion, problem is here:
PresenceUpdateHandler.initSession(), line calling presenceManager.probePresence(session.getAddress(), item.getJid());
PresenceManagerImpl.probePresence(JID prober, JID probee). In local case (server.isLocal(probee)) it does not perform check of the probee's roster and hapilly provides presence information to prober. Although routine for handling presence probe packets, PresenceManagerImpl.handleProbe(Presence packet), performs aforementioned roster check.

My suggestion how to fix this is to call PresenceManagerImpl.canProbePresence(JID prober, String probee) inside PresenceManagerImpl.probePresence and check if the probe should be permitted.

Temporary workaround is to use PrivacyLists and whitelist presence updates only for users in probee's roster, block everything not in the whitelist.

Thanks for considering my suggestion.

Environment

None

Acceptance Test - Entry

None

Activity

Show:
Neustradamus
February 22, 2015, 11:23 AM

Maybe good to link with !

Ramana Subramanym
March 5, 2015, 11:57 PM

Hi, I have a PR for this issue. Please have a look at your convenience.
https://github.com/igniterealtime/Openfire/pull/190

Vadim
May 8, 2015, 2:03 PM

And what if I want to send probe requests to any local user by default?
For example I can find local user by SearchPlugin and immidiatly send him a message if he is online.
Why shoud I have to subscribe to that user before? Or it would be more appropriate to apply it on groups?
Is it possible to make it like an option?

Daryl Herzmann
November 18, 2016, 7:21 PM

PR was merged, closing

Fixed

Assignee

Dave Cridland

Reporter

Daryl Herzmann

Labels

None

Expected Effort

None

Ignite Forum URL

None

Components

Fix versions

Affects versions

Priority

Major
Configure