Skip to content

Put pg_temp last in SECURITY DEFINER search_path - #12

Open
jnasbyupgrade wants to merge 2 commits into
Postgres-Extensions:fix-script-guc-leakfrom
jnasbyupgrade:secdef-search-path-pg-temp
Open

jnasbyupgrade wants to merge 2 commits into
Postgres-Extensions:fix-script-guc-leakfrom
jnasbyupgrade:secdef-search-path-pg-temp

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude here.

Stacked on #11; base is fix-script-guc-leak.

The seven SECURITY DEFINER functions now use SET search_path = pg_catalog, pg_temp. With plain pg_catalog, pg_temp is searched first for relations and types, and process_language() and extract_parameters() EXECUTE SQL containing unqualified type names.

  • sql/trunklet.sql: all seven clauses changed.
  • sql/trunklet--0.3.3--stable.sql: ALTER FUNCTION ... SET search_path for each, so updated installs match fresh ones.
  • test_secdef_privs: asserts the exact value pg_catalog, pg_temp for every SECURITY DEFINER function in the extension (the test compares proconfig to ARRAY['search_path=pg_catalog, pg_temp']). It runs on both the fresh and update install paths.
  • HISTORY.asc: entry added.

Released scripts are unchanged. make test and make test-update pass on PG12 and PG17.

SET search_path = pg_catalog leaves pg_temp searched first for relations
and types. List it last explicitly, in fresh installs and in the
0.3.3--stable update, and assert it for every SECURITY DEFINER function
in the extension.
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7f86cbb1-f5e9-401f-ac83-0c353c42a7dd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

An ends-with-pg_temp check passes for 'public, pg_catalog, pg_temp'.
Compare against the exact value, and comment the ALTER block in the
0.3.3--stable update script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant