DBX
DBX home
Acme ProductionPRODUCTIONExit Demo
Run Scan
Findings
Medium

Mutable search_path on public.refresh_usage_totals()

Affected:
public.refresh_usage_totals()
Category:
Functions
Confidence:
high
First detected:
2026-08-12 11:04Z
Last verified:
2026-08-16 09:41Z

Summary

public.refresh_usage_totals() executes with owner privileges but resolves objects through the caller's search_path.

Why this matters

A role able to create objects in a schema earlier in the search path can shadow a referenced table or operator and have their definition executed with elevated privileges.

Evidence

Object
public.refresh_usage_totals()
Function security
SECURITY DEFINER
proconfig search_path
(not set)
Executable by
service_role

Facts above were derived by the scanner from database metadata. No model output is involved in the verdict.

Technical details

pg_proc.prosecdef is true and pg_proc.proconfig contains no search_path entry.

recommended remediation

Unlock Full Audit (Demo)

Bottom 35% of Supabase projects we've scanned.
Production-Ready Fixes
Ready to scan your own database?
Buy Remediation Credits — $19

Includes 5 Activation Credits

Pin search_path on the function.

Current

1CREATE OR REPLACE FUNCTION public.refresh_usage_totals()
2...
3SECURITY DEFINER
4AS $$ ... $$;

Proposed

1ALTER FUNCTION public.refresh_usage_totals()
2 SET search_path = public, pg_temp;

Expected security effect

  • Object resolution pinned
  • Schema shadowing path removed

Compatibility risk

low

Unqualified references to objects outside public will need schema qualification.

DBX never applies SQL to your database.