Skip to content

Commit e65b176

Browse files
ggazzosampaiodiego
andauthored
fix: Domain allowance check to require exact matches (#39752)
Co-authored-by: Diego Sampaio <chinello@gmail.com>
1 parent 82adf3a commit e65b176

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/eight-colts-kiss.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@rocket.chat/federation-matrix": patch
3+
"@rocket.chat/meteor": patch
4+
---
5+
6+
Fixes an issue on Federation where all domains ending with the pattern where being allowed to communicate, the feature is meant to work with a list, url by url

ee/packages/federation-matrix/src/api/middlewares/isFederationDomainAllowed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export const isFederationDomainAllowedMiddleware = createMiddleware(async (c, ne
5252
return c.json({ errcode: 'M_MISSING_ORIGIN', error: 'Missing origin in authorization header.' }, 401);
5353
}
5454

55-
// Check if domain is in allowed list
56-
if (allowList.some((allowed) => domain.endsWith(allowed))) {
55+
// Check if domain is in allowed list (exact match only)
56+
if (allowList.some((allowed) => domain === allowed)) {
5757
return next();
5858
}
5959

0 commit comments

Comments
 (0)