
Let's say that on the client I call a function:
TypeScript
//INSERT FUNCTION ID HERE
);```
and then on the server I have this:
export default async ({ req, res, log, error }) => {
if (req.path === "/") { const userId = req.headers['x-appwrite-user-id']; log(userId); } ... }
TypeScript
Is it guaranteed that the userId on the server is the user who triggered the function or can it be spoofed? Does it need to be validated with x-appwrite-user-jwt? I am making it so that only users can execute the function also...
TL;DR
The `x-appwrite-user-id` header can be spoofed if not validated with `x-appwrite-user-jwt`. Always validate the user ID to ensure only authorized users can execute the function.Recommended threads
- Unable to add permission when creating a...
I am creating a collection from a cloud function using the Appwrite Dart server SDK, and I want to add permissions so it can be accessed by users. I added code ...
- Create owner team member with Server fun...
I understand that when creating a team with a function, the user that made the request will not be the owner so I think I have to add the user that did the requ...
- Schedule a function job with timezone
I am aware that cron schedule will work on UTC timezone. I would like to run my function at a particular time everyday in new york time. If I use UTC, it will m...
