amazon-chime-sdk-rails 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 168cdb6149788c0f8499ae2499df0f0d2a5590dacccaf0eed854704e91f7d3e6
4
- data.tar.gz: a7d0c20d4a39929afe2b60b0c0b01f74181ab0807c5c27d76f2cc98a5a1760fe
3
+ metadata.gz: 3d5ebcc29d74104d1eec93c7ac094be54b52083edc4bf835a0ad7196a8dc0dfd
4
+ data.tar.gz: b28f4fdcef7a52500fdfa32f7dfafb83455ae2827f3691627bc1423bfa0ec33e
5
5
  SHA512:
6
- metadata.gz: e1be855d627474e0382b628578a70457beeff4b2f0f3400d107f35d99dc7e8a31020163137fc6e186eb4ff67754b17b957a16d809e0f6c751ecb563e198167d0
7
- data.tar.gz: 2ce6405a5317f87052777b3830c844e6e5dd5702c2fa14ce1ff425ab04de70f6c69778d624d0268dec08d356ab801f148c7c64471ae4c04d39028780769f0141
6
+ metadata.gz: 859941de7300fca365390ec91df87b96a5ef4e8b573b282516d596715e39f4e22966f0146f090632dce3b36e446ab0ba93b974f0d3b9be9c512aef42402b7cd2
7
+ data.tar.gz: 745c35af2bd1bd43f082caed8867724246f6b2b8c119c99a57866ed73243252efded8249c4ccdfe2f53ad1425571e5b32ff05381a1292facfd92b43f73b05665
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 2.2.1 / 2026-10-28
2
+ [Full Changelog](http://github.com/simukappu/amazon-chime-sdk-rails/compare/v2.2.0...v2.2.1)
3
+
4
+ Security Fixes:
5
+
6
+ * Return only `id` and `name` of users and rooms in the application metadata examples of the generated controller templates and the docs, instead of serializing whole records such as email addresses to all meeting participants
7
+ * Resolve user and room IDs in the application metadata examples by removing `config.prefix` from `ExternalUserId` and `ExternalMeetingId`, instead of `split('-')[3]`. Attendees and meetings created with other prefixes, such as other applications or environments, are no longer resolved to local records
8
+
1
9
  ## 2.2.0 / 2026-10-28
2
10
  [Full Changelog](http://github.com/simukappu/amazon-chime-sdk-rails/compare/v2.1.0...v2.2.0)
3
11
 
@@ -194,16 +194,16 @@ class Api::MeetingsController < ApplicationController
194
194
  def application_meeting_metadata(meeting)
195
195
  {
196
196
  "MeetingType": "PrivateRoom",
197
- "PrivateRoom": @room
197
+ "PrivateRoom": @room.slice(:id, :name)
198
198
  }
199
199
  end
200
200
 
201
201
  # Uncomment
202
202
  def application_attendee_metadata(attendee)
203
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
203
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
204
204
  {
205
205
  "AttendeeType": "User",
206
- "User": User.find_by_id(user_id)
206
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
207
207
  }
208
208
  end
209
209
  end
@@ -246,10 +246,10 @@ class Api::MeetingAttendeesController < ApplicationController
246
246
 
247
247
  # Uncomment
248
248
  def application_attendee_metadata(attendee)
249
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
249
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
250
250
  {
251
251
  "AttendeeType": "User",
252
- "User": User.find_by_id(user_id)
252
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
253
253
  }
254
254
  end
255
255
  end
@@ -360,37 +360,9 @@ $ curl localhost:3000/api/v1/rooms/1/meetings -X POST -H "content-type:applicati
360
360
  "MediaRegion": "us-east-1",
361
361
  "ApplicationMetadata": {
362
362
  "MeetingType": "PrivateRoom",
363
- "Room": {
363
+ "PrivateRoom": {
364
364
  "id": 1,
365
- "name": "PrivateRoom-1",
366
- "created_at": "2020-10-16T11:15:56.223Z",
367
- "updated_at": "2020-10-16T11:15:56.223Z",
368
- "members": [
369
- {
370
- "id": 1,
371
- "provider": "email",
372
- "uid": "ichiro@example.com",
373
- "allow_password_change": false,
374
- "name": "ichiro",
375
- "nickname": null,
376
- "image": null,
377
- "email": "ichiro@example.com",
378
- "created_at": "2020-10-16T11:14:48.731Z",
379
- "updated_at": "2020-10-16T11:16:56.927Z"
380
- },
381
- {
382
- "id": 2,
383
- "provider": "email",
384
- "uid": "stephen@example.com",
385
- "allow_password_change": false,
386
- "name": "stephen",
387
- "nickname": null,
388
- "image": null,
389
- "email": "stephen@example.com",
390
- "created_at": "2020-10-16T11:15:33.226Z",
391
- "updated_at": "2020-10-16T11:15:33.314Z"
392
- }
393
- ]
365
+ "name": "PrivateRoom-1"
394
366
  }
395
367
  }
396
368
  },
@@ -402,15 +374,7 @@ $ curl localhost:3000/api/v1/rooms/1/meetings -X POST -H "content-type:applicati
402
374
  "AttendeeType": "User",
403
375
  "User": {
404
376
  "id": 1,
405
- "provider": "email",
406
- "uid": "ichiro@example.com",
407
- "allow_password_change": false,
408
- "name": "ichiro",
409
- "nickname": null,
410
- "image": null,
411
- "email": "ichiro@example.com",
412
- "created_at": "2020-10-16T11:14:48.731Z",
413
- "updated_at": "2020-10-16T11:16:56.927Z"
377
+ "name": "ichiro"
414
378
  }
415
379
  }
416
380
  }
@@ -428,20 +392,11 @@ $ curl localhost:3000/api/v1/rooms/1/meetings/${MEETING_ID}/attendees -H "conten
428
392
  "Attendee": {
429
393
  "ExternalUserId": "ChimeSdkRailsApp-development-User-1",
430
394
  "AttendeeId": "b581c46d-661f-92bb-d80e-XXXXXXXXXXXX",
431
- "JoinToken": "YjU4MWM0NmQtNjYxZi05MmJiLWQ4MGUtZjRiMTU3ZDk1ZmU5OjgyZmM2NTMxLTIwMjctNGMxMS04OTE0LTQwZjXXXXXXXXXXXX",
432
395
  "ApplicationMetadata": {
433
396
  "AttendeeType": "User",
434
397
  "User": {
435
398
  "id": 1,
436
- "provider": "email",
437
- "uid": "ichiro@example.com",
438
- "allow_password_change": false,
439
- "name": "ichiro",
440
- "nickname": null,
441
- "image": null,
442
- "email": "ichiro@example.com",
443
- "created_at": "2020-10-16T11:14:48.731Z",
444
- "updated_at": "2020-10-16T11:16:56.927Z"
399
+ "name": "ichiro"
445
400
  }
446
401
  }
447
402
  }
@@ -457,20 +412,11 @@ $ curl localhost:3000/api/v1/rooms/1/meetings/${MEETING_ID}/attendees/${ATTENDEE
457
412
  "Attendee": {
458
413
  "ExternalUserId": "ChimeSdkRailsApp-development-User-1",
459
414
  "AttendeeId": "b581c46d-661f-92bb-d80e-XXXXXXXXXXXX",
460
- "JoinToken": "YjU4MWM0NmQtNjYxZi05MmJiLWQ4MGUtZjRiMTU3ZDk1ZmU5OjgyZmM2NTMxLTIwMjctNGMxMS04OTE0LTQwZjXXXXXXXXXXXX",
461
415
  "ApplicationMetadata": {
462
416
  "AttendeeType": "User",
463
417
  "User": {
464
418
  "id": 1,
465
- "provider": "email",
466
- "uid": "ichiro@example.com",
467
- "allow_password_change": false,
468
- "name": "ichiro",
469
- "nickname": null,
470
- "image": null,
471
- "email": "ichiro@example.com",
472
- "created_at": "2020-10-16T11:14:48.731Z",
473
- "updated_at": "2020-10-16T11:16:56.927Z"
419
+ "name": "ichiro"
474
420
  }
475
421
  }
476
422
  }
@@ -506,37 +452,9 @@ $ curl localhost:3000/api/v1/rooms/1/meetings -X POST -H "content-type:applicati
506
452
  "MediaRegion": "us-east-1",
507
453
  "ApplicationMetadata": {
508
454
  "MeetingType": "PrivateRoom",
509
- "Room": {
455
+ "PrivateRoom": {
510
456
  "id": 1,
511
- "name": "PrivateRoom-1",
512
- "created_at": "2020-10-16T11:15:56.223Z",
513
- "updated_at": "2020-10-16T11:15:56.223Z",
514
- "members": [
515
- {
516
- "id": 1,
517
- "provider": "email",
518
- "uid": "ichiro@example.com",
519
- "allow_password_change": false,
520
- "name": "ichiro",
521
- "nickname": null,
522
- "image": null,
523
- "email": "ichiro@example.com",
524
- "created_at": "2020-10-16T11:14:48.731Z",
525
- "updated_at": "2020-10-16T11:16:56.927Z"
526
- },
527
- {
528
- "id": 2,
529
- "provider": "email",
530
- "uid": "stephen@example.com",
531
- "allow_password_change": false,
532
- "name": "stephen",
533
- "nickname": null,
534
- "image": null,
535
- "email": "stephen@example.com",
536
- "created_at": "2020-10-16T11:15:33.226Z",
537
- "updated_at": "2020-10-16T11:21:46.011Z"
538
- }
539
- ]
457
+ "name": "PrivateRoom-1"
540
458
  }
541
459
  }
542
460
  },
@@ -548,15 +466,7 @@ $ curl localhost:3000/api/v1/rooms/1/meetings -X POST -H "content-type:applicati
548
466
  "AttendeeType": "User",
549
467
  "User": {
550
468
  "id": 2,
551
- "provider": "email",
552
- "uid": "stephen@example.com",
553
- "allow_password_change": false,
554
- "name": "stephen",
555
- "nickname": null,
556
- "image": null,
557
- "email": "stephen@example.com",
558
- "created_at": "2020-10-16T11:15:33.226Z",
559
- "updated_at": "2020-10-16T11:21:46.011Z"
469
+ "name": "stephen"
560
470
  }
561
471
  }
562
472
  }
@@ -260,16 +260,16 @@ class MeetingsController < ApplicationController
260
260
  def application_meeting_metadata(meeting)
261
261
  {
262
262
  "MeetingType": "PrivateRoom",
263
- "PrivateRoom": @room
263
+ "PrivateRoom": @room.slice(:id, :name)
264
264
  }
265
265
  end
266
266
 
267
267
  # Uncomment
268
268
  def application_attendee_metadata(attendee)
269
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
269
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
270
270
  {
271
271
  "AttendeeType": "User",
272
- "User": User.find_by_id(user_id)
272
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
273
273
  }
274
274
  end
275
275
  end
@@ -311,10 +311,10 @@ class MeetingAttendeesController < ApplicationController
311
311
 
312
312
  # Uncomment
313
313
  def application_attendee_metadata(attendee)
314
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
314
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
315
315
  {
316
316
  "AttendeeType": "User",
317
- "User": User.find_by_id(user_id)
317
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
318
318
  }
319
319
  end
320
320
  end
@@ -1,4 +1,4 @@
1
1
  module ChimeSdk
2
2
  # Gem version of amazon-chime-sdk-rails
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.1"
4
4
  end
@@ -109,10 +109,10 @@ class <%= @namespace %><%= @class_name_prefix %>MeetingAttendeesController < App
109
109
  # @param [Hash] meeting Attendee JSON object as hash
110
110
  # @return [Hash] Appication metadata for attendees
111
111
  # def application_attendee_metadata(attendee)
112
- # user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
112
+ # user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
113
113
  # {
114
114
  # "AttendeeType": "User",
115
- # "User": User.find_by_id(user_id)
115
+ # "User": User.find_by_id(user_id)&.slice(:id, :name)
116
116
  # }
117
117
  # end
118
118
  end
@@ -118,7 +118,7 @@ class <%= @namespace %><%= @class_name_prefix %>MeetingsController < Application
118
118
  # def application_meeting_metadata(meeting)
119
119
  # {
120
120
  # "MeetingType": "PrivateRoom",
121
- # "PrivateRoom": @room
121
+ # "PrivateRoom": @room.slice(:id, :name)
122
122
  # }
123
123
  # end
124
124
 
@@ -128,10 +128,10 @@ class <%= @namespace %><%= @class_name_prefix %>MeetingsController < Application
128
128
  # @param [Hash] meeting Attendee JSON object as hash
129
129
  # @return [Hash] Appication metadata for attendees
130
130
  # def application_attendee_metadata(attendee)
131
- # user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
131
+ # user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
132
132
  # {
133
133
  # "AttendeeType": "User",
134
- # "User": User.find_by_id(user_id)
134
+ # "User": User.find_by_id(user_id)&.slice(:id, :name)
135
135
  # }
136
136
  # end
137
137
 
@@ -2,10 +2,10 @@ class Api::Public::MeetingAttendeesController < ApplicationController
2
2
  include ChimeSdk::Controller::Attendees::Mixin
3
3
 
4
4
  def application_attendee_metadata(attendee)
5
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
5
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
6
6
  {
7
7
  "AttendeeType": "User",
8
- "User": User.find_by_id(user_id)
8
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
9
9
  }
10
10
  end
11
11
 
@@ -6,10 +6,10 @@ class Api::Public::MeetingsController < ApplicationController
6
6
  end
7
7
 
8
8
  def application_meeting_metadata(meeting)
9
- room_id = meeting[:Meeting][:ExternalMeetingId].split('-')[3]
9
+ room_id = meeting[:Meeting][:ExternalMeetingId].delete_prefix(ChimeSdk.config.prefix)[/\APrivateRoom-(\d+)\z/, 1]
10
10
  {
11
11
  "MeetingType": "PrivateRoom",
12
- "PrivateRoom": Room.find_by_id(room_id)
12
+ "PrivateRoom": Room.find_by_id(room_id)&.slice(:id, :name)
13
13
  }
14
14
  end
15
15
 
@@ -122,10 +122,10 @@ class MeetingAttendeesController < ApplicationController
122
122
  # @param [Hash] meeting Attendee JSON object as hash
123
123
  # @return [Hash] Appication metadata for attendees
124
124
  def application_attendee_metadata(attendee)
125
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
125
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
126
126
  {
127
127
  "AttendeeType": "User",
128
- "User": User.find_by_id(user_id)
128
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
129
129
  }
130
130
  end
131
131
  end
@@ -134,7 +134,7 @@ class MeetingsController < ApplicationController
134
134
  def application_meeting_metadata(meeting)
135
135
  {
136
136
  "MeetingType": "PrivateRoom",
137
- "PrivateRoom": @room
137
+ "PrivateRoom": @room.slice(:id, :name)
138
138
  }
139
139
  end
140
140
 
@@ -144,10 +144,10 @@ class MeetingsController < ApplicationController
144
144
  # @param [Hash] meeting Attendee JSON object as hash
145
145
  # @return [Hash] Appication metadata for attendees
146
146
  def application_attendee_metadata(attendee)
147
- user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
147
+ user_id = attendee[:Attendee][:ExternalUserId].delete_prefix(ChimeSdk.config.prefix)[/\AUser-(\d+)\z/, 1]
148
148
  {
149
149
  "AttendeeType": "User",
150
- "User": User.find_by_id(user_id)
150
+ "User": User.find_by_id(user_id)&.slice(:id, :name)
151
151
  }
152
152
  end
153
153
 
@@ -5,6 +5,7 @@ describe ChimeSdk::Controller::Attendees, type: :request do
5
5
  @dummy_meeting_id = "91234567-89ab-cdef-ghij-klmnopqrstuv"
6
6
  @dummy_attendee_id = "96543210-ba98-fedc-jihg-vutsrqponmlk"
7
7
  @other_meeting_id = "81234567-89ab-cdef-ghij-klmnopqrstuv"
8
+ @other_app_attendee_id = "86543210-ba98-fedc-jihg-vutsrqponmlk"
8
9
 
9
10
  @room = create(:room)
10
11
  @other_room = create(:room)
@@ -40,6 +41,11 @@ describe ChimeSdk::Controller::Attendees, type: :request do
40
41
  }
41
42
  }
42
43
 
44
+ other_app_attendee = test_attendee.merge(
45
+ external_user_id: "OtherApp-test-User-#{@attendee_user.id}",
46
+ attendee_id: @other_app_attendee_id
47
+ )
48
+
43
49
  # Use stubs for the AWS SDK for Ruby
44
50
  client = Aws::ChimeSDKMeetings::Client.new(stub_responses: true)
45
51
  client.stub_responses(:get_meeting, -> (context) {
@@ -54,7 +60,11 @@ describe ChimeSdk::Controller::Attendees, type: :request do
54
60
  })
55
61
  client.stub_responses(:get_attendee, -> (context) {
56
62
  context.params[:meeting_id] == @meeting_id ?
57
- (context.params[:attendee_id] == @attendee_id ? { attendee: test_attendee } : 'NotFoundException') :
63
+ (case context.params[:attendee_id]
64
+ when @attendee_id then { attendee: test_attendee }
65
+ when @other_app_attendee_id then { attendee: other_app_attendee }
66
+ else 'NotFoundException'
67
+ end) :
58
68
  'ForbiddenException'
59
69
  })
60
70
  client.stub_responses(:create_attendee, -> (context) {
@@ -156,6 +166,21 @@ describe ChimeSdk::Controller::Attendees, type: :request do
156
166
  it "returns application metadata in the attendee" do
157
167
  expect(JSON.parse(response.body)["Attendee"]["ApplicationMetadata"]["User"]["id"]).to eq(@attendee_user.id)
158
168
  end
169
+
170
+ it "returns only id and name of the user in application metadata" do
171
+ expect(JSON.parse(response.body)["Attendee"]["ApplicationMetadata"]["User"].keys).to match_array(["id", "name"])
172
+ end
173
+ end
174
+
175
+ context "when the attendee is created by another application" do
176
+ before do
177
+ get "#{api_meetings_path}/attendees/#{@other_app_attendee_id}", headers: @auth_headers
178
+ end
179
+
180
+ it "does not resolve the user from external user id" do
181
+ expect(response).to have_http_status(200)
182
+ expect(JSON.parse(response.body)["Attendee"]["ApplicationMetadata"]["User"]).to be_nil
183
+ end
159
184
  end
160
185
 
161
186
  context "when the attendee is not found" do
@@ -194,6 +194,10 @@ describe ChimeSdk::Controller::Meetings, type: :request do
194
194
  expect(JSON.parse(response.body)["Meeting"]["ApplicationMetadata"]["PrivateRoom"]["id"]).to eq(@room.id)
195
195
  end
196
196
 
197
+ it "returns only id and name of the room in application metadata" do
198
+ expect(JSON.parse(response.body)["Meeting"]["ApplicationMetadata"]["PrivateRoom"].keys).to match_array(["id", "name"])
199
+ end
200
+
197
201
  it "returns created attendee since ChimeSdk.config.create_attendee_from_meeting is enabled" do
198
202
  expect(JSON.parse(response.body)["Attendee"]["AttendeeId"]).to eq(@attendee_id)
199
203
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-chime-sdk-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Yamazaki