Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg_signal_backend check is too restrictive #7217

Closed
pmpetit opened this issue Feb 14, 2024 · 8 comments
Closed

pg_signal_backend check is too restrictive #7217

pmpetit opened this issue Feb 14, 2024 · 8 comments
Assignees
Milestone

Comments

@pmpetit
Copy link

pmpetit commented Feb 14, 2024

Hi,

Please note that security bugs or issues should be reported to security@pgadmin.org.

Describe the bug

If you want to kill a session using
image

then i have this error message

image

but using a query i can

select pg_terminate_backend(149682)

i think it is because you check that

CASE WHEN 'pg_signal_backend'=ANY(ARRAY(WITH RECURSIVE cte AS (

the user has been granted with pg_signal_backend.

but in some case, you can kill a session if the user is granted with the connected user using 'with admin option'

for example i can kill if

grant the_user_to_kill to the_user_who_kill with admin option:

To Reproduce

Steps to reproduce the behavior:

  1. create 2 users
create user user1 with password user1;
create user user2 with password user2;
grant user2 to user1 with admin option;

create 2 psql sessions one with user 1 an other with user2

  1. go to pgadmin console connected as user1 and try to kill session using the red cross => you can't
  2. execute the code
select pg_terminate_backend(the pid of user2);

check that you can kill the session.

version is
image

thanks

@pmpetit pmpetit added the Bug label Feb 14, 2024
@yogeshmahajan-1903
Copy link
Contributor

@pmpetit
Can you please try on latest version 8.3?

@pmpetit
Copy link
Author

pmpetit commented Feb 26, 2024

can't test on 8.3, app does not run as 7.8 did.

Is there any breaking change between 7.8 & 8.3 ?

@pmpetit
Copy link
Author

pmpetit commented Feb 26, 2024

7.8 i use to load my server connection using

/venv/bin/python3 setup.py --load-servers 

@pmpetit
Copy link
Author

pmpetit commented Feb 26, 2024

i can not import user anymore

The specified user ID (pierremarie.petit.partxxxxxxyyyzzzz) could not be found.

in 7.8 I was using
path/to/python /path/to/setup.py --load-servers input_file.json --user user@example.com

But now in 8.3 it seems to have changed
Do you have the equivalent in 8.3 ?

(I use load-servers only , but to set username from authent not from inside db, I don't find
the doc says # or, to specify a non-default user name and auth source (the default)
Thx

@yogeshmahajan-1903
Copy link
Contributor

@pmpetit
Just remove '--' from load-servers. Now load-servers is command instead of switch.(In 8.3)

(Venv3121) % python3 setup.py load-servers ./server.json --user admin@admin.com
----------
Loading servers with:
User: admin@admin.com
SQLite pgAdmin config: <DB Path>pgadmin4.db
----------
Added 0 Server Group(s) and 1 Server(s)

@pmpetit
Copy link
Author

pmpetit commented Feb 27, 2024

ok thanks, now i can test in 8.3

i have the same problem.
image

@pmpetit
Copy link
Author

pmpetit commented Feb 27, 2024

but i can
image

pravesh-sharma added a commit to pravesh-sharma/pgadmin4 that referenced this issue Feb 29, 2024
adityatoshniwal pushed a commit that referenced this issue Feb 29, 2024
@pravesh-sharma pravesh-sharma removed their assignment Feb 29, 2024
@pravesh-sharma pravesh-sharma added this to the 8.4 milestone Feb 29, 2024
@yogeshmahajan-1903
Copy link
Contributor

This is working fine. Verified in 8.4 candidate build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants