A
A
Alexander2018-12-25 09:00:48
Python
Alexander, 2018-12-25 09:00:48

What is the best way to perform authorization in a separate program connecting to the database?

There is some program that connects to an external database, while the user and password for connecting to the database are stored in the program code and can be compromised (in theory). The program written in python first connects to the database with a user and password hard-coded in the code, and then requests authorization, while checking the user against the user in the table. Thus, before entering the password, you can access absolutely any data by changing the program code (python is interpreted after all) - even if the code is in "*.pyc".
So how can you improve the authorization procedure? Should the user be authorized in the database? Or should you not bother and just set a crypto-resistant password to enter the operating system?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2018-12-25
@NeiroNx

Connect with an OS user account.
Then to use the account in a DBMS. For example, dialogs for connecting to databases .
If complication does not stop you, then you can use your own system: a user table and a module for managing it.
The primary connection gives access only to the users table. Here you can set any level of protection. After logging in, switch the user to the desired account. Since this switch will be on the server side, the password will not be compromised. This is not the use of an intermediate layer (application), everything can be done with one procedure in the SQL server itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question