Fix supautils_hook to use the correct role name in ALTER ROLE#185
Merged
steve-chavez merged 2 commits intomasterfrom Apr 2, 2026
Merged
Conversation
Pull Request Test Coverage Report for Build 23877545812Details
💛 - Coveralls |
7186a3f to
90fc1e3
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a crash in supautils_hook when ALTER ROLE targets current_user / current_role while running as privileged_role, by resolving the role spec to an actual role name before checking privileged-role restrictions.
Changes:
- Use
get_rolespec_name(stmt->role)(viarole_name) when callingis_role_privileged(...)forALTER ROLEstatements. - Add a regression test to ensure
ALTER ROLE current_user/ALTER ROLE current_roledoes not crash underprivileged_role. - Add an alternate expected output file (
privileged_role_1.out) to accommodate differing server behavior forcurrent_role.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/supautils.c |
Prevents NULL role-name dereference by using the resolved RoleSpec name for privileged-role checks. |
test/sql/privileged_role.sql |
Adds regression coverage for ALTER ROLE current_user/current_role under privileged_role. |
test/expected/privileged_role.out |
Updates expected output to include the new regression assertions. |
test/expected/privileged_role_1.out |
Adds alternate expected output variant for environments where current_role yields a syntax error. |
za-arthur
approved these changes
Apr 1, 2026
steve-chavez
reviewed
Apr 1, 2026
9263328 to
d80a2bf
Compare
It has a different output on pg <= 13.
d80a2bf to
1ecdbac
Compare
steve-chavez
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Fixes a bug in the
supautils_hookthat causes a crash. See #108 for more details.