File tree Expand file tree Collapse file tree 2 files changed +23
-10
lines changed
webrtc-transport-provider-server
webrtc-transport-requestor-server Expand file tree Collapse file tree 2 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,16 @@ CHIP_ERROR WebRTCTransportProviderServer::Read(const ConcreteReadAttributePath &
9191 // which is a list[WebRTCSessionStruct].
9292 if (aPath.mClusterId == Id && aPath.mAttributeId == Attributes::CurrentSessions::Id)
9393 {
94- // We encode mCurrentSessions as a list of WebRTCSessionStruct
95- return aEncoder.EncodeList ([this ](const auto & encoder) -> CHIP_ERROR {
94+ // CurrentSessions is a fabric-scoped attribute that must only return sessions belonging to the accessing fabric.
95+ FabricIndex accessingFabricIndex = aEncoder.AccessingFabricIndex ();
96+ return aEncoder.EncodeList ([this , accessingFabricIndex](const auto & encoder) -> CHIP_ERROR {
9697 for (auto & session : mCurrentSessions )
9798 {
98- ReturnErrorOnFailure (encoder.Encode (session));
99+ // Only encode sessions that belong to the accessing fabric
100+ if (session.GetFabricIndex () == accessingFabricIndex)
101+ {
102+ ReturnErrorOnFailure (encoder.Encode (session));
103+ }
99104 }
100105 return CHIP_NO_ERROR;
101106 });
Original file line number Diff line number Diff line change @@ -67,13 +67,21 @@ DataModel::ActionReturnStatus WebRTCTransportRequestorServer::ReadAttribute(cons
6767 switch (request.path .mAttributeId )
6868 {
6969 case CurrentSessions::Id:
70- return encoder.EncodeList ([this ](const auto & listEncoder) -> CHIP_ERROR {
71- for (auto & session : mCurrentSessions )
72- {
73- ReturnErrorOnFailure (listEncoder.Encode (session));
74- }
75- return CHIP_NO_ERROR;
76- });
70+ // CurrentSessions is a fabric-scoped attribute that must only return sessions belonging to the accessing fabric.
71+ {
72+ FabricIndex accessingFabricIndex = encoder.AccessingFabricIndex ();
73+ return encoder.EncodeList ([this , accessingFabricIndex](const auto & listEncoder) -> CHIP_ERROR {
74+ for (auto & session : mCurrentSessions )
75+ {
76+ // Only encode sessions that belong to the accessing fabric
77+ if (session.GetFabricIndex () == accessingFabricIndex)
78+ {
79+ ReturnErrorOnFailure (listEncoder.Encode (session));
80+ }
81+ }
82+ return CHIP_NO_ERROR;
83+ });
84+ }
7785 case ClusterRevision::Id:
7886 return encoder.Encode (kRevision );
7987 case FeatureMap::Id:
You can’t perform that action at this time.
0 commit comments