Skip to content

Commit d59430f

Browse files
committed
Merge branch 'main' into fix-vulnerable-deps
2 parents 238802e + 70af539 commit d59430f

5 files changed

Lines changed: 37 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5050
* Updated Conformance tests to allow agents that fully qualify app Ids (as recommended in the Standard) to pass the conformance tests ([#1767](https://github.com/finos/FDC3/pull/1767))
5151
* Fixed import file extensions and module type to be esm module compliant ([#1677](https://github.com/finos/FDC3/pull/1677))
5252
* Added mising context types to types and enums in. ContextTypes.ts and implemented tests to ensure they stay in sync with the fdc3-context package ([#1796](https://github.com/finos/FDC3/pull/1796))
53+
* Allowed retrieval of User channels as App channels via getOrCreateChannel and getCurrentChannel in fdc3-web-impl. ([#1835](https://github.com/finos/FDC3/pull/1835))
5354
* Corrected description of UCBasic3 in the fdc-conformance framework implementation. ([#1823](https://github.com/finos/FDC3/pull/1823))
5455
* Fixed a race condition in fdc3-workbench's context store which caused the context listeners on user channels to miss replay of current context in some cases. ([#1823](https://github.com/finos/FDC3/pull/1823))
5556
* Fixed lint in the fdc3-workbench implementation. ([#1823](https://github.com/finos/FDC3/pull/1823))

toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,16 +540,18 @@ export class BroadcastHandler implements MessageHandler {
540540
this.state.push(channel);
541541
}
542542

543-
if (channel.type != ChannelType.app) {
544-
errorResponse(sc, arg0, from, ChannelError.AccessDenied, 'getOrCreateChannelResponse');
545-
} else {
543+
//only allow retrieval of app channels or user channels
544+
if (channel.type == ChannelType.app || channel.type == ChannelType.user) {
546545
successResponse(
547546
sc,
548547
arg0,
549548
from,
550-
{ channel: { id: channel.id, type: channel.type } },
549+
{ channel: { id: channel.id, type: this.convertChannelTypeToString(channel.type) } },
551550
'getOrCreateChannelResponse'
552551
);
552+
} else {
553+
//block retrieval of private channels
554+
errorResponse(sc, arg0, from, ChannelError.AccessDenied, 'getOrCreateChannelResponse');
553555
}
554556
}
555557

toolbox/fdc3-for-web/fdc3-web-impl/test/features/broadcast.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ Feature: Relaying Broadcast messages
3333
| contextListenerUnsubscribeResponse | App2 | a2 | {null} |
3434
| broadcastResponse | App1 | a1 | {null} |
3535

36+
Scenario: Retrieve an existing user channel via getOrCreateChannel
37+
When "App1/a1" creates or gets an app channel called "one"
38+
Then messaging will have outgoing posts
39+
| msg.matches_type | to.instanceId | msg.payload.channel.id | msg.payload.channel.type | msg.payload.error |
40+
| getOrCreateChannelResponse | a1 | one | user | {null} |
41+
42+
Scenario: Retrieve a new app channel via getOrCreateChannel
43+
When "App1/a1" creates or gets an app channel called "myAppChannel"
44+
Then messaging will have outgoing posts
45+
| msg.matches_type | to.instanceId | msg.payload.channel.id | msg.payload.channel.type | msg.payload.error |
46+
| getOrCreateChannelResponse | a1 | myAppChannel | app | {null} |
47+
3648
Scenario: Get The Latest Context From A Channel
3749
Given "App1/a1" broadcasts "fdc3.instrument" on "one"
3850
And "App1/a1" asks for the latest context on "one" with type "fdc3.instrument"

toolbox/fdc3-for-web/fdc3-web-impl/test/features/private-channel.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ Feature: Relaying Private Channel Broadcast messages
7474
| msg.type | to.appId | to.instanceId | msg.payload.error |
7575
| getOrCreateChannelResponse | App2 | a2 | AccessDenied |
7676

77+
Scenario: A newly created private channel cannot be retrieved via getOrCreateChannel
78+
When "App1/a1" creates a private channel
79+
And I refer to "uuid6" as "channel2Id"
80+
And "App2/a2" creates or gets an app channel called "{channel2Id}"
81+
Then messaging will have outgoing posts
82+
| msg.type | to.appId | to.instanceId | msg.payload.error |
83+
| getOrCreateChannelResponse | App2 | a2 | AccessDenied |
84+
7785
Scenario: Subscribe to a non-existent channel
7886
When "App2/a2" adds a context listener on "IDontExist" with type "fdc3.instrument"
7987
Then messaging will have outgoing posts

toolbox/fdc3-for-web/fdc3-web-impl/test/features/user-channels.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ Feature: Relaying Private Channel Broadcast messages
130130
| {null} | {null} | broadcastResponse | {null} | {null} |
131131
| {null} | {null} | broadcastResponse | {null} | {null} |
132132

133+
Scenario: A user channel retrieved via getOrCreateChannel is the same channel
134+
When "App/a1" joins user channel "one"
135+
And "App/a1" adds a user-channel context listener with type "fdc3.instrument"
136+
And "App2/a2" creates or gets an app channel called "one"
137+
And "App2/a2" broadcasts "fdc3.instrument" on "one"
138+
Then messaging will have outgoing posts
139+
| msg.payload.channelId | msg.payload.context.type | msg.matches_type | to.instanceId | msg.payload.originatingApp.appId | msg.payload.originatingApp.instanceId |
140+
| one | fdc3.instrument | broadcastEvent | a1 | App2 | a2 |
141+
| {null} | {null} | broadcastResponse | a2 | {null} | {null} |
142+
133143
Scenario: You can get the details of the last context type when none is set
134144
When "App/a1" joins user channel "one"
135145
And "App/a1" gets the latest context on "one" with type "fdc3.instrument"

0 commit comments

Comments
 (0)