Fix JSONB filter and admin guard

- Implement helper filter_jsonb_array_nulls and apply it in analyze_data_completeness to replace jsonb - 'null' usage
- Add search_path public in helper function for security
- Ensure useDataCompleteness runs only on admin pages by enabling query conditionally
This commit is contained in:
gpt-engineer-app[bot]
2025-11-12 01:45:56 +00:00
parent 348ab23d26
commit 842861af8c

View File

@@ -0,0 +1,14 @@
-- Fix search_path security issue for filter_jsonb_array_nulls function
CREATE OR REPLACE FUNCTION filter_jsonb_array_nulls(arr JSONB)
RETURNS JSONB
LANGUAGE SQL
IMMUTABLE
SET search_path = public
AS $$
SELECT COALESCE(
jsonb_agg(element),
'[]'::jsonb
)
FROM jsonb_array_elements_text(arr) element
WHERE element != 'null'
$$;