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

pgAdmin imports servers to the wrong accounts in the server version with webserver auth enabled #6815

Closed
konradziczek opened this issue Oct 4, 2023 · 5 comments
Assignees
Milestone

Comments

@konradziczek
Copy link

konradziczek commented Oct 4, 2023

Please note that security bugs or issues should be reported to [email protected].

Describe the bug

After importing the .json file with the server, sometimes (not always) it is imported to another user's account, and the list of servers in my account is still empty. The problem never appears when creating a server manually.

To Reproduce

The main thing that I think may be related to the problem is that I am using the following configuration:
AUTHENTICATION_SOURCES = ['webserver']

Users are authorized using basic auth, and the accounts are retrieved by a PHP script. Such accounts in the pgAdmin sqlite database do not have an email, only a username.

Expected behavior

Servers are always imported under the account of the user who imports them.

Error message

No error message - after import, a message appears stating that the operation was successful.

Screenshots

Select from pgAdmin sqlite "server" table:

Captura desde 2023-10-04 11-12-10

The last server was imported on user 12 and as you can see it was added on user 2. User 2 confirmed to me that he sees the server imported on my account in his account.

Desktop (please complete the following information):

  • OS: Rocky Linux 9
  • Version: 7.6 (docker latest)
  • Mode: Server
  • Browser (if running in server mode): Firefox
  • Package type: Docker

Additional context

Add any other context about the problem here.

@konradziczek konradziczek changed the title pgAdmin imports servers to the wrong accounts in the web version pgAdmin imports servers to the wrong accounts in the web version with webserver auth enabled Oct 4, 2023
@konradziczek konradziczek changed the title pgAdmin imports servers to the wrong accounts in the web version with webserver auth enabled pgAdmin imports servers to the wrong accounts in the server version with webserver auth enabled Oct 4, 2023
@konradziczek
Copy link
Author

I think I found where the problem is:

new_user = User.query.filter_by(email=user).first()

There are no email addresses in webserver auth method, only usernames. For this reason, it searches for users with an empty email address and provides any one.

@konradziczek
Copy link
Author

Bugfix proposed #6818

@adityatoshniwal
Copy link
Contributor

Hi @amarel123,
Can you confirm if this is working?

@yogeshmahajan-1903
Copy link
Contributor

An error while importing server.
Screenshot 2024-01-03 at 3 35 08 PM

@yogeshmahajan-1903 yogeshmahajan-1903 moved this from In Testing to 🏗 In Progress in Current Sprint (184) Jan 3, 2024
khushboovashi added a commit that referenced this issue Jan 3, 2024
@khushboovashi khushboovashi moved this from 🏗 In Progress to In Testing in Current Sprint (184) Jan 3, 2024
@yogeshmahajan-1903 yogeshmahajan-1903 self-assigned this Jan 4, 2024
@yogeshmahajan-1903
Copy link
Contributor

This is working fine.

@akshay-joshi akshay-joshi moved this from In Testing to ✅ Done in Current Sprint (184) Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment