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

OF-2631: Enforce pubsub node access model #2223

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,8 @@ public void run() {
item.getSubStatus() == RosterItem.SUB_TO)) {
PEPService pepService = pepServiceManager.getPEPService(item.getJid().asBareJID());
if (pepService != null) {
pepService.getRootCollectionNode().getSubscriptions(availableSessionJID);
pepService.getRootCollectionNode().getAccessModel().canAccessItems(pepService.getRootCollectionNode(), availableSessionJID, availableSessionJID);
pepService.sendLastPublishedItems(availableSessionJID);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* A subscription to a node. Entities may subscribe to a node to be notified when new events
* are published to the node. Published events may contain a {@link PublishedItem}. Only
* nodes that are configured to not deliver payloads with event notifications and to not
* persist items will let publishers to publish events without items thus not including
* persist items will let publishers publish events without items thus not including
* items in the notifications sent to subscribers.<p>
*
* Node subscriptions may need to be configured by the subscriber or approved by a node owner
Expand Down Expand Up @@ -648,6 +648,9 @@ public boolean canSendPublicationEvent(LeafNode leafNode, PublishedItem publishe
return false;
}
}
if (!leafNode.getAccessModel().canAccessItems(leafNode, this.owner, this.getJID())) {
return false;
}

Log.trace("Can send publication node event.");
return true;
Expand Down Expand Up @@ -688,6 +691,10 @@ boolean canSendChildNodeEvent(Node originatingNode) {
return false;
}

if (!originatingNode.getAccessModel().canAccessItems(originatingNode, this.owner, this.getJID())) {
return false;
}

Log.trace("Can send child node event.");
return true;
}
Expand Down
Loading