fixes #146: Limit URI template match for MUC affiliation#147
Merged
guusdk merged 2 commits intoigniterealtime:mainfrom Aug 4, 2022
Merged
Conversation
The fix for issue igniterealtime#141 introduces a template to replace four distinct URL patterns: - `/restapi/v1/chatrooms/{roomName}/owners` - `/restapi/v1/chatrooms/{roomName}/admins` - `/restapi/v1/chatrooms/{roomName}/members` - `/restapi/v1/chatrooms/{roomName}/outcasts` got replaced by - `/restapi/v1/chatrooms/{roomName}/{affiliation}` Sadly, this template matches more than just those four. URLs like these also get caught, making them misbehave: - `/restapi/v1/chatrooms/{roomName}/chathistory` - `/restapi/v1/chatrooms/{roomName}/occupants` - `/restapi/v1/chatrooms/{roomName}/participants` - `/restapi/v1/chatrooms/{roomName}/invite` This commit fixes the problem by applying a regular expression to the `{affiliation}` template, requiring it to match one of four distinct options.
03de927 to
7aa8c5d
Compare
…acters. This was a result of trying to make the same entity usable for the pre-exising 'invite' endpoint (that works with just one JID), as well as for the new 'invite' endpoint (that can use a collection of JIDs). This introduced a list-of-JID field to the entity, which obviously should not be used for the singular-type endpoint. In this commit, I've introduced distinct entities to be used for each endpoint, to clear up any confusion. The old entity was reverted to its original state. The new entity inherits from the old endpoint, and adds the 'list-of-jids-to-invite' field.
7aa8c5d to
b3fd94f
Compare
Fishbowler
reviewed
Aug 4, 2022
src/java/org/jivesoftware/openfire/plugin/rest/service/MUCRoomService.java
Show resolved
Hide resolved
Fishbowler
approved these changes
Aug 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fix for issue #141 introduces a template to replace four distinct URL patterns:
/restapi/v1/chatrooms/{roomName}/owners/restapi/v1/chatrooms/{roomName}/admins/restapi/v1/chatrooms/{roomName}/members/restapi/v1/chatrooms/{roomName}/outcastsgot replaced by
/restapi/v1/chatrooms/{roomName}/{affiliation}Sadly, this template matches more than just those four. URLs like these also get caught, making them misbehave:
/restapi/v1/chatrooms/{roomName}/chathistory/restapi/v1/chatrooms/{roomName}/occupants/restapi/v1/chatrooms/{roomName}/participants/restapi/v1/chatrooms/{roomName}/inviteThis commit fixes the problem by applying a regular expression to the
{affiliation}template, requiring it to match one of four distinct options.Also introduces a fix for #148 by introducing a distinct new entity used to post data, rather than re-use an existing one that got an additional, optional parameter.