Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept non-privileged IQs from XEP-0356 privileged components. #4341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtstickney
Copy link

An MR to address #4336 (note: that hasn't been discussed yet, but it was a simple change so I figured I'd put up a PR for it anyway.)

mod_privilege current drops any non-privileged IQ received from a component with an error about it not being properly wrapped. While this might represent a mistake on the part of the component, it means that well- behaved components can no longer send non-privileged IQs (something they normally can do if mod_privilege isn't enabled).

Since mod_privilege is intended to grant additional permissions, and not remove existing ones, route non-privileged IQs received from the component normally, the same way we do with roster-query packets. The roster-query and privilege-iq checks are both last in get_iq_encapsulated_details(), so those checks don't bypass any other checks by short-circuiting; all we have to do is not drop the packet.

@coveralls
Copy link

coveralls commented Jan 20, 2025

Coverage Status

coverage: 33.393% (+0.006%) from 33.387%
when pulling cc6b26c on mtstickney:route_unprivileged_iqs_from_privileged_component
into eca3204 on processone:master.

@badlop badlop added this to the ejabberd 25.xx milestone Jan 21, 2025
@mtstickney mtstickney force-pushed the route_unprivileged_iqs_from_privileged_component branch from 5e32979 to cb5bdc1 Compare January 28, 2025 03:57
mod_privilege current drops any non-privileged IQ received from a component
with an error about it not being properly wrapped. While this might
represent a mistake on the part of the component, it means that well-
behaved components can no longer send non-privileged IQs (something they
normally can do if mod_privilege isn't enabled).

Since mod_privilege is intended to grant additional permissions, and not
remove existing ones, route non-privileged IQs received from the component
normally.

This also removes the special-case for roster-query IQ stanzas, since
those are also non-privileged and will be routed along with any other
non-privileged IQ packet. This mirrors the privileged-IQ/everything-else
structure of the XEP, which defined the handling of privileged IQ
stanzas and leaves all other IQ stanzas as defined in their own specs.

To make this clearer, the predicate function now returns distinct
results indicating privileged IQs, non-privileged IQs, and error
conditions, rather than treating non-privilege IQs as an error that gets
handled by routing the packet normally.
@mtstickney mtstickney force-pushed the route_unprivileged_iqs_from_privileged_component branch from cb5bdc1 to cc6b26c Compare January 28, 2025 19:56
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