encrypt mutilple tables association table not use encrypt
See original GitHub issueencrypt mutiple table association table not use encrypt .
version 4.1.0
Question: Multi-table query only encrypt process first table, other table’s encrypt fields ignored。
Want to: i want to query and return all encrypted fields in all tables not just first table in sql;
it’s ok :
tableA email
is encrypt field
ShardingSphere-SQL - Logic SQL: select A.email as email from tableA as A cross join tableB as B where A.key = B.key;
// query and return A.email_encrypt , because tableA is left (first) side in sql;
ShardingSphere-SQL - Actual SQL: select A.email_encrypt as email from tableA as A cross join tableB as B where A.key = B.key;
it’s not:
ShardingSphere-SQL - Logic SQL: select A.email as email from tableB as B cross join tableA as A where A.key = B.key;
// not query and return A.email_encrypt , because tableA is right side in sql;
ShardingSphere-SQL - Actual SQL: select A.email as email from tableB as B cross join tableA as A where A.key = B.key;
because this:
// EncryptProjectionTokenGenerator.java
@Override
public Collection<SubstitutableColumnNameToken> generateSQLTokens(final SelectStatementContext selectStatementContext) {
ProjectionsSegment projectionsSegment = selectStatementContext.getSqlStatement().getProjections();
// TODO process multiple tables
String tableName = selectStatementContext.getSqlStatement().getSimpleTableSegments().iterator().next().getTableName().getIdentifier().getValue();
return getEncryptRule().findEncryptTable(tableName).map(
encryptTable -> generateSQLTokens(projectionsSegment, tableName, selectStatementContext, encryptTable)).orElseGet(Collections::emptyList);
}
Qustion:
if i just use ss’ encrypt feature, and single data point , may i rewrite to this ? rewrite all fields in all tables , not just left (first) table;
after:
@Override
public Collection<SubstitutableColumnNameToken> generateSQLTokens(final SelectStatementContext selectStatementContext) {
ProjectionsSegment projectionsSegment = selectStatementContext.getSqlStatement().getProjections();
Iterator<SimpleTableSegment> simpleTableSegmentIterator = selectStatementContext.getSqlStatement().getSimpleTableSegments().iterator();
Collection<SubstitutableColumnNameToken> results = new LinkedList<>();
while (simpleTableSegmentIterator.hasNext()) {
String tableName = simpleTableSegmentIterator.next().getTableName().getIdentifier().getValue();
results.addAll(getEncryptRule().findEncryptTable(tableName).map(encryptTable ->
generateSQLTokens(projectionsSegment, tableName, selectStatementContext, encryptTable)).orElseGet(Collections::emptyList));
}
return results;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Encrypting the relationship between two database tables
Does there exist a common encryption scheme that securely encrypts client_id and lawyer_id without rendering the Join Table useless? encryption ...
Read more >Always Encrypted - SQL Server - Microsoft Learn
Always Encrypted supports two encryption types: ... which aren't grouped with other records and aren't used to join tables.
Read more >c# - Sql 2016 Always Encrypted - Join operation with ...
If you REALLY must join the two tables, you should encrypt both columns with deterministic encryption.
Read more >How to Encrypt Specific Database Tables with CockroachDB
Find the table ranges; Find the encrypted and unencrypted store IDs; Confirm that the ranges from the tables are mapped to the correct...
Read more >An overview of the column level SQL Server encryption
It is recommended to use the symmetric key for data encryption since we get excellent performance in it. For column encryption, we use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
#12504 #12462 It’s will be fixed util this pr merged.
merged and supported, it could be closed now.