CVE-2024-24817 (published 2024-02-22T18:15Z)

Discourse Calendar adds the ability to create a dynamic calendar in the first post of a topic on the open-source discussion platform Discourse. Prior to version 0.4, event invitees created in topics in private categories or PMs (private messages) can be retrieved by anyone, even if they're not logged in. This problem is resolved in version 0.4 of the discourse-calendar plugin. While no known workaround is available, putting the site behind `login_required` will disallow this endpoint to be used by anonymous users, but logged in users can still get the list of invitees in the private topics.


Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/discourse/discourse-calendar
commit_details: repo_url: https://github.com/discourse/discourse-calendar
author: Natalie Tay
author_date: 2024-02-22 11:32:47+08:00
msg: SECURITY: Hide invitees from users who are not allowed to see the event post (#544)
repository: repo_url: https://github.com/discourse/discourse-calendar
repo_name: discourse/discourse-calendar
description: Adds the ability to create a dynamic calendar in the first post of a topic.
repo_language: Ruby
owner: discourse
file_changes: filename: invitees_controller.rb
change_type: ModificationType.MODIFY
diff: @@ -4,6 +4,7 @@ module DiscoursePostEvent
   class InviteesController < DiscoursePostEventController
     def index
       event = Event.find(params[:post_id])
+      guardian.ensure_can_see!(event.post)
 
       event_invitees = event.invitees
 

programming_language: Ruby
filename: plugin.rb
change_type: ModificationType.MODIFY
diff: @@ -3,7 +3,7 @@
 # name: discourse-calendar
 # about: Adds the ability to create a dynamic calendar with events in a topic.
 # meta_topic_id: 97376
-# version: 0.3
+# version: 0.4
 # author: Daniel Waterworth, Joffrey Jaffeux
 # url: https://github.com/discourse/discourse-calendar
 

programming_language: Ruby
filename: invitees_controller_spec.rb
change_type: ModificationType.MODIFY
diff: @@ -15,6 +15,32 @@ module DiscoursePostEvent
     let(:post_1) { Fabricate(:post, user: user, topic: topic_1) }
 
     describe "#index" do
+      context "for a post in a private category" do
+        let(:outside_user) { Fabricate(:user) }
+        let(:in_group_user) { Fabricate(:user) }
+        let(:group) { Fabricate(:group, users: [in_group_user]) }
+        let(:private_category) { Fabricate(:private_category, group:) }
+        let(:topic_1) { Fabricate(:topic, user: user, category: private_category) }
+        let(:post_1) { Fabricate(:post, user: user, topic: topic_1) }
+        let(:post_event_1) { Fabricate(:event, post: post_1) }
+
+        it "forbids non group user from seeing the list of invitees" do
+          sign_in(outside_user)
+
+          get "/discourse-post-event/events/#{post_event_1.id}/invitees.json"
+
+          expect(response.status).to eq(403)
+        end
+
+        it "allows group user to see the list of invitees" do
+          sign_in(in_group_user)
+
+          get "/discourse-post-event/events/#{post_event_1.id}/invitees.json"
+
+          expect(response.status).to eq(200)
+        end
+      end
+
       context "when params are included" do
         let(:invitee1) { Fabricate(:user, username: "Francis", name: "Francis") }
         let(:invitee2) { Fabricate(:user, username: "Francisco", name: "Francisco") }

programming_language: Ruby