From 6f4ea7cceb136d8a6f2722bf6bde2842d7c69b4d Mon Sep 17 00:00:00 2001 From: soufiane redouane Date: Mon, 17 Nov 2025 17:56:45 +0100 Subject: [PATCH] fix(postgrest): validate empty or invalid relation names in PostgrestClient.from() --- packages/core/postgrest-js/src/PostgrestClient.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/postgrest-js/src/PostgrestClient.ts b/packages/core/postgrest-js/src/PostgrestClient.ts index a20c9cf9a..6cefadd00 100644 --- a/packages/core/postgrest-js/src/PostgrestClient.ts +++ b/packages/core/postgrest-js/src/PostgrestClient.ts @@ -88,6 +88,10 @@ export default class PostgrestClient< * @param relation - The table or view name to query */ from(relation: string): PostgrestQueryBuilder { + if (!relation || typeof relation !== 'string' || relation.trim() === '') { + throw new Error('Invalid relation name: relation must be a non-empty string.') + } + const url = new URL(`${this.url}/${relation}`) return new PostgrestQueryBuilder(url, { headers: new Headers(this.headers),