From a3ae950bd18209097b218405cef81f55ad6bc613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 22 Aug 2026 11:45:17 +0200 Subject: [PATCH] Don't match pre-approved accounts when github id/node_id are unknown Before this commit, in presence of pre-approved accounts without a GitHub id or GitHub node, and commits without a full 'author', author.id and author.node_id are None and matched such pre-approved accounts even if the email did not match. --- cla/tasks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cla/tasks.py b/cla/tasks.py index 4369c9a..20184c1 100644 --- a/cla/tasks.py +++ b/cla/tasks.py @@ -116,12 +116,12 @@ async def check_pull_request( # Find and remove any PreApprovedAccounts, they do not need to sign pre_approved_accounts = set() for author in authors: - pre_approved_account = await PreApprovedAccount.objects.filter( - Q(github_id=author.id) - | Q(github_node_id=author.node_id) - | Q(github_login=author.login) - | Q(email_address__iexact=author.email) - ).afirst() + q = Q(github_login=author.login) | Q(email_address__iexact=author.email) + if author.id: + q |= Q(github_id=author.id) + if author.node_id: + q |= Q(github_node_id=author.node_id) + pre_approved_account = await PreApprovedAccount.objects.filter(q).afirst() if pre_approved_account: pre_approved_accounts.add(author)