Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check state key while parsing m.call.member state events. #4265

Open
toger5 opened this issue Jun 21, 2024 · 0 comments
Open

Check state key while parsing m.call.member state events. #4265

toger5 opened this issue Jun 21, 2024 · 0 comments
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow T-Task Tasks for the team like planning

Comments

@toger5
Copy link
Contributor

toger5 commented Jun 21, 2024

Currently we do not check m.call.member state event keys allowing users to have multiple events for one device.

This is not to spec.
We should check the key when parsing the state event here:

if (!(data.expires || data.expires_ts)) {
throw new Error("Malformed membership: expires_ts or expires must be present");
}
if (data.expires) {
if (typeof data.expires !== "number") {
throw new Error("Malformed membership: expires must be numeric");
}
}
if (data.expires_ts) {
if (typeof data.expires_ts !== "number") {
throw new Error("Malformed membership: expires_ts must be numeric");
}
}
if (typeof data.device_id !== "string") throw new Error("Malformed membership event: device_id must be string");
if (typeof data.call_id !== "string") throw new Error("Malformed membership event: call_id must be string");
if (typeof data.scope !== "string") throw new Error("Malformed membership event: scope must be string");
if (!parentEvent.getSender()) throw new Error("Invalid parent event: sender is null");
}

Comment with more details: #4262 (comment)

@dosubot dosubot bot added the T-Defect label Jun 21, 2024
@dbkr dbkr added T-Task Tasks for the team like planning O-Uncommon Most users are unlikely to come across this or unexpected workflow and removed T-Defect labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow T-Task Tasks for the team like planning
Projects
None yet
Development

No branches or pull requests

2 participants