Language: JavaScript
Label: vulnerable
CWE: CWE-20 \u2014 Improper Input Validation
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.

Code:
            isSuccess: defer(),
        };

        let sentReply = false;
        if (shouldOpRespond) {
            // Listen for message from bot
            env.ircMock._whenClient(config._server, config._botnick, "say", (self: any, message: any) => {
                // Say yes back to the bot
                if (sentReply) {
                    return;
                }
                sentReply = true;

                self.emit("message", receivingOp.nick, config._botnick, "yes");
            });
        }

        const res = await env.mockAppService._link(body);

        if (waitForState) {
            const state = env.bridgingState[roomId];
            // Wait until m.room.bridging has been set to the desired state
            if (waitForState === "pending") {
                await state.isPending.promise;
            }
            else if (waitForState === "success") {
                await state.isSuccess.promise;
            }
            else if (waitForState === "failure") {
                await state.isFailed.promise;
            }
        }

        return res;
    }