fix(synology-chat): land @bmendonca3 fail-closed allowlist follow-up (#25827)

Carry fail-closed empty-allowlist guard clarity and changelog attribution for PR #25827.

Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local>
This commit is contained in:
Peter Steinberger
2026-02-25 01:19:43 +00:00
parent 0078070680
commit 7dfac70185
3 changed files with 3 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ describe("validateToken", () => {
});
describe("checkUserAllowed", () => {
it("rejects user when allowlist is empty", () => {
it("rejects all users when allowlist is empty", () => {
expect(checkUserAllowed("user1", [])).toBe(false);
});

View File

@@ -29,6 +29,7 @@ export function validateToken(received: string, expected: string): boolean {
* Allowlist mode must be explicit; empty lists should not match any user.
*/
export function checkUserAllowed(userId: string, allowedUserIds: string[]): boolean {
if (allowedUserIds.length === 0) return false;
return allowedUserIds.includes(userId);
}