Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle ip auth for report recall endpoint
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent cd420ea commit 45e05d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion functions/api/reports/recall.ts
Expand Up @@ -11,7 +11,11 @@ export async function onRequestPost(context: RequestContext) {

const reportUserId = await context.env.DATA.get(`reportprocessing_${id}`);

if (!reportUserId || context.data.current_user?.id !== reportUserId)
if (
!reportUserId ||
(context.data.current_user?.id !== reportUserId &&
context.request.headers.get("CF-Connecting-IP") !== reportUserId)
)
return new Response('{"error":"No processing report with that ID found"}', {
headers: {
"content-type": "application/json",
Expand Down

0 comments on commit 45e05d7

Please sign in to comment.