Skip to content

Conversation

@LucianBuzzo
Copy link
Contributor

This changes removes the edge case chance that SET ROLE is never reset either by a rollback or SET ROLE none, by switching to SET LOCAL ROLE which will last only until the end of the current transaction.

Whilst the scenario where the role leaks outside of the transaction without being reset correctly is extremely unlikely, and I am unable to create test scenario that replicates it, I think it is wise to future proof the code and make further guarantees that the leak cannot occur.

See:

@LucianBuzzo LucianBuzzo force-pushed the lucianbuzzo/use-local-role branch from 4d6f6db to 9413541 Compare November 13, 2025 10:47
@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

Published beta package version: 3.7.0-beta.dangerous.b320dec

@LucianBuzzo LucianBuzzo force-pushed the lucianbuzzo/use-local-role branch 4 times, most recently from b38c52b to 41758a1 Compare November 13, 2025 11:06
This changes removes the edge case chance that `SET ROLE` is never reset
either by a rollback or `SET ROLE none`, by switching to `SET LOCAL
ROLE` which will last only until the end of the current transaction.

Whilst the scenario where the role leaks outside of the transaction
without being reset correctly is extremely unlikely, and I am unable to
create test scenario that replicates it, I think it is wise to future
proof the code and make further guarantees that the leak cannot occur.

See:
- https://www.postgresql.org/docs/14/sql-set-role.html
- https://www.postgresql.org/docs/14/sql-set.html
@LucianBuzzo LucianBuzzo force-pushed the lucianbuzzo/use-local-role branch from 41758a1 to c9a8514 Compare November 13, 2025 11:19
@sonarqubecloud
Copy link

Copy link
Member

@SarjuHansaliya SarjuHansaliya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LucianBuzzo LucianBuzzo merged commit 35a7394 into master Nov 13, 2025
8 checks passed
@LucianBuzzo LucianBuzzo deleted the lucianbuzzo/use-local-role branch November 13, 2025 11:21
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.

3 participants