-
Notifications
You must be signed in to change notification settings - Fork 132
Description
Describe the bug
Using Acra-server, the SELECT statement returns proper data when using raw table name, but blob of binary data when using table alias.
To Reproduce
Steps to reproduce the behavior:
- Use
pymysqlto runSELECTstatement with raw table data. It will return proper data - Re-run the same above
SELECTstatement, modified with aliased table name. Data will be returned as blob of data
Expected behavior
The SELECT statement should return proper data regardless of using raw or aliased table name
Acra configuration files
For AcraServer:
- [x] configuration file or CLI params that you use to start AcraServer;
- [x] encryptor_config.yaml if used.
config_file: /configs/acra-server.yaml
encryptor_config_file: /configs/acra-encryptor.yaml
tls_auth: 0
tls_client_id_from_cert: false
tls_database_auth: 0
mysql_enable: true
schemas:
- table: tasks
columns:
- id
- title
- content
- project_id
- parent_id
- status
- assigned
- progress
- is_mail
- start_date
- end_date
- note
- progress_update
- created
- modified
- created_by
- updated_by
- position
- delete_flag
encrypted:
- column: title
data_type: str
Environment (please complete the following information):
- Acra version: 0.96.0
- Database server and its version: MySQL 5.6.51
- Installed components:
- AcraServer
- AcraTranslator
- Data-in-transit encryption between Acra and the client-side application:
- TLS
- AcraConnector
- no transport encryption
- Installation way:
- via Docker
- via package manager
Additional context
Hi there. We're trying to use acra-server to produce a minimum working example on encrypting and decrypting fields in the database. We're connecting to the acra-server using pymysql and perform some simple SELECT statement:
SELECT title FROM tasks: This statement returns proper strings of titles, e.gTest nhiệm vụ 06/10SELECT Task.title FROM tasks AS Task: This statement returns a blob of binary instead of string, e.g(b'Test nhi\xe1\xbb\x87m v\xe1\xbb\xa5 06/10',). However we can translate it into desired data.
We expected that the 2nd statement will return proper string as the 1st one, since the whole big running system cannot change all the statements to use raw table name. We also cannot modify the original backend codebase to have an additional translator to translate these binaries to desired data.
The table is having title field to have data type of varbinary instead of original text so it could store the encrypted data properly (as you can see that the data can be retrieved and decrypted properly for the first SELECT statement).
We've added charset='utf8mb4' and use_unicode=True to pymysql settings to connect to acra-server but the result is the same.
The acra-server and the MySQL database are deployed on 2 different docker containers.
Hope that you will fix this issue since alias is commonly used. Shall you need any more information, feel free to ask.
Thanks.